ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
![]() | 1 | initial version |
I found the mistake myself.
Seems like i lacked basic understanding of the geometry message. But for other beginners like me, heres the solution:
Given values of the goal position are cx,cy,cz coordinates as well as orientations rotx, roty, rotz. The move group needs the message type "geometry_msgs::Pose" which again needs the orientation as a quaternion instead of euler angles.
So the setps are the following:
The code looks like this:
//....
#include <tf/transform_datatypes.h>
//....
tf::Quaternion q;
q.setEulerZYX(rotz,roty,rotx);
geometry_msgs::Pose target_pose1;
target_pose1.position.x = cx;
target_pose1.position.y = cy;
target_pose1.position.z = cz;
target_pose1.orientation.x = q.x();
target_pose1.orientation.y = q.y();
target_pose1.orientation.z = q.z();
target_pose1.orientation.w = q.w();
move_group.setPoseTarget(target_pose1);
moveit::planning_interface::MoveGroupInterface::Plan my_plan;
Thanks to anyone, who took his/her time to read this anyway.
![]() | 2 | No.2 Revision |
I found the mistake myself.
Seems like i lacked basic understanding of the geometry message. But for other beginners like me, heres the solution:
Given values of the goal position are cx,cy,cz coordinates as well as orientations rotx, roty, rotz. The move group needs the message type "geometry_msgs::Pose" which again needs the orientation as a quaternion instead of euler angles.
So the setps are the following:
The code looks like this:
//....
#include <tf/transform_datatypes.h>
//....
tf::Quaternion q;
q.setEulerZYX(rotz,roty,rotx);
geometry_msgs::Pose target_pose1;
target_pose1.position.x = cx;
target_pose1.position.y = cy;
target_pose1.position.z = cz;
target_pose1.orientation.x = q.x();
target_pose1.orientation.y = q.y();
target_pose1.orientation.z = q.z();
target_pose1.orientation.w = q.w();
move_group.setPoseTarget(target_pose1);
moveit::planning_interface::MoveGroupInterface::Plan my_plan;
Thanks to anyone, who took his/her time to read this anyway.
![]() | 3 | No.3 Revision |
I found the mistake myself.
Seems like i lacked basic understanding of the geometry message. But for other beginners like me, heres the solution:
Given values of the goal position are cx,cy,cz coordinates as well as orientations rotx, roty, rotz. The move group needs the message type "geometry_msgs::Pose" which again needs the orientation as a quaternion instead of euler angles.
So the setps steps are the following:
The code looks like this:
//....
#include <tf/transform_datatypes.h>
//....
tf::Quaternion q;
q.setEulerZYX(rotz,roty,rotx);
geometry_msgs::Pose target_pose1;
target_pose1.position.x = cx;
target_pose1.position.y = cy;
target_pose1.position.z = cz;
target_pose1.orientation.x = q.x();
target_pose1.orientation.y = q.y();
target_pose1.orientation.z = q.z();
target_pose1.orientation.w = q.w();
move_group.setPoseTarget(target_pose1);
moveit::planning_interface::MoveGroupInterface::Plan my_plan;
Thanks to anyone, who took his/her time to read this anyway.