Browse Source

Rover: add MOT_SKID_FRIC to up skid-steer motor out while stopped

mission-4.1.18
Randy Mackay 8 years ago
parent
commit
9f67d2a88d
  1. 16
      APMrover2/AP_MotorsUGV.cpp
  2. 1
      APMrover2/AP_MotorsUGV.h

16
APMrover2/AP_MotorsUGV.cpp

@ -72,6 +72,15 @@ const AP_Param::GroupInfo AP_MotorsUGV::var_info[] = { @@ -72,6 +72,15 @@ const AP_Param::GroupInfo AP_MotorsUGV::var_info[] = {
// @User: Standard
AP_GROUPINFO("THR_MAX", 6, AP_MotorsUGV, _throttle_max, 100),
// @Param: SKID_FRIC
// @DisplayName: Motor skid steering friction compensation
// @Description: Motor output for skid steering vehicles will be increased by this percentage to overcome friction when stopped
// @Units: %
// @Range: 0 100
// @Increment: 1
// @User: Standard
AP_GROUPINFO("SKID_FRIC", 7, AP_MotorsUGV, _skid_friction, 0.0f),
AP_GROUPEND
};
@ -268,9 +277,10 @@ void AP_MotorsUGV::output_skid_steering(bool armed, float steering, float thrott @@ -268,9 +277,10 @@ void AP_MotorsUGV::output_skid_steering(bool armed, float steering, float thrott
// deal with case of turning on the spot
if (is_zero(throttle_scaled)) {
// full possible range is not used to keep response equivalent to non-zero throttle case
motor_left += steering_scaled * 0.5f;
motor_right -= steering_scaled * 0.5f;
// steering output split evenly between left and right motors and compensated for friction
const float friction_comp = MAX(0.0f, 1.0f + (_skid_friction * 0.01f));
motor_left += steering_scaled * 0.5f * friction_comp;
motor_right -= steering_scaled * 0.5f * friction_comp;
} else {
// add in steering
const float dir = is_positive(throttle_scaled) ? 1.0f : -1.0f;

1
APMrover2/AP_MotorsUGV.h

@ -99,6 +99,7 @@ protected: @@ -99,6 +99,7 @@ protected:
AP_Int8 _slew_rate; // slew rate expressed as a percentage / second
AP_Int8 _throttle_min; // throttle minimum percentage
AP_Int8 _throttle_max; // throttle maximum percentage
AP_Float _skid_friction; // skid steering vehicle motor output compensation for friction while stopped
// internal variables
float _steering; // requested steering as a value from -4500 to +4500

Loading…
Cancel
Save