how to make end effector look at object?
So I wasted a lot of time on this and can't seem to solve it:
I have a UR10 robot which I want to move towards/approach an object. I use TF/TF2 to get the position/orientation of said object and give it to moveit with /compute_ik and joint spaces. Moving to that point given by TF isn't a problem. Problematic is though, I have no idea how to make the end effector LOOK at the object. Also I want the robot to approach the point rather than go into it (since its supposed to be an object in real life on a table). I don't know what kind of math to do here. Also, I am a complete beginner on ROS and didnt do math in a while. Sorry for the dumb question.
What I tried:
rotation = self.move_group.get_current_rpy()
quat_ee = tf.transformations.quaternion_from_euler(rotation[0], rotation[1], rotation[2])
quat_object = tf.transformations.quaternion_from_euler(self.rotation_object[0], self.rotation_object[1], self.rotation_object[2])
self.new_quat = quaternion_multiply(quat_ee, quat_object)
then I pass the new_quat to the orientation of the robot:
self.pose_goal.pose.orientation = geometry_msgs.msg.Quaternion(*self.new_quat)
On an honest note, I have absolutely 0 clue if that makes even sense.
I use Python on ROS Melodic.
I would love to jump ships to C++ but Uni is kinda tough rn. If anyone has some clue I would appreciate it a lot if you could help me in Python!
to move the robot to a point in front of the object you can do object.position.x-offset & object.position.y-offset. orientation stays the same. Not sure if this answers your question, otherwise please clearify the question.
Problematic with that is, that the orientation is from before the robot moves to the object, which means the end orientation would look the same as as initially planned but offset by x y and thus not looking at the object anymore. fvd did help me a lot with his answer! But many thanks tho