ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I struggled a lot getting this to work with tf2, so I thought i would share how I did, in case it would help someone else. I was using a UR3 and moveit to control the robot. What I ended up doing was transforming to the end effector frame, changing position in and then transforming back to the base frame. Then calling to move the robot afterwards.

tf2_ros::Buffer tfBuffer;
tf2_ros::TransformListener tfListener(tfBuffer);
geometry_msgs::PoseStamped posein, poseout;

posein.header.frame_id = move_group.getCurrentPose().header.frame_id;
posein.pose = move_group.getCurrentPose().pose;

tfBuffer.transform(posein, poseout, move_group.getEndEffectorLink());
poseout.pose.position.y -= 0.05; 
tfBuffer.transform(poseout, posein, move_group.getCurrentPose().header.frame_id);
move_group.setPoseTarget(posein);
move_group.move();