CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
Ardupilot

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: Ardupilot/ardupilot
Path: blob/master/Rover/mode_manual.cpp
Views: 1798
1
#include "Rover.h"
2
3
void ModeManual::_exit()
4
{
5
// clear lateral when exiting manual mode
6
g2.motors.set_lateral(0);
7
}
8
9
void ModeManual::update()
10
{
11
float desired_steering, desired_throttle, desired_lateral;
12
get_pilot_desired_steering_and_throttle(desired_steering, desired_throttle);
13
get_pilot_desired_lateral(desired_lateral);
14
15
// apply manual steering expo
16
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
if (rover.is_balancebot()) {
20
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
get_pilot_desired_roll_and_pitch(desired_roll, desired_pitch);
26
get_pilot_desired_walking_height(desired_walking_height);
27
g2.motors.set_roll(desired_roll);
28
g2.motors.set_pitch(desired_pitch);
29
g2.motors.set_walking_height(desired_walking_height);
30
31
// set sailboat sails
32
g2.sailboat.set_pilot_desired_mainsail();
33
34
// copy RC scaled inputs to outputs
35
g2.motors.set_throttle(desired_throttle);
36
g2.motors.set_steering(desired_steering, (g2.manual_options & ManualOptions::SPEED_SCALING));
37
g2.motors.set_lateral(desired_lateral);
38
}
39
40