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/AntennaTracker/mode_guided.cpp
Views: 1798
1
#include "mode.h"
2
3
#include "Tracker.h"
4
#include <GCS_MAVLink/GCS.h>
5
6
void ModeGuided::update()
7
{
8
static uint32_t last_debug;
9
const uint32_t now = AP_HAL::millis();
10
float target_roll, target_pitch, target_yaw;
11
_target_att.to_euler(target_roll, target_pitch, target_yaw);
12
if (now - last_debug > 5000) {
13
last_debug = now;
14
gcs().send_text(MAV_SEVERITY_INFO, "target_yaw=%f target_pitch=%f", degrees(target_yaw), degrees(target_pitch));
15
}
16
calc_angle_error(degrees(target_pitch)*100, degrees(target_yaw)*100, false);
17
float bf_pitch;
18
float bf_yaw;
19
convert_ef_to_bf(target_pitch, target_yaw, bf_pitch, bf_yaw);
20
tracker.update_pitch_servo(bf_pitch);
21
tracker.update_yaw_servo(bf_yaw);
22
}
23
24