Skip to content

f1: namespace the car by entity so N of them can run together#769

Closed
anishk85 wants to merge 1 commit into
JdeRobot:humble-develfrom
anishk85:f1-multi-robot-namespace
Closed

f1: namespace the car by entity so N of them can run together#769
anishk85 wants to merge 1 commit into
JdeRobot:humble-develfrom
anishk85:f1-multi-robot-namespace

Conversation

@anishk85

@anishk85 anishk85 commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

f1: namespace the car by entity so N of them can run together

lets the same robot be spawned more than once in one simulation. pairs with the
multi-robot support in RoboticsApplicationManager and RoboticsAcademy.

what changed

the launch file takes a new entity argument (default f1, so a single-car
launch behaves exactly as before) and uses it as the ros/gazebo namespace:

  • the xacro is rendered per car with a namespace mapping, so the model's plugin
    topics become /<entity>/F1ROS/cmd_vel, /<entity>/F1ROS/odom, the camera and
    the laser scan
  • the bridge yaml is rendered per namespace too, since the stock one points at
    fixed gz topics
  • robot_state_publisher, the gz bridge and the image bridge all run inside the
    namespace, and the car spawns as -name <entity> from /<entity>/robot_description

so two cars come up as /f1_0/... and /f1_1/... and never share a topic or a
node name. RAM passes the entity it generated for each robot.

@anishk85 anishk85 marked this pull request as draft July 9, 2026 21:17
from launch_ros.parameter_descriptions import ParameterValue


def _render_bridge(package_dir, namespace):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely not. There are much better ways of handling launching a ROS bridge.

For example in the dingo robot in this repo

@@ -1,66 +1,86 @@
import os
import re

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this

Y = LaunchConfiguration("Y")
sensor = LaunchConfiguration("sensor")
mode = LaunchConfiguration("mode")
sensor = LaunchConfiguration("sensor").perform(context)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perform must not be used directly


<xacro:f1_velocity topic="/F1ROS/cmd_vel"/>
<xacro:f1_odom topic="/F1ROS/odom" freq="50"/>
<xacro:f1_velocity topic="/$(arg namespace)/F1ROS/cmd_vel"/>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The namespace is F1ROS

<visualize>1</visualize>
<update_rate>20</update_rate>
<topic>f1/laser/scan</topic>
<topic>/$(arg namespace)/f1/laser/scan</topic>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The namespace is f1

<xacro:arg name="ackermann" default="false"/>
<xacro:arg name="camera" default="true"/>
<xacro:arg name="laser" default="false"/>
<!-- entity name = ROS/gz namespace, so N cars don't share topics -->

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not entity name

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not pass the namespace to the macro

@javizqh

javizqh commented Jul 10, 2026

Copy link
Copy Markdown
Member

Closed in favor of a cleaner and working approach #770

@javizqh javizqh closed this Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants