how to make 2 robot models in Rviz?

asked 2016-07-28 14:57:14 -0600

baozhang gravatar image

Hi,

I am struggling to spawn multiple robot models in Rviz. I would like someone to help me.

I make launch file like below.

<param name="robot_description" command="$(find xacro)/xacro.py $(find robot_display)/src/robot.xacro"/>

<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher">
 <param name="rate" type="int" value="70" />
 <param name="use_gui" value="true"/>
 <rosparam param="source_list">[sensor_joint_states]</rosparam>
</node>

<node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher">
 <param name="publish_frequency" type="double" value="100.0" />
</node>

<param name="robot_description_stabilized" command="$(find xacro)/xacro.py $(find robot_display)/src/stabilized_robot.xacro"/>  

<node name="joint_state_publisher_stabilized" pkg="joint_state_publisher" type="joint_state_publisher">
 <param name="rate" type="int" value="70" />
 <param name="use_gui" value="true"/>
 <rosparam param="source_list">["sensor_joint_states_stabilized"]</rosparam>
</node>

<node name="robot_state_publisher_stabilized" pkg="robot_state_publisher" type="state_publisher">
 <remap from="robot_description" to="robot_description_stabilized" />
 <param name="publish_frequency" type="double" value="100.0" />
</node>

The types of "sensor_joint_states" and "sensor_joint_states_stabilized" are sensor_msgs/JointState and contain joint info. (the topic coming from sensor_joint_states_stabilized is shown below)

name: ['stabilized/back_left_shoulder_joint', 'stabilized/front_left_foot_joint', 'stabilized/front_left_shoulder_joint', 'stabilized/front_right_foot_joint', 'stabilized/front_right_shoulder_joint', 'stabilized/back_right_foot_joint', 'stabilized/back_right_intmLeg_joint', 'stabilized/front_right_intmLeg_joint', 'stabilized/back_left_foot_joint', 'stabilized/back_left_intmLeg_joint', 'stabilized/back_right_shoulder_joint', 'stabilized/front_left_intmLeg_joint']
position: [-0.019245322964813256, 0.9237755023110362, -0.019245322964813256, 1.1183671011774814, -0.013899399919031795, 1.091637485948574, -0.44478079740901744, -0.809372749131313, 0.8489325796700958, -0.7719512878108428, -0.002138369218312584, -0.9654737020681317]
velocity: [0.0, 0.0, 0.011623892805, 0.0, -0.058119464025, 0.0, 0.0, 0.0, 0.0, 0.0, -0.02324778561, 0.0]
effort: [0.0234375, 0.0078125, 0.0244140625, 0.015625, -0.0205078125, -0.015625, 0.03125, 0.03125, -0.0078125, 0.0390625, -0.0244140625, 0.03125]

The model of robot_description can reflect joint states of 'sensor_joint_states', whereas the model of robot_description_stabilized cannot. I checked 'joint_states' which is published topic from "joint_state_publisher" node. It did't reflect "sensor_joint_states_stabilized" info.

> name: ['front_left_shoulder_joint',
> 'front_left_intmLeg_joint',
> 'front_left_foot_joint',
> 'front_right_shoulder_joint',
> 'front_right_intmLeg_joint',
> 'front_right_foot_joint',
> 'back_left_shoulder_joint',
> 'back_left_intmLeg_joint',
> 'back_left_foot_joint',
> 'back_right_shoulder_joint',
> 'back_right_intmLeg_joint',
> 'back_right_foot_joint'] position: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] velocity: [] effort: []

I have no idea why this happened. Is that a right way to use joint_state_publisher and robot_state_publisher?

I'm sorry for writing long question.

edit retag flag offensive close merge delete