Rover: set throttle range from -100 to 100

this allows for reverse
This commit is contained in:
Andrew Tridgell 2012-12-18 15:42:11 +11:00
parent d5364571a8
commit 33e47e2036
3 changed files with 7 additions and 7 deletions

View File

@ -33,9 +33,9 @@ static void throttle_slew_limit(int16_t last_throttle)
}
static void calc_throttle()
{ int rov_speed;
int throttle_target = g.throttle_cruise + throttle_nudge + 50;
{
int rov_speed;
int throttle_target = g.throttle_cruise + throttle_nudge;
rov_speed = g.airspeed_cruise;
@ -44,8 +44,8 @@ static void calc_throttle()
groundspeed_error = rov_speed - (float)ground_speed;
throttle = (throttle_target + g.pidTeThrottle.get_pid(groundspeed_error)) * 10;
g.channel_throttle.servo_out = constrain(((float)throttle / 10.0f), 0, g.throttle_max.get());
throttle = throttle_target + g.pidTeThrottle.get_pid(groundspeed_error);
g.channel_throttle.servo_out = constrain(throttle, 0, g.throttle_max.get());
}
/*****************************************

View File

@ -329,7 +329,7 @@ static void NOINLINE send_vfr_hud(mavlink_channel_t chan)
(float)g_gps->ground_speed / 100.0,
(float)g_gps->ground_speed / 100.0,
(ahrs.yaw_sensor / 100) % 360,
(uint16_t)(100 * (g.channel_throttle.norm_output() / 2.0 + 0.5)), // scale -1,1 to 0-100
(uint16_t)(100 * g.channel_throttle.norm_output()),
current_loc.alt / 100.0,
0);
}

View File

@ -11,7 +11,7 @@ static void init_rc_in()
g.channel_roll.set_angle(SERVO_MAX);
g.channel_pitch.set_angle(SERVO_MAX);
g.channel_rudder.set_angle(SERVO_MAX);
g.channel_throttle.set_range(0, 100);
g.channel_throttle.set_angle(100);
// set rc dead zones
g.channel_roll.set_dead_zone(60);