Ask Your Question
0

quaternion_actionlib

asked 2013-06-04 02:46:15 -0500

acp gravatar image

updated 2013-06-04 16:31:55 -0500

joq gravatar image

Hi every body.

I am trying to run a small application using actionlib. I convert in a callback function, degrees to quaternions, as it is shown in the following piece of code:

double th=D2R*(atan2( msg.pose.pose.orientation.y, msg.pose.pose.orientation.y));
geometry_msgs::Quaternion gth = tf::createQuaternionMsgFromYaw(th);

Then, I am trying to assign that quaternion as it follows:

move_base_msgs::MoveBaseGoal goal;
goal.target_pose.pose.orientation.w =gth;

Then I get the error:

cannot convert ‘geometry_msgs::Quaternion’ to ‘geometry_msgs::Quaternion_<std::allocator<void> >::_w_type {aka double}’ in assignment

Can anybody give me a clue, in advance thank you

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2013-06-04 16:39:45 -0500

joq gravatar image

Your yaw calculation looks wrong. If you already have a pose, the yaw in radians should already be available in msg.pose.pose.orientation.z.

The goal assignment is in error because you are trying to assign a quaternion to the w component of another quaternion. Maybe you mean this:

goal.target_pose.pose.orientation = gth;
edit flag offensive delete link more

Comments

Thank you very much for your answer, I realised that yesterday, it is now working :)

acp gravatar imageacp ( 2013-06-04 21:14:38 -0500 )edit

@acp please accept the answer so others don't spend time trying to help you solve this problem.

tfoote gravatar imagetfoote ( 2013-06-17 13:02:59 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-06-04 02:46:15 -0500

Seen: 126 times

Last updated: Jun 04 '13