Not able to find TransformListener.frameExists('marker')
I want the robot arm to move by detecting the Aruco marker using camera on base. I am using the code below to get translation and rotation between base and the marker, however the condition t.frameExists('marker') is coming false and hence not going into the if loop. Any help would be appreciated. Link to tf graph https://drive.google.com/file/d/1PRsb...
t = TransformListener()
a = True
if t.frameExists('link_base') and t.frameExists('marker'):
# lookupTransform(target_frame, source_frame, time) -> (position, quaternion)
(translation,rotation) = t.lookupTransform("marker","link_base",rospy.Time.now())
below is the frame list
The current list of frames is:
Frame ground_plane_box exists with parent world.
Frame link_eef exists with parent link6.
Frame link6 exists with parent link5.
Frame link_base exists with parent world.
Frame camera_color_optical_frame exists with parent link_base.
Frame marker exists with parent camera_color_optical_frame.
Frame link1 exists with parent link_base.
Frame link2 exists with parent link1.
Frame link3 exists with parent link2.
Frame link4 exists with parent link3.
Frame link5 exists with parent link4.
when I am doing
rosrun tf tf_echo marker camera_color_optical_frame
At time 1666896640.814
- Translation: [-0.145, -0.319, 1.223]
- Rotation: in Quaternion [0.979, 0.020, -0.026, -0.203]
in RPY (radian) [-2.731, 0.043, 0.050]
in RPY (degree) [-156.483, 2.442, 2.850]
When I am using the following code to just get into the if loop
if t.frameExists('link_base') and t.frameExists('camera_color_optical_frame'):
# lookupTransform(target_frame, source_frame, time) -> (position, quaternion)
(translation,rotation) = t.lookupTransform("marker","link_base",rospy.Time.now())
Getting the following error
Traceback (most recent call last): File "/opt/ros/noetic/lib/python3/dist-packages/rospy/topics.py", line 750, in _invoke_callback cb(msg) File "/home/akumar/catkin_ws/src/xarm_ros/move_xarm/scripts/subscriber.py", line 68, in callback (translation,rotation) = t.lookupTransform("marker","link_base",rospy.Time.now()) File "/opt/ros/noetic/lib/python3/dist-packages/tf/listener.py", line 104, in lookupTransform msg = self._buffer.lookup_transform(strip_leading_slash(target_frame), strip_leading_slash(source_frame), time) File "/opt/ros/noetic/lib/python3/dist-packages/tf2_ros/buffer.py", line 86, in lookup_transform return self.lookup_transform_core(target_frame, source_frame, time) tf2.LookupException: "marker" passed to lookupTransform argument target_frame does not exist.