ardupilot/Rover/mode_manual.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

39 lines
1.3 KiB
C++
Raw Normal View History

2017-07-18 23:17:45 -03:00
#include "Rover.h"
void ModeManual::_exit()
{
// clear lateral when exiting manual mode
g2.motors.set_lateral(0);
}
2017-07-18 23:17:45 -03:00
void ModeManual::update()
{
float desired_steering, desired_throttle, desired_lateral;
get_pilot_desired_steering_and_throttle(desired_steering, desired_throttle);
get_pilot_desired_lateral(desired_lateral);
2022-11-09 22:08:18 -04:00
// apply manual steering expo
desired_steering = 4500.0 * input_expo(desired_steering / 4500, g2.manual_steering_expo);
// if vehicle is balance bot, calculate actual throttle required for balancing
if (rover.is_balancebot()) {
rover.balancebot_pitch_control(desired_throttle);
}
// walking robots support roll, pitch and walking_height
float desired_roll, desired_pitch, desired_walking_height;
get_pilot_desired_roll_and_pitch(desired_roll, desired_pitch);
get_pilot_desired_walking_height(desired_walking_height);
g2.motors.set_roll(desired_roll);
g2.motors.set_pitch(desired_pitch);
g2.motors.set_walking_height(desired_walking_height);
2019-09-27 16:33:33 -03:00
// set sailboat sails
g2.sailboat.set_pilot_desired_mainsail();
2018-09-25 10:09:47 -03:00
// copy RC scaled inputs to outputs
g2.motors.set_throttle(desired_throttle);
g2.motors.set_steering(desired_steering, (g2.manual_options & ManualOptions::SPEED_SCALING));
g2.motors.set_lateral(desired_lateral);
2017-07-18 23:17:45 -03:00
}