How to use tf.transformPose of tf mpdule?
Hello, I'm using ROS melodic of Ubuntu 18.04.
I recently heard that tf
module has the special class function which transforms a specific pose into the pose of another specific frame.
I tried calling tf.TransformerROS.transformPose
, but I've just gotten only this error:
"/sensor_frame" passed to lookupTransform argument target_frame does not exist
.
Of course, I double-checked that /sensor_frame
was practically running.
(I tried
$ rosrun tf tf_echo
and also checked it on rviz
tool.)
Below is my code,
import rospy
import tf
from geometry_msgs.msg import PoseStamped
def talker():
pub = rospy.Publisher('/that', PoseStamped, queue_size = 10)
rate = rospy.Rate(10)
# goaler = tf.TransformerROS()
goaler = tf.TransformListener()
while not rospy.is_shutdown():
goal = PoseStamped()
goal.pose.position.x = 5.0
goal.pose.position.y = 5.0
# ret = goaler.transformPose("lidar_sensor_link", goal)
ret = goaler.transformPose("/sonar2_link", goal)
pub.publish(ret)
rate.sleep()
if __name__ == '__main__':
rospy.init_node('pracd')
try:
talker()
except rospy.ROSInterruptException:
pass
(Just so you know, I referred to here)
I'm not familiar with tf
, so I 'm suffered from fixing..
What should I do to coordinate transformation works?
Thanks inadvance :)