Hello,
While i try to make the irobot follow the turtle, there seems no moving in the simulation.
I have created package ‘my_package’ and inside ‘my_package’, i made broadcaster python file using the code given in the exercise. when i rosrun and roslaunch, no sign of moving at all. I checked if tf topic is being published and i get this message. i cannot figure out what is wrong and where.
Hi,
Please recheck the code, just in case there is something missing. I’m executing this code an dtf is published:
#! /usr/bin/env python
import rospy
import time
import tf
from turtle_tf_3d.get_model_gazebo_pose import GazeboModel
def handle_turtle_pose(pose_msg, robot_name):
br = tf.TransformBroadcaster()
br.sendTransform((pose_msg.position.x,pose_msg.position.y,pose_msg.position.z),
(pose_msg.orientation.x,pose_msg.orientation.y,pose_msg.orientation.z,pose_msg.orientation.w),
rospy.Time.now(),
robot_name,
"/world")
def publisher_of_tf():
rospy.init_node('publisher_of_tf_node', anonymous=True)
robot_name_list = ["turtle1","turtle2"]
gazebo_model_object = GazeboModel(robot_name_list)
for robot_name in robot_name_list:
pose_now = gazebo_model_object.get_model_pose(robot_name)
# Leave time enough to be sure the Gazebo Model logs have finished
time.sleep(1)
rospy.loginfo("Ready..Starting to Publish TF data now...")
rate = rospy.Rate(5) # 5hz
while not rospy.is_shutdown():
for robot_name in robot_name_list:
pose_now = gazebo_model_object.get_model_pose(robot_name)
if not pose_now:
print "The Pose is not yet"+str(robot_name)+" available...Please try again later"
else:
handle_turtle_pose(pose_now, robot_name)
rate.sleep()
if __name__ == '__main__':
try:
publisher_of_tf()
except rospy.ROSInterruptException:
pass
Hope this helps
no. not really.
it shows me the same message and irobot doesn’t move at all.
Thanks for your suggestion though.