Skip to content

Commit 431d078

Browse files
committed
firmware sends offboard command for timing tests
1 parent 6113955 commit 431d078

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

comms/mavlink/mavlink.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,17 @@ void Mavlink::handle_msg_offboard_control(const mavlink_message_t * const msg)
479479
control.Fz.valid = !(ctrl.ignore & IGNORE_VALUE6);
480480

481481
if (listener_ != nullptr) { listener_->offboard_control_callback(control); }
482+
483+
received_offboard_ctrl_ = true;
484+
prev_offboard_msg_ = *msg;
485+
}
486+
487+
void Mavlink::send_previous_offboard_control()
488+
{
489+
if (received_offboard_ctrl_) {
490+
send_message(prev_offboard_msg_);
491+
received_offboard_ctrl_ = false;
492+
}
482493
}
483494

484495
void Mavlink::handle_msg_external_attitude(const mavlink_message_t * const msg)

comms/mavlink/mavlink.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,11 @@ class Mavlink : public CommLinkInterface
112112
bool initialized_ = false;
113113

114114
ListenerInterface * listener_ = nullptr;
115+
116+
// Timing experiment
117+
bool received_offboard_ctrl_ = false;
118+
mavlink_message_t prev_offboard_msg_;
119+
void send_previous_offboard_control() override;
115120
};
116121

117122
} // namespace rosflight_firmware

include/comm_link.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ class CommLinkInterface
167167

168168
// register listener
169169
virtual void set_listener(ListenerInterface * listener) = 0;
170+
171+
// Timing experiments
172+
virtual void send_previous_offboard_control() = 0;
170173
};
171174

172175
} // namespace rosflight_firmware

src/comm_manager.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,7 @@ void CommManager::stream(got_flags got)
510510

511511
send_buffered_log_messages();
512512

513+
comm_link_.send_previous_offboard_control();
513514
}
514515

515516
void CommManager::send_next_param(void)

0 commit comments

Comments
 (0)