Ask Your Question
0

/tf is not published properly in gazebo with JointTrajectoryController

asked 2016-06-20 22:05:03 -0500

johnyang gravatar image

updated 2016-06-20 22:50:19 -0500

I have built my own robot and it can be successfully simulated in gazebo 6. I can use JointTrajectoryController through rqt to move each joint without any issue. I also have a laser mounted on the robot and I would like to gather data and visualize it in RViz as well. However, when I look at the /tf tree in rqt, it doesn't publish all the /tf data between the links except the first one linked to the world and the last one linked to the laser unit (e.g. all the "fixed" joints is there but not the "revolute" joints). So when I try to display the robot model in Rviz, it is just missing some of the /tf information. If I pick the laser link as reference, I can visualize laser data in RViz.

Does anybody know what is missing or what is required to have gazebo publishing all the /tf information based on my robot_description?

<launch>
<param name="robot_description" command="$(find xacro)/xacro.py $(find lasertest_description)/urdf/lasertest.urdf.xacro" />

<!-- Spawn a robot into Gazebo -->
<node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" respawn="false" output="screen" args="-urdf -model lasertest -param robot_description" />

<!-- Load joint controller configurations from YAML file to parameter server -->
<rosparam file="$(find lasertest_control)/config/lasertest_traj_control.yaml" command="load"/>

<!-- load the controllers -->
<node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false"
output="screen" ns="/lasertest" args="joint_trajectory_controller"/>

<!-- convert joint states to TF transforms for rviz, etc -->
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher"
respawn="false" output="screen">
    <remap from="/joint_states" to="/lasertest/joint_states" />
</node>

<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />

<!-- Show in Rviz   -->
<node name="rviz" pkg="rviz" type="rviz" args="-d $(find lasertest_description)/launch/lasertest.rviz"/>
</launch>

So it is publishing /joint_states and /joint_trajectory but when I do rostopic echo on /tf_static, I can only get following:

transforms: 
  - 
    header: 
      seq: 0
      stamp: 
        secs: 0
        nsecs: 20000000
      frame_id: world
    child_frame_id: link0
    transform: 
      translation: 
        x: 0.0
        y: 0.0
        z: 0.1
      rotation: 
        x: 0.706825181105
        y: 0.0
        z: 0.0
        w: 0.707388269167
  - 
    header: 
      seq: 0
      stamp: 
        secs: 0
        nsecs: 20000000
      frame_id: link5
    child_frame_id: hokuyo_link
    transform: 
      translation: 
        x: 0.0
        y: 0.0
        z: -0.1
      rotation: 
        x: 0.999999682959
        y: 0.0
        z: 0.0
        w: 0.000796326710712
---
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-06-20 23:01:00 -0500

johnyang gravatar image

Actually I found the solution now. I just forgot to add the joint_state_controller to controller_spawner. So instead of

<node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false"
    output="screen" ns="/lasertest" args="joint_trajectory_controller"/>

I need:

<node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false"
    output="screen" ns="/lasertest" args="joint_trajectory_controller
                          joint_state_controller"/>
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-06-20 22:05:03 -0500

Seen: 552 times

Last updated: Jun 20 '16