@@ -173,6 +173,13 @@ MavlinkClient::MavlinkClient(OBCConfig config)
173173 this ->data .armed = armed;
174174 });
175175
176+ this ->telemetry ->subscribe_heading ([this ](mavsdk::Telemetry::Heading heading) {
177+ VLOG_F (DEBUG, " Heading: %d" , heading.heading_deg );
178+ Lock lock (this ->data_mut );
179+ this ->data .heading_deg = heading.heading_deg ;
180+ });
181+
182+ // TODO: AFTER UPDATING TO MAV 3, REPLACE WITH MAVSDK IMPLIMENTATION
176183 this ->passthrough ->subscribe_message (WIND_COV, [this ](const mavlink_message_t & message) {
177184 // LOG_F(INFO, "UNIX TIME: %lu", message.payload64[0]);
178185
@@ -184,16 +191,18 @@ MavlinkClient::MavlinkClient(OBCConfig config)
184191 this ->data .wind .y = (message.payload64 [1 ] >> 48 ) & 0xFF ;
185192 this ->data .wind .z = (message.payload64 [1 ] >> 40 ) & 0xFF ;
186193 });
187- // this->telemetry->subscribe_attitude_euler(
188- // [this](mavsdk::Telemetry::EulerAngle attitude) {
189- // VLOG_F(DEBUG, "Yaw: %f, Pitch: %f, Roll: %f)",
190- // attitude.yaw_deg, attitude.pitch_deg, attitude.roll_deg);
191-
192- // Lock lock(this->data_mut);
193- // this->data.yaw_deg = attitude.yaw_deg;
194- // this->data.pitch_deg = attitude.pitch_deg;
195- // this->data.roll_deg = attitude.roll_deg;
196- // });
194+
195+
196+ this ->telemetry ->subscribe_attitude_euler (
197+ [this ](mavsdk::Telemetry::EulerAngle attitude) {
198+ VLOG_F (DEBUG, " Yaw: %f, Pitch: %f, Roll: %f)" ,
199+ attitude.yaw_deg , attitude.pitch_deg , attitude.roll_deg );
200+
201+ Lock lock (this ->data_mut );
202+ this ->data .yaw_deg = attitude.yaw_deg ;
203+ this ->data .pitch_deg = attitude.pitch_deg ;
204+ this ->data .roll_deg = attitude.roll_deg ;
205+ });
197206}
198207
199208// Implement the triggerRelay method
0 commit comments