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

the argument scale of quoternion function "setRPY"

asked 2016-09-10 02:42:06 -0500

sasadasd gravatar image

updated 2016-09-10 02:44:54 -0500

Hi

I want to use "setRPY"function and the arguments are the gyro sensor values. I want to convert the angle to quotarnion by this function.

then , I have something I want to confirm. Should I set the scale of the sensor value (angle) to [-2π , 2π]? I don't know the scale of the function's argument . please let me know the correct scale of the function.

My code is the following :

gyro_msg.vector.x = data.gxPI()/180; gyro_msg.vector.y = data.gyPI()/180; gyro_msg.vector.z = data.gz*PI()/180; gyro_pub.publish(gyro_msg);

sensor_msgs::Imu imu_msg; dt = (float) ( endTime - startTime ) * 0.000001; // μsec→sec

// integration

data.theta += dt * data.gz*PI()/180;

// range constraint

if(data.theta>=2PI()) data.theta -=2PI(); else if(data.theta<=2PI()) data.theta +=2PI();

imu_msg.header.stamp = ros::Time::now(); imu_msg.header.frame_id = "/base_link"; tf::Quaternion q; q.setRPY(0.0, 0.0, data.theta);

thank you

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2016-09-10 03:50:52 -0500

Shay gravatar image

According to my experience, I think the Roll Pitch Yaw range is (-π , π].

edit flag offensive delete link more

Comments

Thank you so much.

sasadasd gravatar image sasadasd  ( 2016-09-10 11:04:44 -0500 )edit

@sasadasd: if you feel that @Shay has answered your question, please mark your question as answered by ticking the checkmark to the left of this answer. Thanks.

gvdhoorn gravatar image gvdhoorn  ( 2016-09-11 06:36:30 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2016-09-10 02:42:06 -0500

Seen: 293 times

Last updated: Sep 10 '16