Publishing every frame of a turtlebot3 waffle under a namespace
Hello,
I'm working on ros noetic on Ubuntu 20.04, and I'm trying to get my robot_state_publisher node to have each frame published with "/tb3_0" before it. For example, instead of the frames being /odom, /base_footprint, /base_link, etc.. it would be /tb3_0/odom, /tb3_0/base_footprint, and /tb3_0/base_link. Below is my launch file:
<launch>
<arg name="model" default="$(env TURTLEBOT3_MODEL)" doc="model type [burger, waffle, waffle_pi]"/>
<arg name="first_tb3" default="tb3_0"/>
<arg name="second_tb3" default="tb3_1"/>
<arg name="third_tb3" default="tb3_2"/>
<arg name="first_tb3_x_pos" default="-7.0"/>
<arg name="first_tb3_y_pos" default="-1.0"/>
<arg name="first_tb3_z_pos" default=" 0.0"/>
<arg name="first_tb3_yaw" default=" 1.57"/>
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="world_name" value="$(find turtlebot3_gazebo)/worlds/turtlebot3_house.world"/>
<arg name="paused" value="false"/>
<arg name="use_sim_time" value="true"/>
<arg name="gui" value="true"/>
<arg name="headless" value="false"/>
<arg name="debug" value="false"/>
</include>
<param name="robot_description" command="$(find xacro)/xacro --inorder
$(find turtlebot3_description)/urdf/turtlebot3_$(arg model).urdf.xacro" />
<node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher"
output="screen">
<param name="publish_frequency" type="double" value="50.0" />
<param name="tf_prefix" value="$(arg first_tb3)" />
<remap from="tf" to="tf_old"/>
</node>
<node pkg="tf" type="tf_remap" name="tf_remapper" output="screen">
<rosparam param="mappings">
[{old: odom, new: tb3_0/odom}, {old: base_footprint, new: tb3_0/base_footprint},
{old: base_link, new: tb3_0/base_link}, {old: base_scan, new: tb3_0/base_scan},
{old: caster_left_link, new: tb3_0/caster_left_link},
{old: caster_right_link, new: tb3_0/caster_right_link},
{old: imu_link, new: tb3_0/imu_link},
{old: wheel_left_link, new: tb3_0/wheel_left_link},
{old: wheel_right_link, new: tb3_0/wheel_right_link},
{old: camera_link, new: tb3_0/camera_link},
{old: camera_depth_frame, new: tb3_0/camera_depth_frame},
{old: camera_depth_optical_frame, new: tb3_0/camera_depth_optical_frame},
{old: camera_rgb_frame, new: tb3_0/camera_rgb_frame},
{old: camera_rgb_optical_frame, new: tb3_0/camera_rgb_optical_frame}]
</rosparam>
</node>
<node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" args="-urdf -model $(arg first_tb3)
-x $(arg first_tb3_x_pos) -y $(arg first_tb3_y_pos) -z $(arg first_tb3_z_pos)
-Y $(arg first_tb3_yaw) -param robot_description" />
</launch>
From the tf wiki(http://wiki.ros.org/tf#tf_remap), it says for to remap tf frames from an old name to a new name, it subscribes to /tf_old, so in my /robot_state_publisher node, I remap from "tf" to "tf_old" so the tf_remap can listen to this topic and rename the frames. However, when I provide the list of frames to rename, my tf tree output looks like the following:
output of $ rosrun tf view_frames
It seems to only rename base_link to tb3_0/base_link renamed by the tf_remapper node but all the other frames have the same name and only have the wheel links attached to it(without their names changed). I was wondering how I can solve this issue.
I also wanted to do this in a group namespace, because I ultimately want 3 robots all publishing their unique frames under namespaces, and I also want to include a robot that has non-static joints added(will use a joint_state_publisher for each). However, if I try this ...
I'm new to this community and I'm wondering how long it takes for the posts to get approved. I asked this two days ago but it still says it's awaiting moderation.
Sorry about this! The process is like this: All posts by new users have to be approved by a moderator (to fight spam). I've just done that for your post. From now on, your posts will automatically skip the moderation queue. Unfortunately, there is no coordination between the moderators. Apparently, there used to be someone (I don't know who, but I have a guess) that used to approve all the posts regularly, and they seem to have stopped doing that a couple of weeks ago. I'll see if I can work it into my daily schedule.