No transform between turtlebot wheel links and base link. Exercise 3.1

Hi all,

I’m doing exercise 3.1 right now, but ran into an issue with the robot. I’m able to start up cmd_vel and link the node to the topic. However, I’m unable to get the robot moving at all. I found that the information of setting move.linear.x = 1.0 and move.angular.z = 1.0 is showing when I echo the /cmd_vel topic. Further digging into rviz showed that when I added a robot model description, there is no transform between the ‘wheel_left_link’ and ‘base_link’. The same applies to ‘wheel_right_link’. What I’m seeing is down below:

If this is the issue, would I need to go into the URDF and fix that? If so, what should I add to the file? I’m not well versed in robot modeling yet.

Any help would be appreciated!

Hi @jgermann2017 , i am not sure about the solution, but could you share the code and also the output in Rviz of the cmd: rosrun rqt_tf_tree rqt_tf_tree so that i can have more info to work with.

Also, even though its not part of the course, did you happen to modify the URDF files in any way)

(Just in case, try moving to another unit and coming back to the unit to self correct any internal errors.)

Hi @Joseph1001. I did not modify the urdf files, but I did find what was causing it the rviz error.

It seems that when the simulation was launched, the robot_state_publisher and joint_state_publisher packages were not running. I’m assuming this caused the links of the robot to not be read from the URDF file correctly. Thus, the best way to fix this was to include them in my launch file. This is what I included:

Below is the Rviz error gone after this inclusion:

After that, the robot started moving properly. Thank you for the quick response though!

Hi @jgermann2017 , glad you were able to figure it out own your own, but can you confirm that you are working on the ROS Basics in 5 days course . i am asking because i could not find this exercise in ROS basics in 5 days under exercise 3,1. Are you working on the ROS TF course instead?

Yes. I was working on the Python version of ROS Basics in 5 days. It was the final exercise in section 3, “Understanding ROS Topics - Publishers”.

Here’s a picture of the exercise:

Hi @jgermann2017 ,
Thanks for sharing. I was intrigued by this because setting robot_state_publisher and joint_state_publishers are way out of the scope of the course. This exercise should have been pretty straight forward with the launch file as follows:

<launch>
    <node pkg="exercise_31" type="move_robot.py" name="move_robot_node" output="screen" />
</launch>

and the code as follows:

#! /usr/bin/env python

import rospy
from geometry_msgs.msg import Twist

rospy.init_node('move_robot_node')
pub = rospy.Publisher('/cmd_vel', Twist, queue_size=1)
rate = rospy.Rate(2)
move = Twist()
move.linear.x = 0.5 #Move the robot with a linear velocity in the x axis
move.angular.z = 0.5 #Move the with an angular velocity in the z axis

while not rospy.is_shutdown(): 
  pub.publish(move)
  rate.sleep()

So i am curious about why addition of robot_state_publisher and Joint_state_publisher was required to give a correct answer, when they worked without them for me. (i just tested the program on my system).

Can you try again with the code i shared and see if this works? Also could you share the python code you used.

Hmm. I did try using the solution code as well, but that still caused an error. Perhaps it’s something with my local system? Below is the python code I used:

#! /usr/bin/env python

import rospy
from std_msgs.msg import Int32
from geometry_msgs.msg import Twist

rospy.init_node('move_robot_node') # Start node called 'move_robot_node'

# Create a Publisher object, that will publish on the /cmd_vel topic and 
# publish Twist messages to this topic.
pub = rospy.Publisher('/cmd_vel', Twist, queue_size=1)

rate = rospy.Rate(2) # Set a publish rate of 2 Hz
move = Twist() # Create a var of type Twist
move.linear.x = 1.0
move.angular.z = 1.0

while not rospy.is_shutdown(): # Create a loop that will go until someone stops the program execution
    
    pub.publish(move)
    
    rate.sleep()

And here is the launch file:

<launch>
    <node pkg="my_examples_pkg" type="move_robot.py" name="move_robot_node" output="screen" />
    <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher"/> <!-- start robot state publisher --> 
    <node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher" output="screen"/>
</launch>

Hi @jgermann2017, the python code looks good.

Can you tell me if you are running ROS on your PC or through a web browser.

I’m running it through the Construct’s web-shell.

Hi @jgermann2017 ,i ran the code you shared as it is and got the rght results.

I am not able to figure it out, let me share it with @bayodesegun ,@albertoezquerro and @duckfrost2 since they are more experienced in this.

Also, i don’t think looking up rviz output of TF was part of the exercise. The exercise was only about making the robot in the simulator move using topic, so perhaps there was something running in the background that took care of everything else, requiring us to only figure the topic part out, since we are just starting out.

Just in case, try compiling using catkin_make in the catkin_ws directory, and source after.This usuallly solves most of the problems for me.

Understood. I only looked into rviz since I have a fair amount of experience with ROS before starting the course. I figured I’d try to debug what was wrong with it. You might be right about catkin_make. I’ve mostly been using catkin build for compilation so I’ll let you know if that works.

1 Like