fix(rover): fix rover modules to work with SIH lockstep (#28476)

After recent modification to the SIH lockstep, the rover modules were not working anymore.
This commit fixes the issues and makes the rover modules work with the SIH lockstep again.
This commit is contained in:
yannickpoffet authored and GitHub committed 2026-09-04 09:24:37 +02:00
1 parent f804968467
commit 3ebb2923a1
6 files changed
+60 -3

No files matched your search

+17 -1
View File
@@ -46,7 +46,11 @@ RoverAckermann::RoverAckermann() :
bool RoverAckermann::init()
{
ScheduleOnInterval(10_ms); // 100 Hz
if (!_vehicle_angular_velocity_sub.registerCallback()) {
PX4_ERR("callback registration failed");
return false;
}
return true;
}
@@ -57,6 +61,16 @@ void RoverAckermann::updateParams()
void RoverAckermann::Run()
{
if (should_exit()) {
_vehicle_angular_velocity_sub.unregisterCallback();
exit_and_cleanup(desc);
return;
}
// Drain the trigger. The gyro paces the loop; its value is not used here.
vehicle_angular_velocity_s angular_velocity;
_vehicle_angular_velocity_sub.update(&angular_velocity);
if (_parameter_update_sub.updated()) {
parameter_update_s param_update{};
_parameter_update_sub.copy(&param_update);
@@ -94,6 +108,8 @@ void RoverAckermann::Run()
_was_armed = false;
}
// reschedule backup
ScheduleDelayed(100_ms);
}
void RoverAckermann::generateSetpoints()
@@ -45,8 +45,10 @@
// uORB includes
#include <uORB/Subscription.hpp>
#include <uORB/SubscriptionCallback.hpp>
#include <uORB/Publication.hpp>
#include <uORB/topics/parameter_update.h>
#include <uORB/topics/vehicle_angular_velocity.h>
#include <uORB/topics/vehicle_control_mode.h>
#include <uORB/topics/vehicle_status.h>
@@ -117,6 +119,7 @@ private:
void reset();
// uORB subscriptions
uORB::SubscriptionCallbackWorkItem _vehicle_angular_velocity_sub{this, ORB_ID(vehicle_angular_velocity)};
uORB::Subscription _parameter_update_sub{ORB_ID(parameter_update)};
uORB::Subscription _vehicle_status_sub{ORB_ID(vehicle_status)};
uORB::Subscription _vehicle_control_mode_sub{ORB_ID(vehicle_control_mode)};
@@ -46,7 +46,11 @@ RoverDifferential::RoverDifferential() :
bool RoverDifferential::init()
{
ScheduleOnInterval(10_ms); // 100 Hz
if (!_vehicle_angular_velocity_sub.registerCallback()) {
PX4_ERR("callback registration failed");
return false;
}
return true;
}
@@ -57,6 +61,16 @@ void RoverDifferential::updateParams()
void RoverDifferential::Run()
{
if (should_exit()) {
_vehicle_angular_velocity_sub.unregisterCallback();
exit_and_cleanup(desc);
return;
}
// Drain the trigger. The gyro paces the loop; its value is not used here.
vehicle_angular_velocity_s angular_velocity;
_vehicle_angular_velocity_sub.update(&angular_velocity);
if (_parameter_update_sub.updated()) {
parameter_update_s param_update{};
_parameter_update_sub.copy(&param_update);
@@ -95,6 +109,8 @@ void RoverDifferential::Run()
_was_armed = false;
}
// reschedule backup
ScheduleDelayed(100_ms);
}
void RoverDifferential::generateSetpoints()
@@ -45,7 +45,9 @@
// uORB includes
#include <uORB/Subscription.hpp>
#include <uORB/SubscriptionCallback.hpp>
#include <uORB/topics/parameter_update.h>
#include <uORB/topics/vehicle_angular_velocity.h>
#include <uORB/topics/vehicle_control_mode.h>
#include <uORB/topics/vehicle_status.h>
@@ -116,6 +118,7 @@ private:
void reset();
// uORB subscriptions
uORB::SubscriptionCallbackWorkItem _vehicle_angular_velocity_sub{this, ORB_ID(vehicle_angular_velocity)};
uORB::Subscription _parameter_update_sub{ORB_ID(parameter_update)};
uORB::Subscription _vehicle_status_sub{ORB_ID(vehicle_status)};
uORB::Subscription _vehicle_control_mode_sub{ORB_ID(vehicle_control_mode)};
+17 -1
View File
@@ -46,7 +46,11 @@ RoverMecanum::RoverMecanum() :
bool RoverMecanum::init()
{
ScheduleOnInterval(10_ms); // 100 Hz
if (!_vehicle_angular_velocity_sub.registerCallback()) {
PX4_ERR("callback registration failed");
return false;
}
return true;
}
@@ -57,6 +61,16 @@ void RoverMecanum::updateParams()
void RoverMecanum::Run()
{
if (should_exit()) {
_vehicle_angular_velocity_sub.unregisterCallback();
exit_and_cleanup(desc);
return;
}
// Drain the trigger. The gyro paces the loop; its value is not used here.
vehicle_angular_velocity_s angular_velocity;
_vehicle_angular_velocity_sub.update(&angular_velocity);
if (_parameter_update_sub.updated()) {
parameter_update_s param_update{};
_parameter_update_sub.copy(&param_update);
@@ -95,6 +109,8 @@ void RoverMecanum::Run()
_was_armed = false;
}
// reschedule backup
ScheduleDelayed(100_ms);
}
void RoverMecanum::generateSetpoints()
@@ -45,7 +45,9 @@
// uORB includes
#include <uORB/Subscription.hpp>
#include <uORB/SubscriptionCallback.hpp>
#include <uORB/topics/parameter_update.h>
#include <uORB/topics/vehicle_angular_velocity.h>
#include <uORB/topics/vehicle_control_mode.h>
#include <uORB/topics/vehicle_status.h>
@@ -116,6 +118,7 @@ private:
void reset();
// uORB subscriptions
uORB::SubscriptionCallbackWorkItem _vehicle_angular_velocity_sub{this, ORB_ID(vehicle_angular_velocity)};
uORB::Subscription _parameter_update_sub{ORB_ID(parameter_update)};
uORB::Subscription _vehicle_status_sub{ORB_ID(vehicle_status)};
uORB::Subscription _vehicle_control_mode_sub{ORB_ID(vehicle_control_mode)};