@ -24,6 +24,49 @@ bool Mode::enter()
@@ -24,6 +24,49 @@ bool Mode::enter()
return _enter ( ) ;
}
void Mode : : get_pilot_desired_steering_and_throttle ( float & steering_out , float & throttle_out )
{
// apply RC skid steer mixing
switch ( ( enum pilot_steer_type_t ) rover . g . pilot_steer_type . get ( ) )
{
case PILOT_STEER_TYPE_DEFAULT :
default : {
// by default regular and skid-steering vehicles reverse their rotation direction when backing up
// (this is the same as PILOT_STEER_TYPE_DIR_REVERSED_WHEN_REVERSING below)
throttle_out = rover . channel_throttle - > get_control_in ( ) ;
steering_out = rover . channel_steer - > get_control_in ( ) ;
break ;
}
case PILOT_STEER_TYPE_TWO_PADDLES : {
// convert the two radio_in values from skid steering values
// left paddle from steering input channel, right paddle from throttle input channel
// steering = left-paddle - right-paddle
// throttle = average(left-paddle, right-paddle)
const float left_paddle = rover . channel_steer - > norm_input ( ) ;
const float right_paddle = rover . channel_throttle - > norm_input ( ) ;
throttle_out = 0.5f * ( left_paddle + right_paddle ) * 100.0f ;
const float steering_dir = is_negative ( throttle_out ) ? - 1 : 1 ;
steering_out = steering_dir * ( left_paddle - right_paddle ) * 4500.0f ;
break ;
}
case PILOT_STEER_TYPE_DIR_REVERSED_WHEN_REVERSING :
throttle_out = rover . channel_throttle - > get_control_in ( ) ;
steering_out = rover . channel_steer - > get_control_in ( ) ;
break ;
case PILOT_STEER_TYPE_DIR_UNCHANGED_WHEN_REVERSING : {
throttle_out = rover . channel_throttle - > get_control_in ( ) ;
const float steering_dir = is_negative ( throttle_out ) ? - 1 : 1 ;
steering_out = steering_dir * rover . channel_steer - > get_control_in ( ) ;
break ;
}
}
}
// set desired location
void Mode : : set_desired_location ( const struct Location & destination , float next_leg_bearing_cd )
{