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/Blimp/mode_velocity.cpp
Views: 1798
1
#include "Blimp.h"
2
/*
3
* Init and run calls for velocity flight mode
4
*/
5
6
#include <AP_Vehicle/AP_MultiCopter.h>
7
8
// Runs the main velocity controller
9
void ModeVelocity::run()
10
{
11
Vector3f target_vel;
12
float target_vel_yaw;
13
get_pilot_input(target_vel, target_vel_yaw);
14
target_vel.x *= g.max_vel_xy;
15
target_vel.y *= g.max_vel_xy;
16
if (g.simple_mode == 0) {
17
//If simple mode is disabled, input is in body-frame, thus needs to be rotated.
18
blimp.rotate_BF_to_NE(target_vel.xy());
19
}
20
target_vel.z *= g.max_vel_z;
21
target_vel_yaw *= g.max_vel_yaw;
22
23
blimp.loiter->run_vel(target_vel, target_vel_yaw, Vector4b{false,false,false,false});
24
}
25
26