Robotics StackExchange | Archived questions

Problem tf from base_link to laser in python

Hi,

I have a p3dx with ROS indigo runing on ubuntu 14.14 and a LMS100 Laser.

I want to transform data from /base_link topic to /laser using a python script

The program works without error, but the TF is not created

> import roslib import rospy import tf
> 
> rospy.init_node('pioneer_tf_broadcast')
> 
> rate = rospy.Rate(20.0)
> 
> laserBroadcaster =
> tf.TransformBroadcaster()
> 
> while not rospy.shutdown():
>     laserBroadcaster.sendTransform(   (0, 0,
> 0), 
>                                       tf.transformations.quaternion_from_euler(0.13,
> 0.0, 0.39), 
>                                       rospy.Time.now(),
>                                       "/laser",
>                                       "/base_link" 
>                                       )
>     rate.sleep()

Here what I get when I used roswtf :

> Beginning tests of your ROS graph.
> These may take awhile... analyzing
> graph... ... done analyzing graph
> running graph rules... ... done
> running graph rules running tf checks,
> this will take a second... ... tf
> checks complete
> 
> Online checks summary:
> 
> Found 1 warning(s). Warnings are
> things that may be just fine, but are
> sometimes at fault
> 
> WARNING The following node
> subscriptions are unconnected:  *
> /rqt_gui_py_node_4057:    * /tf_static
> * /RosAria:    * /RosAria/cmd_vel

also here the frames obtained by rqt :

image description

Asked by Horse-man on 2016-01-19 15:45:10 UTC

Comments

I cannot help you with the problem, but for what you are trying to do, you could actually use the static_transform_publisher. Check out the wiki page here

Asked by mgruhler on 2016-01-20 03:33:58 UTC

rospy.shutdown -> rospy.is_shutdown. Shut everything down and run the laser broadcaster by itself then do rosrun tf tf_echo laser base_link. Also make sure you didn't name that file something like tf.py, which will cause silent problems.

Asked by lucasw on 2016-01-20 13:41:48 UTC

ok, so I tried this command and it's worked fine:

rosrun tf static_transform_publisher 0 0 0 0.13 0 0.39 base_link laser 100

The second solution doesn't work, it throws an exception :

Exception thrown: "laser" passed to lookupTransform argument target_frame does not exist

thank you guys

Asked by Horse-man on 2016-01-21 09:32:12 UTC

It wasn't a solution, just debug steps to help you find what is wrong with your script- I don't think the code ever gets to the sendTransform, it may not even be making it past init_node().

Asked by lucasw on 2016-01-21 10:49:00 UTC

I put an echo message in the loop and it was printed during the execution. I don't understand why the code is not sending the Transform

Asked by Horse-man on 2016-01-22 18:41:02 UTC

Answers