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

Where is the Joint State information in a Create Turtlebot supposed to come from?

asked 2014-07-13 22:43:26 -0600

ChrisL8 gravatar image

updated 2014-07-13 22:45:27 -0600

I am hacking at the Create based TurtleBot code to operate my own robot using ROS Hydro.

I have created my own URDF modifications and some code changes. If I run:

roslaunch turtlebot_rviz_launchers view_model.launch

my Robot looks perfect and there are no problems in RVIZ.

However, when I bring up the robot and run:

roslaunch turtlebot_rviz_launchers view_robot.launch

RVIZ says that there is no transform connecting my left_wheel_link and right_wheel_link to the base_footprint. Also, it shows both wheels of my robot originating at 0,0,0 instead of being at the location specified by the joint in the URDF file.

Where is this transform supposed to come from? My suspicion is that it is supposed to be from /joint_states, published by turtlebot_node.py. When I run a gazebo simulation of the TurtleBot create model, /joint_states displays what appears to be appropriate information. However, the turtlebot_node.py code is hard coded to always publish "0, 0, 0":

    js = JointState(name = ["left_wheel_joint", "right_wheel_joint", "front_castor_joint", "back_castor_joint"],
                    position=[0,0,0,0], velocity=[0,0,0,0], effort=[0,0,0,0])

which is exactly what I see from /joint_states

So why does the gazebo simulation show real /joint_states data, but not the real Create Turtlebot? Or is there some other piece of the puzzle that I am missing here? Or am I on the wrong path looking at the /joint_states to try to solve my left/right_wheel_link issues in RVIZ?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-07-14 15:22:37 -0600

ChrisL8 gravatar image

updated 2014-07-14 15:24:43 -0600

The problem was a lack of a timestamp in the header on the JointState. I introduced this error when I was modifying the code.

Here is a full explanation in case it helps someone else:

This is the broken code that causes these symptoms in RVIZ:

  1. The wheels are "white" instead of the given color or the default red
  2. The wheels originate at 0, 0, 0 instead of the place the joint in URDF says they should
  3. RVIZ lists this error for the transforms in the robot model:

No transform from [left_wheel_link] to [base_footprint]

and

No transform from [right_wheel_link to [base_footprint]

BAD CODE:

    js = JointState(name = ["left_wheel_joint", "right_wheel_joint", "front_castor_joint", "back_castor_joint"],
                    position=[0,0,0,0], velocity=[0,0,0,0], effort=[0,0,0,0])
    self.joint_states_pub.publish(js)

ROS Bad Wheels.png

And here is the code that works fine:

    js = JointState(name = ["left_wheel_joint", "right_wheel_joint", "front_castor_joint", "back_castor_joint"],
                    position=[0,0,0,0], velocity=[0,0,0,0], effort=[0,0,0,0])
    js.header.stamp = rosNow
    self.joint_states_pub.publish(js)

ROS Happy Wheels.png

The difference is this line:

js.header.stamp = rosNow

Without the timestamp the joint_states message was not working.

Please note that publishing this static transform from a python script may be a bad idea, especially if you are in a tight loop publishing rapidly. I think a better solution may be to just make the wheel joint fixed in the URDF if it is not accomplishing anything for you. Another option would be to put a static transform for this joint into a launch file. But I wanted to explain what the cause of this error was.

edit flag offensive delete link more

Comments

Thanks for giving the information about a fix! I have the same problem and I am trying to apply the fix you propose but apparently my turtlebot_node.py is different, so I cannot. Could you post the entire file here so that I can compare the 2 in more detail?

jfabry gravatar image jfabry  ( 2015-10-07 09:31:44 -0600 )edit

where is turtlebot_node.py file located.I searched my whole system,but i couldn't find it...pls help

npa gravatar image npa  ( 2015-11-29 02:48:47 -0600 )edit

You can find it by doing the following at the command line:

find /opt/ros/indigo -name turtlebot_node.py

in my case it returns /opt/ros/indigo/lib/create_node/turtlebot_node.py

jfabry gravatar image jfabry  ( 2015-12-01 12:11:00 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2014-07-13 22:43:26 -0600

Seen: 1,254 times

Last updated: Nov 29 '15