@@ -4721,7 +4721,8 @@ class MavlinkStreamMountOrientation : public MavlinkStream
4721
4721
4722
4722
private:
4723
4723
MavlinkOrbSubscription *_mount_orientation_sub;
4724
- uint64_t _mount_orientation_time;
4724
+ MavlinkOrbSubscription *_gpos_sub;
4725
+ uint64_t _mount_orientation_time{0};
4725
4726
4726
4727
/* do not allow top copying this class */
4727
4728
MavlinkStreamMountOrientation(MavlinkStreamMountOrientation &) = delete;
@@ -4730,12 +4731,12 @@ class MavlinkStreamMountOrientation : public MavlinkStream
4730
4731
protected:
4731
4732
explicit MavlinkStreamMountOrientation(Mavlink *mavlink) : MavlinkStream(mavlink),
4732
4733
_mount_orientation_sub(_mavlink->add_orb_subscription(ORB_ID(mount_orientation))),
4733
- _mount_orientation_time(0 )
4734
+ _gpos_sub(_mavlink->add_orb_subscription(ORB_ID(vehicle_global_position)) )
4734
4735
{}
4735
4736
4736
4737
bool send(const hrt_abstime t) override
4737
4738
{
4738
- struct mount_orientation_s mount_orientation;
4739
+ mount_orientation_s mount_orientation{} ;
4739
4740
4740
4741
if (_mount_orientation_sub->update(&_mount_orientation_time, &mount_orientation)) {
4741
4742
mavlink_mount_orientation_t msg = {};
@@ -4744,6 +4745,10 @@ class MavlinkStreamMountOrientation : public MavlinkStream
4744
4745
msg.pitch = math::degrees(mount_orientation.attitude_euler_angle[1]);
4745
4746
msg.yaw = math::degrees(mount_orientation.attitude_euler_angle[2]);
4746
4747
4748
+ vehicle_global_position_s gpos{};
4749
+ _gpos_sub->update(&gpos);
4750
+ msg.yaw_absolute = math::degrees(matrix::wrap_2pi(gpos.yaw + mount_orientation.attitude_euler_angle[2]));
4751
+
4747
4752
mavlink_msg_mount_orientation_send_struct(_mavlink->get_channel(), &msg);
4748
4753
4749
4754
return true;
0 commit comments