fix: add motor number max fitting Actuator

This commit is contained in:
Pedro-Roque
2025-12-10 15:41:39 -08:00
parent 6991a6ac88
commit 0b530615af
3 changed files with 6 additions and 4 deletions
@@ -85,7 +85,6 @@ bool GZMixingInterfaceESC::updateOutputs(uint16_t outputs[MAX_ACTUATORS], unsign
}
if (_actuators_pub.Valid()) {
PX4_INFO("Update complete");
return _actuators_pub.Publish(rotor_velocity_message);
}
}
@@ -111,8 +110,10 @@ void GZMixingInterfaceESC::motorSpeedCallback(const gz::msgs::Actuators &actuato
esc_status_s esc_status{};
esc_status.esc_count = actuators.velocity_size();
// Limit to max supported ESCs while allowing for a larger number of system actuators
int actuators_size = math::min(actuators.velocity_size(), static_cast<int>(esc_status_s::CONNECTED_ESC_MAX));
for (int i = 0; i < actuators.velocity_size(); i++) {
for (int i = 0; i < actuators_size; i++) {
esc_status.esc[i].timestamp = hrt_absolute_time();
esc_status.esc[i].esc_rpm = actuators.velocity(i);
esc_status.esc_online_flags |= 1 << i;
+2 -1
View File
@@ -1,3 +1,4 @@
__max_num_motors: &max_num_motors 12
__max_num_servos: &max_num_servos 8
__max_num_tilts: &max_num_tilts 4
@@ -18,7 +19,7 @@ actuator_output:
min: { min: 0, max: 1000, default: 0 }
max: { min: 0, max: 1000, default: 1000 }
failsafe: { min: 0, max: 1000 }
num_channels: 12
num_channels: *max_num_motors
- param_prefix: SIM_GZ_SV
group_label: 'Servos'
channel_label: 'Servo'
+1 -1
View File
@@ -52,7 +52,7 @@ publications:
- topic: /fmu/out/transponder_report
type: px4_msgs::msg::TransponderReport
# - topic: /fmu/out/vehicle_angular_velocity
# type: px4_msgs::msg::VehicleAngularVelocity