-
Notifications
You must be signed in to change notification settings - Fork 4
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
Redefining Axis for different orientation #2
Comments
Hello, You will probably have to play with the lines here (change the 0,1,2 indices to something like 1,2,0 and possibly the signs, or maybe another combination...) : razor-9dof-ahrs/Arduino/Razor_AHRS/Sensors.ino Lines 170 to 181 in 5c179de
You might also be interested in checking what is said in these posts : There might be a risk that the acceleros and gyros make some kind of internal assumptions such as "the device is likely to be horizontal at startup" or "the device is likely to be horizontal most of the time", but maybe not since it is supposed to be a general purpose sensor... |
Great advice. Thanks, lebarsfa. Changing the indices to match the new orientation actually seemed to work quite well. I am seeing the results I expected. I have one last question. If I want to change the range of the Euler angles from the standard set in the original code (i.e. yaw = -180 to +180, pitch = -90 to +90, and roll = -180 to 180), do you know what part of the code must be modified? Thanks again! |
For that, I would try to change this (if you use the default output options) : razor-9dof-ahrs/Arduino/Razor_AHRS/Output.ino Lines 17 to 19 in 5c179de
For the other output options there is also : razor-9dof-ahrs/Arduino/Razor_AHRS/Output.ino Lines 9 to 11 in 5c179de
razor-9dof-ahrs/Arduino/Razor_AHRS/Output.ino Lines 93 to 95 in 5c179de
|
Hi Lebarsfa,
I have a question concerning the orientation of the chip. I am using the razor-9dof-ahrs Arduino sketches with the 9DoF Razor IMU M0 from SparkFun.
If I want to operate the Razor in a different orientation compared to what is defined in the original code, what parts of the code would need to be changed?
Let me clarify. For example, say the chip is flat on surface surface, sparkfun logo upright, facing forward (see below)
Here, using the Arduino sketch, yaw would be a rotation around the Z-axis, pitch would be a rotation around the Y-axis, and roll would be a rotation around the X-axis, as expected. As such, the Euler angles expected would be yaw=some value, pitch~=0, and roll~=0. This is fine for that orientation and values I get make sense, however, for my application I wish to operate the Razor in an upright position (see below)
In this case, the axis definitions change. X now points to the sky, Y points behind and Z point right. In this position, yaw would be a rotation around the X-axis, pitch would be a rotation around the Z-axis, and roll would be a rotation around the Y-axis. This differs from the original code and I am wondering what modifications are needed to adjust for this. I expect Euler angles again to be yaw=some value, pitch~=0, and roll~=0 in the new orientation.
Does this require redefining the direction of gravity in reference to the chip? If so how do I go about doing that?
Please let me know what you think. Thanks.
The text was updated successfully, but these errors were encountered: