Ask Your Question

Transforms orphaned frame issue

asked 2019-03-01 15:24:19 -0500

sisko gravatar image

updated 2019-03-01 15:26:06 -0500

I am working on a ROS simulation in which I am trying to use a UR5 robot to actively tract, i:e follow, the movements of a turtlebot3.

My problem is when I look at the output from rqt_tf_tree I can see the outout of both robots but the turtlebot is NOT connected to the world frame, as shown in the image below. I'm new to transforms so please correct me if I'm wrong, I need both robots to be connected to a common parent frame inorder to carry out transforms which will enable my desired tracking process.

image description

To deal with this issue, I experimented with creating a fixed frame with the same name as the first frame representing the turtlebot i:e odom. As it turned out, my guess worked out and the frames representing the turtlebot was connected to the world frame. The fixed frame code is contained in the init function below:

#!/usr/bin/env python
import sys
import copy
import rospy
import moveit_commander
import moveit_msgs.msg
from geometry_msgs.msg import Pose
from gazebo_msgs.msg import ModelStates
import tf

class TrackBot():

    def __init__(self, moveit_commander):
        rospy.loginfo("======== init responding")

        self.moveit_commander = moveit_commander
        self.manipulator = moveit_commander.MoveGroupCommander('ur5_bot')

        br = tf.TransformBroadcaster()
        while not rospy.is_shutdown():
            br.sendTransform((0.0, 2.0, 0.0),
                                (0.0, 0.0, 0.0, 1.0),
            # break


    def test(self):
        rospy.loginfo("======== test responding")

        for x in range(10):

            print " ================ Executing Loop-"+str(x)
            pose = self.manipulator.get_random_pose()

            plan = self.manipulator.plan()

            # # manipulator.go(wait=True)
        rospy.loginfo("======== test ending")

    def main(self):
        robot = moveit_commander.RobotCommander()

            trackbot = TrackBot(moveit_commander)
        except rospy.ROSInterruptException:

if __name__ == '__main__':
    rospy.init_node('move_group_python_interface_tutorial', anonymous=False)


My problems begin after the while not rospy.is_shutdown(): section because it blocks the self.test() , and all other function calls. I understand that it's a while loop and by nature, well, it loops. I included a break statement but when I do that, the turtlebot frames are then NOT attached to the world frame which puts me back at square one.

Can anyone offer a different approach to attaching the turtlebot and world frames OR offer an insight to what I'm doing wrong or missing with my current solution?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-03-01 15:38:37 -0500

gvdhoorn gravatar image

Can anyone offer a different approach to attaching the turtlebot and world frames

Use a static_transform_publisher?

edit flag offensive delete link more


I can't believe how ridiculously simply that was.

Thank you.

sisko gravatar image sisko  ( 2019-03-01 16:16:11 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2019-03-01 15:24:19 -0500

Seen: 50 times

Last updated: Mar 01 '19