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

TurtleBot3 namespace issues (ROS1 Melodic)

asked 2021-12-09 06:56:32 -0600

WarTurtle gravatar image

updated 2021-12-09 07:11:16 -0600

Hello, I am trying to implement some code that works with multiple turtlebot3s in a gazebo simulation onto a real robot. The problem I am having is trying to create namespaces for each robot from a launch file. Currently just using the default turtlebot3 files to debug.

Following the instruction on this tutorial and writing this command on the robot:

ROS_NAMESPACE=Bot1 roslaunch turtlebot3_bringup turtlebot3_robot.launch multi_robot_name:="Bot1" set_lidar_frame_id:="Bot1/base_scan"

I get a nice output using rostopic list:

/Bot1/battery_state
/Bot1/cmd_vel
/Bot1/cmd_vel_rc100
/Bot1/diagnostics
/Bot1/firmware_version
/Bot1/imu
/Bot1/joint_states
/Bot1/magnetic_field
/Bot1/motor_power
/Bot1/odom
/Bot1/reset
/Bot1/rpms
/Bot1/scan
/Bot1/sensor_state
/Bot1/sound
/Bot1/version_info
/diagnostics
/rosout
/rosout_agg
/tf

But when I try to write this to work in a launch file, as so:

<launch>
  <include file="$(find turtlebot3_bringup)/launch/turtlebot3_robot.launch">
    <arg name="multi_robot_name" value="Bot1"/>
    <arg name="set_lidar_frame_id" value="Bot1/base_scan"/>
  </include>
</launch>

I get the same outputs but without a namespace.

/battery_state
/cmd_vel
/cmd_vel_rc100
/diagnostics
/firmware_version
/imu
/joint_states
/magnetic_field
/motor_power
/odom
/reset
/rosout
/rosout_agg
/rpms
/scan
/sensor_state
/sound
/tf
/version_info

But if I run rostopic echo /odom, the frame_id and child_frame_id are "Bot1/odom" and "Bot1/base_footprint" respectively. So the namespace works, just not correctly?

Any help would be appreciated.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-12-09 08:12:15 -0600

Mike Scheutzow gravatar image

updated 2021-12-09 08:14:05 -0600

Those are not equivalent launch files, because you have not implemented the ROS_NAMESPACE=Bot1 part in the launch file. You want to look up how the <group ns="Bot1"> tag is used to modify the ros-node and topic names.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2021-12-09 06:56:32 -0600

Seen: 159 times

Last updated: Dec 09 '21