2017-07-18 23:17:45 -03:00
|
|
|
#include "mode.h"
|
|
|
|
#include "Rover.h"
|
|
|
|
|
|
|
|
void ModeHold::update()
|
|
|
|
{
|
2018-06-21 09:36:58 -03:00
|
|
|
float throttle = 0.0f;
|
|
|
|
|
|
|
|
// if vehicle is balance bot, calculate actual throttle required for balancing
|
|
|
|
if (rover.is_balancebot()) {
|
2018-08-04 04:25:07 -03:00
|
|
|
rover.balancebot_pitch_control(throttle);
|
2018-06-21 09:36:58 -03:00
|
|
|
}
|
|
|
|
|
2018-09-25 10:09:47 -03:00
|
|
|
// relax mainsail
|
|
|
|
g2.motors.set_mainsail(100.0f);
|
|
|
|
|
2017-07-18 23:17:45 -03:00
|
|
|
// hold position - stop motors and center steering
|
2018-06-21 09:36:58 -03:00
|
|
|
g2.motors.set_throttle(throttle);
|
2017-07-18 23:17:45 -03:00
|
|
|
g2.motors.set_steering(0.0f);
|
|
|
|
}
|