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 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:

  1. Generate a quaternion object
  2. Transform euler angles into the quaternion
  3. Write coordinates as well as the quaternion items into the Pose message
  4. Set and plan the goal

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.

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:

  1. Generate a quaternion object
  2. Transform euler angles into the quaternion
  3. Write coordinates as well as the quaternion items into the Pose message
  4. Set and plan the goal

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.

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:

  1. Generate a quaternion object
  2. Transform euler angles into the quaternion
  3. Write coordinates as well as the quaternion items into the Pose message
  4. Set and plan the goal

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.