Skip to content

Commit 456c1bf

Browse files
rmackay9tridge
authored andcommitted
AP_Mount: viewpro fix for swapped ahrs roll pitch
1 parent c17a11b commit 456c1bf

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

libraries/AP_Mount/AP_Mount_Viewpro.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,8 +702,8 @@ bool AP_Mount_Viewpro::send_m_ahrs()
702702
frame_id: FrameId::M_AHRS,
703703
data_type: 0x07, // Bit0: Attitude, Bit1: GPS, Bit2 Gyro
704704
unused2to8 : {0, 0, 0, 0, 0, 0, 0},
705-
pitch_be: htobe16(-degrees(AP::ahrs().get_pitch()) * AP_MOUNT_VIEWPRO_DEG_TO_OUTPUT), // vehicle pitch angle. 1bit=360deg/65536
706705
roll_be: htobe16(degrees(AP::ahrs().get_roll()) * AP_MOUNT_VIEWPRO_DEG_TO_OUTPUT), // vehicle roll angle. 1bit=360deg/65536
706+
pitch_be: htobe16(-degrees(AP::ahrs().get_pitch()) * AP_MOUNT_VIEWPRO_DEG_TO_OUTPUT), // vehicle pitch angle. 1bit=360deg/65536
707707
yaw_be: htobe16(veh_yaw_deg * AP_MOUNT_VIEWPRO_DEG_TO_OUTPUT), // vehicle yaw angle. 1bit=360deg/65536
708708
date_be: htobe16(date), // bit0~6:year, bit7~10:month, bit11~15:day
709709
seconds_utc: {uint8_t((second_hundredths & 0xFF0000ULL) >> 16), // seconds * 100 MSB. 1bit = 0.01sec

libraries/AP_Mount/AP_Mount_Viewpro.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,8 @@ class AP_Mount_Viewpro : public AP_Mount_Backend
291291
FrameId frame_id; // always 0xB1
292292
uint8_t data_type; // should be 0x07. Bit0: Attitude, Bit1: GPS, Bit2 Gyro
293293
uint8_t unused2to8[7]; // unused
294-
be16_t pitch_be; // vehicle pitch angle. 1bit=360deg/65536
295294
be16_t roll_be; // vehicle roll angle. 1bit=360deg/65536
295+
be16_t pitch_be; // vehicle pitch angle. 1bit=360deg/65536
296296
be16_t yaw_be; // vehicle yaw angle. 1bit=360deg/65536
297297
be16_t date_be; // bit0~6:year, bit7~10:month, bit11~15:day
298298
uint8_t seconds_utc[3]; // seconds. 1bit = 0.01sec

0 commit comments

Comments
 (0)