diff options
| author | Abel Tim <abel@abel-ms7c95.home> | 2025-03-17 21:43:59 +0100 |
|---|---|---|
| committer | Abel Tim <abel@abel-ms7c95.home> | 2025-03-17 21:43:59 +0100 |
| commit | 9c8f7e2f1101b4bb8e0c5459e14af253f150c8b7 (patch) | |
| tree | f6baef3949190537fb37f3ac21b965f83c8f7407 /CODE/debug/IMU_comp/minimu-9-ahrs-arduino-master/MinIMU9AHRS/Compass.ino | |
| parent | bf474ec55fce14f778efa1c1e8118d69a093bf07 (diff) | |
| download | robotica-9c8f7e2f1101b4bb8e0c5459e14af253f150c8b7.tar.gz robotica-9c8f7e2f1101b4bb8e0c5459e14af253f150c8b7.zip | |
code
Diffstat (limited to 'CODE/debug/IMU_comp/minimu-9-ahrs-arduino-master/MinIMU9AHRS/Compass.ino')
| -rw-r--r-- | CODE/debug/IMU_comp/minimu-9-ahrs-arduino-master/MinIMU9AHRS/Compass.ino | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/CODE/debug/IMU_comp/minimu-9-ahrs-arduino-master/MinIMU9AHRS/Compass.ino b/CODE/debug/IMU_comp/minimu-9-ahrs-arduino-master/MinIMU9AHRS/Compass.ino deleted file mode 100644 index 767227b..0000000 --- a/CODE/debug/IMU_comp/minimu-9-ahrs-arduino-master/MinIMU9AHRS/Compass.ino +++ /dev/null @@ -1,56 +0,0 @@ -/* - -MinIMU-9-Arduino-AHRS -Pololu MinIMU-9 + Arduino AHRS (Attitude and Heading Reference System) - -Copyright (c) 2011 Pololu Corporation. -http://www.pololu.com/ - -MinIMU-9-Arduino-AHRS is based on sf9domahrs by Doug Weibel and Jose Julio: -http://code.google.com/p/sf9domahrs/ - -sf9domahrs is based on ArduIMU v1.5 by Jordi Munoz and William Premerlani, Jose -Julio and Doug Weibel: -http://code.google.com/p/ardu-imu/ - -MinIMU-9-Arduino-AHRS is free software: you can redistribute it and/or modify it -under the terms of the GNU Lesser General Public License as published by the -Free Software Foundation, either version 3 of the License, or (at your option) -any later version. - -MinIMU-9-Arduino-AHRS is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for -more details. - -You should have received a copy of the GNU Lesser General Public License along -with MinIMU-9-Arduino-AHRS. If not, see <http://www.gnu.org/licenses/>. - -*/ - -void Compass_Heading() -{ - float MAG_X; - float MAG_Y; - float cos_roll; - float sin_roll; - float cos_pitch; - float sin_pitch; - - cos_roll = cos(roll); - sin_roll = sin(roll); - cos_pitch = cos(pitch); - sin_pitch = sin(pitch); - - // adjust for LSM303 compass axis offsets/sensitivity differences by scaling to +/-0.5 range - c_magnetom_x = (float)(magnetom_x - SENSOR_SIGN[6]*M_X_MIN) / (M_X_MAX - M_X_MIN) - SENSOR_SIGN[6]*0.5; - c_magnetom_y = (float)(magnetom_y - SENSOR_SIGN[7]*M_Y_MIN) / (M_Y_MAX - M_Y_MIN) - SENSOR_SIGN[7]*0.5; - c_magnetom_z = (float)(magnetom_z - SENSOR_SIGN[8]*M_Z_MIN) / (M_Z_MAX - M_Z_MIN) - SENSOR_SIGN[8]*0.5; - - // Tilt compensated Magnetic filed X: - MAG_X = c_magnetom_x*cos_pitch+c_magnetom_y*sin_roll*sin_pitch+c_magnetom_z*cos_roll*sin_pitch; - // Tilt compensated Magnetic filed Y: - MAG_Y = c_magnetom_y*cos_roll-c_magnetom_z*sin_roll; - // Magnetic Heading - MAG_Heading = atan2(-MAG_Y,MAG_X); -} |
