ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

gz bridge remap

asked 2023-06-20 06:09:59 -0600

SébastienL gravatar image


For my bridge i used a config file where topics are

  gz_topic_name: '/model/cis_drone/pose'
  ros_topic_name: "/cis_drone/pose"

and i used it in a launch file with

       name: "config_file"
       value: "src/config/ros_gz_bridge.default.yml"

It works fine, now I want to add flexibility to this bridge so that the drone name could be changed. For this I use the remap key, but it does not work.

      from: /model/cis_drone/pose
      to: /model/$(var drone_name)/pose


$ ros2 launch src/gz/launch_drone.yml drone_name:=bart_1

I expect to change /model/cis_drone/pose (gazebo default topic from config file) to /model/bart_1/pose which is where data is published. I say it does not work because nothing is publish on ros node.

I also try to use command line only, and have the same pb. I can remap the ros topic, but not the gazebo topic.

[don't know if it is valuable information but the drone is spawn and thus not present in the sdf file.]

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2023-06-21 02:42:47 -0600

Remap will work on the ROS topic names. From your bridge config file what you want is probably to remap /cis_drone/pose to /$(var drone_name)/pose, without the /model prefix that is for the Gazebo topic.

edit flag offensive delete link more


remapping the ros node works, but as nothing is publish in /model/cis_drone/pose, nothing is publish in the ros node either. As a workaround, I used jinja to generate the config file.

SébastienL gravatar image SébastienL  ( 2023-06-21 02:59:27 -0600 )edit

Question Tools

1 follower


Asked: 2023-06-20 06:09:59 -0600

Seen: 120 times

Last updated: Jun 21 '23