mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-30 12:38:33 -04:00
AP_Mount: Enable Joystick speed code, now that the framework supports more than 16 parameters per group.
Save some bytes by skiping the redundant *_rc_in initialization in the AP_Mount() constructor
This commit is contained in:
parent
a8c99f3887
commit
530ea0bebd
@ -135,16 +135,15 @@ const AP_Param::GroupInfo AP_Mount::var_info[] PROGMEM = {
|
|||||||
// @Increment: 1
|
// @Increment: 1
|
||||||
// @User: Standard
|
// @User: Standard
|
||||||
AP_GROUPINFO("PAN_ANGMAX", 15, AP_Mount, _pan_angle_max, 4500),
|
AP_GROUPINFO("PAN_ANGMAX", 15, AP_Mount, _pan_angle_max, 4500),
|
||||||
/*
|
|
||||||
Must be commented out because the framework does not support more than 16 parameters
|
|
||||||
// @Param: JOYSTICK_SPEED
|
// @Param: JOYSTICK_SPEED
|
||||||
// @DisplayName: mount joystick speed
|
// @DisplayName: mount joystick speed
|
||||||
// @Description: 0 for position control, small for low speeds, 10 for max speed
|
// @Description: 0 for position control, small for low speeds, 10 for max speed
|
||||||
// @Range: 0 10
|
// @Range: 0 10
|
||||||
// @Increment: 1
|
// @Increment: 1
|
||||||
// @User: Standard
|
// @User: Standard
|
||||||
AP_GROUPINFO("JOYSTICK_SPEED", 16, AP_Mount, _joystick_speed),
|
AP_GROUPINFO("JOYSTICK_SPEED", 16, AP_Mount, _joystick_speed, 0),
|
||||||
*/
|
|
||||||
AP_GROUPEND
|
AP_GROUPEND
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -164,11 +163,6 @@ _gps(gps)
|
|||||||
|
|
||||||
// default unknown mount type
|
// default unknown mount type
|
||||||
_mount_type = k_unknown;
|
_mount_type = k_unknown;
|
||||||
|
|
||||||
// default manual rc channel to disabled
|
|
||||||
_pan_rc_in = 0;
|
|
||||||
_tilt_rc_in= 0;
|
|
||||||
_roll_rc_in= 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Auto-detect the mount gimbal type depending on the functions assigned to the servos
|
/// Auto-detect the mount gimbal type depending on the functions assigned to the servos
|
||||||
@ -254,7 +248,7 @@ void AP_Mount::update_mount_position()
|
|||||||
// RC radio manual angle control, but with stabilization from the AHRS
|
// RC radio manual angle control, but with stabilization from the AHRS
|
||||||
case MAV_MOUNT_MODE_RC_TARGETING:
|
case MAV_MOUNT_MODE_RC_TARGETING:
|
||||||
{
|
{
|
||||||
/* if (_joystick_speed) { // for spring loaded joysticks
|
if (_joystick_speed) { // for spring loaded joysticks
|
||||||
// allow pilot speed position input to come directly from an RC_Channel
|
// allow pilot speed position input to come directly from an RC_Channel
|
||||||
if (_roll_rc_in && (rc_ch[_roll_rc_in-1])) {
|
if (_roll_rc_in && (rc_ch[_roll_rc_in-1])) {
|
||||||
//_roll_control_angle += angle_input(rc_ch[_roll_rc_in-1], _roll_angle_min, _roll_angle_max) * 0.00001 * _joystick_speed;
|
//_roll_control_angle += angle_input(rc_ch[_roll_rc_in-1], _roll_angle_min, _roll_angle_max) * 0.00001 * _joystick_speed;
|
||||||
@ -275,7 +269,7 @@ void AP_Mount::update_mount_position()
|
|||||||
if (_pan_control_angle > radians(_pan_angle_max*0.01)) _pan_control_angle = radians(_pan_angle_max*0.01);
|
if (_pan_control_angle > radians(_pan_angle_max*0.01)) _pan_control_angle = radians(_pan_angle_max*0.01);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
*/ // allow pilot position input to come directly from an RC_Channel
|
// allow pilot position input to come directly from an RC_Channel
|
||||||
if (_roll_rc_in && (rc_ch[_roll_rc_in-1])) {
|
if (_roll_rc_in && (rc_ch[_roll_rc_in-1])) {
|
||||||
_roll_control_angle = angle_input_rad(rc_ch[_roll_rc_in-1], _roll_angle_min, _roll_angle_max);
|
_roll_control_angle = angle_input_rad(rc_ch[_roll_rc_in-1], _roll_angle_min, _roll_angle_max);
|
||||||
}
|
}
|
||||||
@ -285,7 +279,7 @@ void AP_Mount::update_mount_position()
|
|||||||
if (_pan_rc_in && (rc_ch[_pan_rc_in-1])) {
|
if (_pan_rc_in && (rc_ch[_pan_rc_in-1])) {
|
||||||
_pan_control_angle = angle_input_rad(rc_ch[_pan_rc_in-1], _pan_angle_min, _pan_angle_max);
|
_pan_control_angle = angle_input_rad(rc_ch[_pan_rc_in-1], _pan_angle_min, _pan_angle_max);
|
||||||
}
|
}
|
||||||
// }
|
}
|
||||||
stabilize();
|
stabilize();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,7 @@ private:
|
|||||||
AP_Int16 _pan_angle_min; ///< min angle limit of actuated surface in 0.01 degree units
|
AP_Int16 _pan_angle_min; ///< min angle limit of actuated surface in 0.01 degree units
|
||||||
AP_Int16 _pan_angle_max; ///< max angle limit of actuated surface in 0.01 degree units
|
AP_Int16 _pan_angle_max; ///< max angle limit of actuated surface in 0.01 degree units
|
||||||
|
|
||||||
//AP_Int8 _joystick_speed;
|
AP_Int8 _joystick_speed;
|
||||||
|
|
||||||
AP_Vector3f _retract_angles; ///< retracted position for mount, vector.x = roll vector.y = tilt, vector.z=pan
|
AP_Vector3f _retract_angles; ///< retracted position for mount, vector.x = roll vector.y = tilt, vector.z=pan
|
||||||
AP_Vector3f _neutral_angles; ///< neutral position for mount, vector.x = roll vector.y = tilt, vector.z=pan
|
AP_Vector3f _neutral_angles; ///< neutral position for mount, vector.x = roll vector.y = tilt, vector.z=pan
|
||||||
|
Loading…
Reference in New Issue
Block a user