ROS Answers: Open Source Q&A Forum - RSS feedhttps://answers.ros.org/questions/Open source question and answer forum written in Python and DjangoenROS Answers is licensed under Creative Commons Attribution 3.0Wed, 29 Aug 2018 12:13:46 -0500Angle between two orientationshttps://answers.ros.org/question/301988/angle-between-two-orientations/There are two orientations given, as intrinsic yaw-roll-pitch (rzyx).
How to calculate the angle between the "Z" axes of them?
Converting the orientations to quaternions or to anything else is allowed.okalachevWed, 29 Aug 2018 12:13:46 -0500https://answers.ros.org/question/301988/How should RPY converted from an IMU look like?https://answers.ros.org/question/212100/how-should-rpy-converted-from-an-imu-look-like/What angles should be there?
0°-360° ?
-180° - 0° - 180° ?
Or something else?
I am for example using this code and I am getting weired results...
void cb_imu(const sensor_msgs::Imu::ConstPtr &msg)
{
double roll, pitch, yaw;
tf::Quaternion q;
tf::quaternionMsgToTF(msg->orientation, q);
tf::Matrix3x3(q).getRPY(roll, pitch, yaw);
}
ROS_INFO_STREAM("RPY: "<<roll*180.0/M_PI<<" "<<pitch*180.0/M_PI<<" "<<yaw*180.0/M_PI);
My Results of YAW show two times zero, for one half of the circle the values are negative (go up to -40°) and for the other half the same for positive values.
Regards,
Christiancyborg-x1Thu, 25 Jun 2015 04:18:30 -0500https://answers.ros.org/question/212100/How to correct the "yaw" behavior of a quadrotor when crossing the angles' limits?!?!https://answers.ros.org/question/199989/how-to-correct-the-yaw-behavior-of-a-quadrotor-when-crossing-the-angles-limits/Hi guys,
My quadrotor has a strange behavior ([video](https://www.youtube.com/watch?v=Y6Trr7d4iro)) when it turns around 180° (the returned value of atan2()). After investigating for hours I 'm pretty sure I found what the problem.
Referring to this [tutorial](http://wiki.ros.org/urdf/Tutorials/Using%20urdf%20with%20robot_state_publisher) as a reference I realized that the angle around the vertical axis (which in my quadrotor is exactly the same structure, see my code [here](http://pastebin.com/dzRp42m3) from line 34) , in the tutorial expressed as *angle* :
tf::createQuaternionMsgFromYaw(angle+M_PI/2);
is simply added by a small quantity calculated at each pass and doesn't take care of the fact that for angles bigger than 180° (or smaller than -180°) the corresponding quaternion has the same value 8or the same orientation if you prefer). In other words, the method `tf::createQuaternionMsgFromYaw` is going to calculate the correct value even if the angles is crossing those *limits*.
The nagle in my application jumps about the Z-axis from the positive sector to the negative (and viceversa) because the returned value from atan2() is outputting *right* values but with the *wrong* interpretation. As you can see, in the following output (all values are in degree for simplify):
...
Yaw: -164.3665
Yaw: -174.0903
Goal reached
Moving to the 3 waypoint
Yaw: 172.8751
Yaw: 161.7627
Yaw: 153.9304
Yaw: 148.2633
Yaw: 144.0085
...
is clear that the quadrotor must move its nose from -174° to + 172°. But instead of to take the shortest way to to that, it turns counterclockwise along the longest path.
I think that this is the normal behavior of `tf::createQuaternionMsgFromYaw()` which doesn't consider the shortest way to reach the next angle, but it output the corresponding quaternion to that value 8could I have a confirmation about that?)
**Now:** one could say: "get rid of an absolut coordinate system for your quadrotor and calculate the angle about the Z-axis as a variable, which is going to be changed by small increments every time your code runs a loop...exact like in the tutorial you mentioned!!!"
That's what I thought at the beginning, but I have the problem that all the position and attitude controller for quadrotor are using a fixed coordinate system for their calculation:
![image description](/upfiles/1419358451960307.png)
Resume:
I want to correct the behavior of my quadrotor about the Z-axis.
To do that I could:
- Rewrite all my controllers for attitude and position to use a body coordinate system and treating the yaw a variable which increments by small changes in orientation without taking care about the limits I said above -> I ve really no idea how to rewrite my code to use such a *variable change* and I think it would lead to new problems;
- Use two "yaws": one absolut for the controllers and the other one "locally" which is going to be passed to the method `tf::createQuaternionMsgFromYaw()`. As above...I ve no idea how to implement it in my code;
What would you do guys? Could you me point to the right direction or give my the most used solution?
PS: Even mapping the output of atan2() to 0-360° doesn't change anything. It *moves* simply the problem between 0 and 360°
I hope my question is clear. If not tell me please and I'll update the question.
Merry Christmas !!
RegardsAndromedaTue, 23 Dec 2014 12:24:52 -0600https://answers.ros.org/question/199989/How to interpate the IMU raw data?https://answers.ros.org/question/69067/how-to-interpate-the-imu-raw-data/Hello
I wont to check my IMU raw data. So I wont to find out the range of the orientation yaw and the pitch angle. So when I look at the IMU data I have like these:
orientation:
x: 0.00726589653641
y: 0.0109150372446
z: 0.452039599419
w: 0.891901493073
orientation_covariance: [0.017453292519943295, 0.0, 0.0, 0.0, 0.017453292519943295, 0.0, 0.0, 0.0, 0.15707963267948966]
angular_velocity:
x: 0.0101893069223
y: -0.0161255002022
z: 0.0226749740541
angular_velocity_covariance: [0.0004363323129985824, 0.0, 0.0, 0.0, 0.0004363323129985824, 0.0, 0.0, 0.0, 0.0004363323129985824]
linear_acceleration:
x: -0.535392701626
y: 0.325684845448
z: 9.78638076782
linear_acceleration_covariance: [0.00040000000000000002, 0.0, 0.0, 0.0, 0.00040000000000000002, 0.0, 0.0, 0.0, 0.00040000000000000002]
So what is the pitch and yaw angle??
Any help?
AstronautThu, 25 Jul 2013 16:04:54 -0500https://answers.ros.org/question/69067/