getCurrentPose (C++)/ get_current_pose (Python) reports the pose of the end effector link. The frame it is referenced to can be read from the header of PoseStamped.
For looking up arbitrary links you could just use tfs. If it's a link on your robots kinematic chain you could also reset the end effector link before getting the pose.
Originally posted by pcoenen with karma: 249 on 2023-04-21
This answer was ACCEPTED on the original site
Post score: 0
Original comments
Comment by TapleFlib on 2023-04-22:
I tried to print the output of PointStamped with print(geometry_msgs.msg.PoseStamped())
and got the following output :
position:
x: 2.891971438201711e-07
y: -0.24444999999999026
z: 0.8917000428590904
orientation:
x: 0.7071065501076503
y: 1.1553940595954334e-07
z: 1.1553948151418447e-07
w: 0.7071070122653501
header:
seq: 0
stamp:
secs: 0
nsecs: 0
frame_id: ''
pose:
position:
x: 0.0
y: 0.0
z: 0.0
orientation:
x: 0.0
y: 0.0
z: 0.0
w: 0.0
why is it blank below the header?
Comment by TapleFlib on 2023-04-22:
and do you know how to set which link I want to control with set pose target ? I'm quite new to ROS and moveit sorry.
Comment by TapleFlib on 2023-04-22:
is these position and orientation tool0's position or is it already being transformed relative to the base? should I publish a tf between tool0 to base? how?
(sorry to write it as answer to be able to send image, I'll change it once I got the real answer)
Comment by pcoenen on 2023-04-24:
Did you print the return value of get_current_pose (which is of type PoseStamped) or print(geometry_msgs.msg.PoseStamped())
, because the zeroed position looks like you did the latter.
- and do you know how to set which link
I want to control with set pose
target ?
If you look through the move_group_commander code on github (linked above) you will also find a set_end_effector_link function.
- is these position and orientation
tool0's position or is it already
being transformed relative to the
base?
I believe the pose is relative to the global frame set in rviz. The tf from base to tool0 should already exist. You can use rosrun rqt_tf_tree rqt_tf_tree
to check which frames are available.
Comment by TapleFlib on 2023-04-24:
Got it, thankyou so much ! this is enough and really helpful !