o3de / o3de-extras

Other
61 stars 61 forks source link

[ROS2] Using a robot_namespace in a spawn request has no effect #770

Open zakmat opened 18 hours ago

zakmat commented 18 hours ago

Describe the bug ROS2 Spawner does not handle robot_namespace field correctly. The robot is spawned however no namespace is set.

Assets required https://github.com/o3de/o3de-extras/tree/development/Gems/RosRobotSample can be used for convenience

Steps to reproduce

  1. Create a project with ROS2 and RosRobotSample Gems
  2. Open Default Level and add Entity with ROS2 Spawner Component
  3. Add rosbot_xl.prefab with rosbot name to the spawner and Start Game Mode
  4. Spawn two robots with the following commands:
    ros2 service call /spawn_entity gazebo_msgs/srv/SpawnEntity '{name: rosbot, robot_namespace: first }'
    ros2 service call /spawn_entity gazebo_msgs/srv/SpawnEntity '{name: rosbot, robot_namespace: second }'
  5. See available topics using ros2 topic list

Expected behavior Two rosbots are spawned in the scene. Topic list includes both first/cmd_vel and second/cmd_vel. Actual behavior Topic list has only one /cmd_vel that can be used to control both robots.

Found in Branch main (2409)

Commit ID from o3de/o3de and o3de/o3de-extras repositories o3de: e8570f9d635c0abbf3d733d0524a3c0ae75d726c o3de-extras: f71979b52a9f18f0313780d389e009f007ce2c36

Desktop/Device (please complete the following information):

Additional context Add any other context about the problem here.

michalpelka commented 15 hours ago

I can reproduce the issue, and assign blocker priority since it breaks existing projects (e.g. fleet template).

https://github.com/user-attachments/assets/5d12443f-1578-4f15-97bc-d89fc672a6b2

michalpelka commented 15 hours ago

The bug was introduced in PR #759