Using Two Robots (two robot_description) in ROS
I am using Baxter Robot in ROS. Recently, a new robot is developed. I can visualize this newly build robot inside RViz in a standalone ROS by only sourcing devel/setup.bash
but not sourcing baxter.sh
.
In order to use this robot with the Baxter robot, I need to use a new parameter for robot_description
. I also need to publish the joint states on a topic different than /joint_states
. Since the parameters robot_description
and /joint_states
are occupied by the Baxter robot.
In order to use this robot with Baxter robot, I am doing the following modifications:
<launch>
<arg name="ns_prefix" default="/subject"/>
<arg name="model" default="$(find my_subject)/files/subject.urdf"/>
<arg name="rviz_config" default="$(find my_subject)/files/display.rviz"/>
<param name="subject_description" command="$(find xacro)/xacro --inorder $(arg model)"/>
<param name="use_gui" value="true"/>
<!-- Note that this is disabled since I have a separate joint_state_publisher
<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher"/>
-->
<node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher"/>
<node name="rviz" pkg="rviz" type="rviz" args="-d $(arg rviz_config)" required="true"/>
<group ns="$(arg ns_prefix)">
<node name="my_joint_state_publisher" pkg="my_subject" type="my_joint_state_publisher" output="screen">
<param name="subject_base" value="subject_base" />
</node>
</group>
</launch>
Please note that I have a separate joint_state_publisher
defined inside my_joint_state_publisher
which publishes to /subject/my_joint_state_publisher/joint_states
. More precisely, the joint state publisher is defined in the following way:
ros::NodeHandle nh("~");
ros::Publisher jointStatePub = nh.advertise<sensor_msgs::JointState>("joint_states", 1);
Unfortunately, I am still missing something here as RViz is not able to receive the joint states. Please note that Rviz is able to read the URDF as I changed the robot config inside Rviz from robot_description
to subject_description
.
I want to know the followings:
- How to configure ROS and Rviz in this scenario?
- How to use TF for both robots? (Please note that I do have the info. of transformation between these two robots)
Any comments, please?