ardupilot/Blimp/mode_velocity.cpp

25 lines
681 B
C++
Raw Normal View History

2021-06-18 01:40:01 -03:00
#include "Blimp.h"
/*
* Init and run calls for velocity flight mode
*/
#include <AP_Vehicle/AP_MultiCopter.h>
2021-06-18 01:40:01 -03:00
// Runs the main velocity controller
void ModeVelocity::run()
{
Vector3f target_vel;
2023-07-27 02:03:08 -03:00
float target_vel_yaw;
get_pilot_input(target_vel, target_vel_yaw);
target_vel.x *= g.max_vel_xy;
target_vel.y *= g.max_vel_xy;
if (g.simple_mode == 0) {
//If simple mode is disabled, input is in body-frame, thus needs to be rotated.
blimp.rotate_BF_to_NE(target_vel.xy());
2021-06-18 01:40:01 -03:00
}
2023-07-27 02:03:08 -03:00
target_vel.z *= g.max_vel_z;
target_vel_yaw *= g.max_vel_yaw;
2021-06-18 01:40:01 -03:00
2023-07-27 02:03:08 -03:00
blimp.loiter->run_vel(target_vel, target_vel_yaw, Vector4b{false,false,false,false});
2021-06-18 01:40:01 -03:00
}