Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Ardupilot
GitHub Repository: Ardupilot/ardupilot
Path: blob/master/Blimp/mode_velocity.cpp
9465 views
1
#include "Blimp.h"
2
/*
3
* Init and run calls for velocity flight mode
4
*/
5
6
// Runs the main velocity controller
7
void ModeVelocity::run()
8
{
9
Vector3f target_vel;
10
float target_vel_yaw;
11
get_pilot_input(target_vel, target_vel_yaw);
12
target_vel.x *= g.max_vel_xy;
13
target_vel.y *= g.max_vel_xy;
14
if (g.simple_mode == 0) {
15
//If simple mode is disabled, input is in body-frame, thus needs to be rotated.
16
blimp.rotate_BF_to_NE(target_vel.xy());
17
}
18
target_vel.z *= g.max_vel_z;
19
target_vel_yaw *= g.max_vel_yaw;
20
21
blimp.loiter->run_vel(target_vel, target_vel_yaw, Vector4b{false,false,false,false});
22
}
23
24