Skip to content

Commit 4a5eabb

Browse files
committed
rover: constrain update steps
1 parent 248f113 commit 4a5eabb

File tree

15 files changed

+16
-16
lines changed

15 files changed

+16
-16
lines changed

src/modules/rover_ackermann/AckermannActControl/AckermannActControl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ void AckermannActControl::updateActControl()
5757
{
5858
const hrt_abstime timestamp_prev = _timestamp;
5959
_timestamp = hrt_absolute_time();
60-
const float dt = math::constrain(_timestamp - timestamp_prev, 1_ms, 5000_ms) * 1e-6f;
60+
const float dt = math::constrain(_timestamp - timestamp_prev, 1_ms, 10_ms) * 1e-6f;
6161

6262
// Motor control
6363
if (_rover_throttle_setpoint_sub.updated()) {

src/modules/rover_ackermann/AckermannAttControl/AckermannAttControl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void AckermannAttControl::updateAttControl()
6565

6666
hrt_abstime timestamp_prev = _timestamp;
6767
_timestamp = hrt_absolute_time();
68-
const float dt = math::constrain(_timestamp - timestamp_prev, 1_ms, 5000_ms) * 1e-6f;
68+
const float dt = math::constrain(_timestamp - timestamp_prev, 1_ms, 10_ms) * 1e-6f;
6969

7070
if (PX4_ISFINITE(_yaw_setpoint)) {
7171
// Calculate yaw rate limit for slew rate

src/modules/rover_ackermann/AckermannRateControl/AckermannRateControl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ void AckermannRateControl::updateRateControl()
6262

6363
hrt_abstime timestamp_prev = _timestamp;
6464
_timestamp = hrt_absolute_time();
65-
const float dt = math::constrain(_timestamp - timestamp_prev, 1_ms, 5000_ms) * 1e-6f;
65+
const float dt = math::constrain(_timestamp - timestamp_prev, 1_ms, 10_ms) * 1e-6f;
6666

6767
if (PX4_ISFINITE(_yaw_rate_setpoint)) {
6868
if (fabsf(_estimated_speed) > FLT_EPSILON) {

src/modules/rover_ackermann/AckermannSpeedControl/AckermannSpeedControl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ void AckermannSpeedControl::updateSpeedControl()
6363

6464
const hrt_abstime timestamp_prev = _timestamp;
6565
_timestamp = hrt_absolute_time();
66-
const float dt = math::constrain(_timestamp - timestamp_prev, 1_ms, 5000_ms) * 1e-6f;
66+
const float dt = math::constrain(_timestamp - timestamp_prev, 1_ms, 10_ms) * 1e-6f;
6767

6868
// Throttle Setpoint
6969
if (PX4_ISFINITE(_speed_setpoint)) {

src/modules/rover_ackermann/AckermannSpeedControl/AckermannSpeedControl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class AckermannSpeedControl : public ModuleParams
113113

114114
// Controllers
115115
PID _pid_speed;
116-
SlewRate<float> _adjusted_speed_setpoint;
116+
SlewRate<float> _adjusted_speed_setpoint{0.f};
117117

118118
DEFINE_PARAMETERS(
119119
(ParamFloat<px4::params::RO_MAX_THR_SPEED>) _param_ro_max_thr_speed,

src/modules/rover_differential/DifferentialActControl/DifferentialActControl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ void DifferentialActControl::updateActControl()
5353
{
5454
const hrt_abstime timestamp_prev = _timestamp;
5555
_timestamp = hrt_absolute_time();
56-
const float dt = math::constrain(_timestamp - timestamp_prev, 1_ms, 5000_ms) * 1e-6f;
56+
const float dt = math::constrain(_timestamp - timestamp_prev, 1_ms, 10_ms) * 1e-6f;
5757

5858
// Motor control
5959
if (_rover_throttle_setpoint_sub.updated()) {

src/modules/rover_differential/DifferentialAttControl/DifferentialAttControl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ void DifferentialAttControl::updateAttControl()
6363
{
6464
hrt_abstime timestamp_prev = _timestamp;
6565
_timestamp = hrt_absolute_time();
66-
const float dt = math::constrain(_timestamp - timestamp_prev, 1_ms, 5000_ms) * 1e-6f;
66+
const float dt = math::constrain(_timestamp - timestamp_prev, 1_ms, 10_ms) * 1e-6f;
6767

6868
if (_vehicle_attitude_sub.updated()) {
6969
vehicle_attitude_s vehicle_attitude{};

src/modules/rover_differential/DifferentialRateControl/DifferentialRateControl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ void DifferentialRateControl::updateRateControl()
5959
{
6060
hrt_abstime timestamp_prev = _timestamp;
6161
_timestamp = hrt_absolute_time();
62-
const float dt = math::constrain(_timestamp - timestamp_prev, 1_ms, 5000_ms) * 1e-6f;
62+
const float dt = math::constrain(_timestamp - timestamp_prev, 1_ms, 10_ms) * 1e-6f;
6363

6464
if (_vehicle_angular_velocity_sub.updated()) {
6565
vehicle_angular_velocity_s vehicle_angular_velocity{};

src/modules/rover_differential/DifferentialSpeedControl/DifferentialSpeedControl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ void DifferentialSpeedControl::updateSpeedControl()
6363

6464
const hrt_abstime timestamp_prev = _timestamp;
6565
_timestamp = hrt_absolute_time();
66-
const float dt = math::constrain(_timestamp - timestamp_prev, 1_ms, 5000_ms) * 1e-6f;
66+
const float dt = math::constrain(_timestamp - timestamp_prev, 1_ms, 10_ms) * 1e-6f;
6767

6868
// Throttle Setpoint
6969
if (PX4_ISFINITE(_speed_setpoint)) {

src/modules/rover_differential/DifferentialSpeedControl/DifferentialSpeedControl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class DifferentialSpeedControl : public ModuleParams
122122

123123
// Controllers
124124
PID _pid_speed;
125-
SlewRate<float> _adjusted_speed_setpoint;
125+
SlewRate<float> _adjusted_speed_setpoint{0.f};
126126

127127
DEFINE_PARAMETERS(
128128
(ParamFloat<px4::params::RO_MAX_THR_SPEED>) _param_ro_max_thr_speed,

0 commit comments

Comments
 (0)