Problem tf from base_link to laser in python

asked 2016-01-19 14:45:10 -0500

Horse-man gravatar image

updated 2016-01-19 16:23:00 -0500

lucasw gravatar image

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

edit retag flag offensive close merge delete

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

mgruhler gravatar image mgruhler  ( 2016-01-20 02:33:58 -0500 )edit

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.

lucasw gravatar image lucasw  ( 2016-01-20 12:41:48 -0500 )edit

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

Horse-man gravatar image Horse-man  ( 2016-01-21 08:32:12 -0500 )edit

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().

lucasw gravatar image lucasw  ( 2016-01-21 09:49:00 -0500 )edit

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

Horse-man gravatar image Horse-man  ( 2016-01-22 17:41:02 -0500 )edit