Differential Rover: PR fixes

This commit is contained in:
Matthias Grob
2023-12-04 11:21:15 +01:00
committed by Per Frivik
parent 056e41af8c
commit 3de5c609a4
35 changed files with 381 additions and 478 deletions
@@ -1,6 +1,6 @@
############################################################################
#
# Copyright (c) 2022 PX4 Development Team. All rights reserved.
# Copyright (c) 2022-2023 PX4 Development Team. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -226,7 +226,7 @@ int GZBridge::init()
return PX4_ERROR;
}
if (!_mixing_interface_motor.init(_model_name)) {
if (!_mixing_interface_wheel.init(_model_name)) {
PX4_ERR("failed to init motor output");
return PX4_ERROR;
}
@@ -729,7 +729,7 @@ void GZBridge::Run()
_mixing_interface_esc.stop();
_mixing_interface_servo.stop();
_mixing_interface_motor.stop();
_mixing_interface_wheel.stop();
exit_and_cleanup();
return;
@@ -745,7 +745,7 @@ void GZBridge::Run()
_mixing_interface_esc.updateParams();
_mixing_interface_servo.updateParams();
_mixing_interface_motor.updateParams();
_mixing_interface_wheel.updateParams();
}
ScheduleDelayed(10_ms);
@@ -761,8 +761,8 @@ int GZBridge::print_status()
PX4_INFO_RAW("Servo outputs:\n");
_mixing_interface_servo.mixingOutput().printStatus();
PX4_INFO_RAW("Motor outputs:\n");
_mixing_interface_motor.mixingOutput().printStatus();
PX4_INFO_RAW("Wheel outputs:\n");
_mixing_interface_wheel.mixingOutput().printStatus();
return 0;
}
@@ -132,7 +132,7 @@ private:
GZMixingInterfaceESC _mixing_interface_esc{_node, _node_mutex};
GZMixingInterfaceServo _mixing_interface_servo{_node, _node_mutex};
GZMixingInterfaceWheel _mixing_interface_motor{_node, _node_mutex};
GZMixingInterfaceWheel _mixing_interface_wheel{_node, _node_mutex};
px4::atomic<uint64_t> _world_time_us{0};
@@ -77,8 +77,9 @@ bool GZMixingInterfaceWheel::updateOutputs(bool stop_wheels, uint16_t outputs[MA
wheel_velocity_message.mutable_velocity()->Resize(active_output_count, 0);
for (unsigned i = 0; i < active_output_count; i++) {
float output_scaler = 100.0f;
float scaled_output = (float)outputs[i] - output_scaler;
// Offsetting the output allows for negative values despite unsigned integer to reverse the wheels
static constexpr float output_offset = 100.0f;
float scaled_output = (float)outputs[i] - output_offset;
wheel_velocity_message.set_velocity(i, scaled_output);
}
@@ -80,7 +80,7 @@ private:
gz::transport::Node &_node;
pthread_mutex_t &_node_mutex;
MixingOutput _mixing_output{"SIM_GZ_MT", MAX_ACTUATORS, *this, MixingOutput::SchedulingPolicy::Auto, false, false};
MixingOutput _mixing_output{"SIM_GZ_WH", MAX_ACTUATORS, *this, MixingOutput::SchedulingPolicy::Auto, false, false};
gz::transport::Node::Publisher _actuators_pub;
+3 -3
View File
@@ -25,9 +25,9 @@ actuator_output:
max: { min: 0, max: 1000, default: 1000 }
failsafe: { min: 0, max: 1000 }
num_channels: 8
- param_prefix: SIM_GZ_MT
group_label: 'Motors'
channel_label: 'Motors'
- param_prefix: SIM_GZ_WH
group_label: 'Wheels'
channel_label: 'Wheels'
standard_params:
disarmed: { min: 0, max: 200, default: 100 }
min: { min: 0, max: 200, default: 0 }