Skip to content

Commit f0d4f2e

Browse files
authored
examples: make gimbal_manager more verbose (#3036)
1 parent e6efd15 commit f0d4f2e

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

cpp/examples/gimbal_manager/gimbal_manager.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,9 +543,14 @@ class GimbalManager {
543543
!in_control(
544544
static_cast<uint8_t>(message.system_id),
545545
static_cast<uint8_t>(message.component_id))) {
546+
std::cout << "GIMBAL_MANAGER_SET_ATTITUDE ignored (not for us or not in control) from "
547+
<< message.system_id << "/" << message.component_id << '\n';
546548
return;
547549
}
548550

551+
std::cout << "GIMBAL_MANAGER_SET_ATTITUDE from " << message.system_id << "/"
552+
<< message.component_id << " flags=" << fields.value("flags", 0u) << '\n';
553+
549554
apply_flags(fields.value("flags", 0u));
550555
_roi.reset();
551556

@@ -592,9 +597,15 @@ class GimbalManager {
592597
!in_control(
593598
static_cast<uint8_t>(message.system_id),
594599
static_cast<uint8_t>(message.component_id))) {
600+
std::cout << "GIMBAL_MANAGER_SET_PITCHYAW ignored (not for us or not in control) from "
601+
<< message.system_id << "/" << message.component_id << '\n';
595602
return;
596603
}
597604

605+
std::cout << "GIMBAL_MANAGER_SET_PITCHYAW from " << message.system_id << "/"
606+
<< message.component_id << ": pitch=" << fields.value("pitch", 0.0f)
607+
<< " yaw=" << fields.value("yaw", 0.0f) << '\n';
608+
598609
apply_flags(fields.value("flags", 0u));
599610
_roi.reset();
600611

@@ -613,6 +624,11 @@ class GimbalManager {
613624
std::nullopt;
614625
_yaw_rate_setpoint_deg_s =
615626
yaw_rate_rad_s ? std::optional<float>(to_deg_from_rad(*yaw_rate_rad_s)) : std::nullopt;
627+
628+
std::cout << " -> setpoint now pitch="
629+
<< (_pitch_setpoint_deg ? std::to_string(*_pitch_setpoint_deg) : "none")
630+
<< " deg, yaw="
631+
<< (_yaw_setpoint_deg ? std::to_string(*_yaw_setpoint_deg) : "none") << " deg\n";
616632
}
617633

618634
// Needs to be called with _mutex held.

0 commit comments

Comments
 (0)