-
Notifications
You must be signed in to change notification settings - Fork 986
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
setpoint_position plugin sets yaw incorrectly #358
Comments
I wrote tests and may confirm that q->rpy results is strange.
|
Ok I'll check it. |
@madsciencetist i hope that your data in wxyz format. Also please tell it is before transform_frame_enu_ned? |
Well probably we are getting problems with singularities or something. I'm still trying to figure out what does this do? |
Look stack overflow and eigen doc. Because real order of RPY->Q is YPR i assumed that right is 2 1 0. |
@vooon My printout was (x,y,z,w) after transform_frame_enu_ned in send_position_target |
Replace UAS::getYaw() with UAS::quaternion_get_yaw().
@madsciencetist Could you please test master. I think that i fixed, unit-tests now are passed. |
* master: (27 commits) lib #358: cleanup. lib #358: found correct getYaw(). Test for each degrees in -180..180. test #358: test more different angles. Compare rotation result. lib #358: try to implement algo from wikipedia. lib #358: still failing. add recursive test for range -Pi..+Pi lib #358: try solve issue using older eulerAngles() lib #358: remove to_rpy test test fix #359: split out quaternion tests. lib #359: move quaternion utils. global_position: move relative_alt and compass_heading init back add nav_msgs to dependencies so to make Travis happy global_position: update pose and twist to odom msg test #358: add tests for negative values and quaternion_to_rpy tf2 compatibility check sctipts: fix gps topic path lib: fix input validation in UAS::orientation_from_str() package: YCM: add mavlink dialect flag package: YCM PEP8 test: add case for num str->sensor orientation package: add notes about test_mavros test: add link to APM sitl video ...
@vooon Have you still that Wiki algorithm in? I wouldn't be so sure if that doesn't have corner cases (numerically). The mavlink library contains a unit-tested conversion already, make sure to reuse it whenever possible: |
I'm kinda worried that the current test implemented is forcing the function to be "right" instead of getting the right euler angles. Corner cases were always a problem of euler angles and that's why probably Eigen developers changed the normalized range values that |
@LorenzMeier for now i used Normalization in test_quaternion_utils.cpp L103 auto tq1 = q1 * test_orientation * q1.inverse();
auto tq2 = q2 * test_orientation * q2.inverse();
EXPECT_QUATERNION(tq1, tq2, epsilon); |
Using of mavlink's helpers little problematic because of mixing single and double precision. |
@vooon Tested master, confirmed that angles around the level circle are now mapped properly to [-pi,pi]. Thanks! |
Thanks. |
When I use the setpoint_position plugin to command a pose, the orientation does not behave as expected. To test, I am using the "2D Nav Goal" button in rviz with /move_base_simple/goal mapped to /mavros/setpoint_position/local. When I command a North heading, a quaternion of (0,0,0,1) is sent, which mavros converts to a yaw of zero, as expected. As I increase the commanded heading clockwise to South, the quaternion approaches (-1,0,0,0), which converts to a yaw of Pi, as expected. Any further though, and the angle goes to zero. Observe:
[/mavros]: q = (-0.999456, 0.000000, -0.000000, -0.032994) -> yaw = 3.075592
[/mavros]: q = (-0.999550, 0.000000, -0.000000, 0.029986) -> yaw = 0.059980
Thus, yaw setpoints can only be commanded in the [0,pi] range, as the other half of the circle will also map to [0,pi]. The problem must lie in UAS::quaternion_to_rpy() in uas_frame_conversions.cpp, but I'm not sure what the right answer is.
The text was updated successfully, but these errors were encountered: