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

How to add parent frame map? Map not exists.

asked 2018-09-02 02:12:42 -0500

Stepan Kostusiev gravatar image

updated 2018-09-05 03:34:48 -0500

Map frame never exist before. I broadcast map -> odom when init node. When i use frameExists, map frame not exists. But in rqt_tf_tree it exists and connected to odom. Where can be problem?

    self.tf_broadcaster = tf.TransformBroadcaster()
    self.tf_listener = tf.TransformListener()

    self.tf_broadcaster.sendTransform((5.0, 3.0, 0.0),
        tf.transformations.quaternion_from_euler(0.0, 0.0, 0.0),
        rospy.Time.now(),
        "odom",
        "map")

    #This condition never True. 
    if self.tf_listener.frameExists("odom") and self.tf_listener.frameExists("map"):
        rospy.loginfo("transform exist!")
        t = self.tf_listener.getLatestCommonTime("odom", "map")
        position, quaternion = self.tf_listener.lookupTransform("odom", "map", t)
        print position, quaternion
        print("!!!!!!!!!")

Edit 1:

Main goal of my node to improve robot localization odometry based on imu and encoders. I calculated new position of robot in map frame. And want somehow to transform odometry frame respect to map frame.

My actual global localization node, where i want to use tf.

Bag file in which I test my node.

Output of rqt_tf_tree. image description

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-09-02 20:38:56 -0500

fvd gravatar image

You might be broadcasting before your listener is fully initialized. Have you tried adding waits?

That said, this is a strange usage pattern. If you publish the frames continuously from other nodes, do you have the same problem?

edit flag offensive delete link more

Comments

Thank you for answer. I try to add waits and broadcast this transform from other node, but it is no effect. I add my node code and bag file. Maybe it will more clear understand problem.

Stepan Kostusiev gravatar image Stepan Kostusiev  ( 2018-09-05 03:15:36 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2018-09-02 02:12:42 -0500

Seen: 387 times

Last updated: Sep 05 '18