f1tenth / f1tenth_gym_ros

Containerized ROS communication bridge for F1TENTH gym environment.
MIT License
160 stars 116 forks source link

Multi-agent Support #35

Open ibrahimsel opened 1 year ago

ibrahimsel commented 1 year ago

Is there any plans ahead to add a feature that lets you add more than 2 agents?

gyiptgyipt commented 5 months ago

You can just simply change the number of agent in sim.yaml in config.

Here is my yaml file

bridge:
  ros__parameters:
    # topics and namespaces
    ego_namespace: "ego_racecar" # doesn't really do anything but needed for transforms
    ego_scan_topic: "scan"
    ego_odom_topic: "odom"
    ego_drive_topic: "drive"

    # opp topics: opp_namespace + "/" + opp_{}_topic
    # so opp's scan would be /opp_racecar/scan
    opp_namespace: "opp_racecar"
    opp_scan_topic: "scan"
    opp_odom_topic: "odom"
    opp_drive_topic: "drive"

    # simulation, lowering will help performance if needed
    sim_hz:  100  # how often the sim steps, default: 100
    tf_hz:   100  # how often tfs get published
    scan_hz: 100  # 40 for f1tenth regulations

    # transform related
    scan_distance_to_base_link: 0.0

    # laserscan parameters
    scan_fov: 4.7
    scan_beams: 1080

    # map parameters
    map_path: "/home/zyme/ros_ws/f1tenth/src/f1tenth_gym_ros/maps/Spielberg_map" # Levine, Spielberg, Spa, Oschersleben, IMS_map
    map_img_ext: ".png"

    # opponent parameters
    num_agent: 2

    # ego starting pose on map
    sx: 0.0
    sy: 0.0
    stheta: 0.0

    # opp starting pose on map
    sx1: 2.0
    sy1: 0.5
    stheta1: 0.0

    # teleop
    kb_teleop: True

and than you will see two-agent cars in rviz like that

Screenshot from 2024-06-02 11-04-05

ibrahimsel commented 5 months ago

More than 2 :). Like 8 or 32