limit vehicle_command subscription updates per cycle

- this is a precaution to eliminate the possibility of getting stuck in
a loop trying to keep up with a high rate publication that could be
coming from a higher priority task
This commit is contained in:
Daniel Agar
2022-10-17 16:10:51 -04:00
parent 677f3e9294
commit 0d6766d14d
4 changed files with 18 additions and 5 deletions
+4 -1
View File
@@ -223,7 +223,10 @@ void Navigator::run()
_home_pos_sub.update(&_home_pos);
// Handle Vehicle commands
while (_vehicle_command_sub.updated()) {
int vehicle_command_updates = 0;
while (_vehicle_command_sub.updated() && (vehicle_command_updates < vehicle_command_s::ORB_QUEUE_LENGTH)) {
vehicle_command_updates++;
const unsigned last_generation = _vehicle_command_sub.get_last_generation();
vehicle_command_s cmd{};