Line data Source code
1 : #include "Rover.h" 2 : 3 83 : void ModeManual::_exit() 4 : { 5 : // clear lateral when exiting manual mode 6 83 : g2.motors.set_lateral(0); 7 83 : } 8 : 9 362133 : void ModeManual::update() 10 : { 11 : float desired_steering, desired_throttle, desired_lateral; 12 362133 : get_pilot_desired_steering_and_throttle(desired_steering, desired_throttle); 13 362133 : get_pilot_desired_lateral(desired_lateral); 14 : 15 : // apply manual steering expo 16 362133 : desired_steering = 4500.0 * input_expo(desired_steering / 4500, g2.manual_steering_expo); 17 : 18 : // if vehicle is balance bot, calculate actual throttle required for balancing 19 362133 : if (rover.is_balancebot()) { 20 31073 : rover.balancebot_pitch_control(desired_throttle); 21 : } 22 : 23 : // walking robots support roll, pitch and walking_height 24 : float desired_roll, desired_pitch, desired_walking_height; 25 362133 : get_pilot_desired_roll_and_pitch(desired_roll, desired_pitch); 26 362133 : get_pilot_desired_walking_height(desired_walking_height); 27 362133 : g2.motors.set_roll(desired_roll); 28 362133 : g2.motors.set_pitch(desired_pitch); 29 362133 : g2.motors.set_walking_height(desired_walking_height); 30 : 31 : // set sailboat sails 32 362133 : g2.sailboat.set_pilot_desired_mainsail(); 33 : 34 : // copy RC scaled inputs to outputs 35 362133 : g2.motors.set_throttle(desired_throttle); 36 362133 : g2.motors.set_steering(desired_steering, (g2.manual_options & ManualOptions::SPEED_SCALING)); 37 362133 : g2.motors.set_lateral(desired_lateral); 38 362133 : }