Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
mavlink.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2014 Freek van Tienen <freek.v.tienen@gmail.com>
3 *
4 * This file is part of paparazzi.
5 *
6 * paparazzi is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * paparazzi is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with paparazzi; see the file COPYING. If not, write to
18 * the Free Software Foundation, 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
20 *
21 */
22
28
29// include mavlink headers, but ignore some warnings
30#pragma GCC diagnostic push
31#pragma GCC diagnostic ignored "-Waddress-of-packed-member"
32#pragma GCC diagnostic ignored "-Wswitch-default"
33#pragma GCC diagnostic ignored "-Wuninitialized"
34#include "mavlink/ardupilotmega/mavlink.h"
35#pragma GCC diagnostic pop
36
37#if PERIODIC_TELEMETRY
38#define PERIODIC_C_MAVLINK
40#include "generated/periodic_telemetry.h"
41#ifndef TELEMETRY_MAVLINK_NB_MSG
42#warning Using hardcoded msg periods. To customize specify a <process name="Mavlink" type="mavlink"> in your telemetry file.
43#endif
44#endif
45
46#include "generated/airframe.h"
47#include "generated/modules.h"
48#include "generated/settings.h"
49#include "generated/flight_plan.h"
50
51#include "mcu_periph/sys_time.h"
53#include "state.h"
54#include "pprz_version.h"
55#include "autopilot.h"
56#include "autopilot_guided.h"
57
58#if defined RADIO_CONTROL
60#endif
61
62// Change the autopilot identification code: by default identify as PPZ autopilot: alternatively as MAV_AUTOPILOT_ARDUPILOTMEGA
63#ifndef MAV_AUTOPILOT_ID
64#define MAV_AUTOPILOT_ID MAV_AUTOPILOT_PPZ
65#endif
66
68
69// for UINT16_MAX
70#include <stdint.h>
71
73
82
84
85static void mavlink_send_extended_sys_state(struct transport_tx *trans, struct link_device *dev);
86static void mavlink_send_heartbeat(struct transport_tx *trans, struct link_device *dev);
87static void mavlink_send_sys_status(struct transport_tx *trans, struct link_device *dev);
88static void mavlink_send_system_time(struct transport_tx *trans, struct link_device *dev);
89static void mavlink_send_attitude(struct transport_tx *trans, struct link_device *dev);
90static void mavlink_send_local_position_ned(struct transport_tx *trans, struct link_device *dev);
91static void mavlink_send_global_position_int(struct transport_tx *trans, struct link_device *dev);
92static void mavlink_send_params(struct transport_tx *trans, struct link_device *dev);
93static void mavlink_send_autopilot_version(struct transport_tx *trans, struct link_device *dev);
94static void mavlink_send_attitude_quaternion(struct transport_tx *trans, struct link_device *dev);
95static void mavlink_send_gps_raw_int(struct transport_tx *trans, struct link_device *dev);
96static void mavlink_send_rc_channels(struct transport_tx *trans, struct link_device *dev);
97static void mavlink_send_battery_status(struct transport_tx *trans, struct link_device *dev);
98static void mavlink_send_gps_global_origin(struct transport_tx *trans, struct link_device *dev);
99static void mavlink_send_gps_status(struct transport_tx *trans, struct link_device *dev);
100static void mavlink_send_vfr_hud(struct transport_tx *trans, struct link_device *dev);
101
102
107#ifndef MAVLINK_SYSID
108#define MAVLINK_SYSID AC_ID
109#endif
110
111#if PERIODIC_TELEMETRY && defined TELEMETRY_MAVLINK_NB_MSG
114#endif
115
116void mavlink_init(void)
117{
118 mavlink_system.sysid = MAVLINK_SYSID; // System ID, 1-255
119 mavlink_system.compid = MAV_COMP_ID_AUTOPILOT1; // Component/Subsystem ID, 1-255
120
122
124
125#if PERIODIC_TELEMETRY && defined TELEMETRY_MAVLINK_NB_MSG
141#endif
142}
143
149{
150#if PERIODIC_TELEMETRY && defined TELEMETRY_MAVLINK_NB_MSG
151 // send periodic mavlink messages as defined in the Mavlink process of the telemetry xml file
152 // transport and device not used here yet...
154#endif
155}
156
186
188{
189 int i, j;
191
192 // Go trough all the settings to search the ID
193 for (i = 0; i < NB_SETTING; i++) {
194 for (j = 0; j < 16; j++) {
195 if (mavlink_param_names[i][j] != param_id[j]) {
196 break;
197 }
198
199 if (mavlink_param_names[i][j] == '\0') {
200 settings_idx = i;
201 return settings_idx;
202 }
203 }
204
205 if (mavlink_param_names[i][j] == '\0') {
206 break;
207 }
208 }
209 return settings_idx;
210}
211
216{
219
220 // Check uplink
221 while (MAVLinkChAvailable()) {
222 char test = MAVLinkGetch();
223
224 // When we receive a message
228 }
229 }
230}
231
233{
234 switch (msg->msgid) {
237 DOWNLINK_SEND_INFO_MSG(DefaultChannel, DefaultDevice, strlen("PLAY TUNE"), "PLAY TUNE");
238 break;
239
241 break;
242
243 /* When requesting data streams say we can't send them */
247
248 mavlink_msg_data_stream_send(MAVLINK_COMM_0, cmd.req_stream_id, 0, 0);
250 break;
251 }
252
253 /* Override channels with RC */
257#if defined RADIO_CONTROL && defined RADIO_CONTROL_TYPE_DATALINK
258 uint8_t thrust = (cmd.chan3_raw - 950) * 127 / 1100;
259 int8_t roll = -(cmd.chan1_raw - 1500) * 255 / 1100 / 2;
260 int8_t pitch = -(cmd.chan2_raw - 1500) * 255 / 1100 / 2;
261 int8_t yaw = -(cmd.chan4_raw - 1500) * 255 / 1100;
262 int8_t temp_rc[4] = {roll, pitch, yaw, thrust};
264 //printf("RECEIVED: RC Channel Override for: %d/%d: throttle: %d; roll: %d; pitch: %d; yaw: %d;\r\n",
265 // cmd.target_system, cmd.target_component, thrust, roll, pitch, yaw);
266#endif
267 break;
268 }
269
270 /* When a request is made of the parameters list */
273 break;
274 }
275
276 /* When a request os made for a specific parameter */
280
281 // First check param_index and search for the ID if needed
282 if (cmd.param_index == -1) {
283 cmd.param_index = settings_idx_from_param_id(cmd.param_id);
284 }
285
286 // Send message only if the param_index was found (Coverity Scan)
287 if (cmd.param_index > -1) {
289 mavlink_param_names[cmd.param_index],
290 settings_get_value(cmd.param_index),
293 cmd.param_index);
295 }
296 break;
297 }
298
302
303 // Check if this message is for this system
304 if ((uint8_t) set.target_system == AC_ID) {
305 int16_t idx = settings_idx_from_param_id(set.param_id);
306
307 // setting found
308 if (idx >= 0) {
309 // Only write if new value is NOT "not-a-number"
310 // AND is NOT infinity
311 if (set.param_type == MAV_PARAM_TYPE_REAL32 &&
312 !isnan(set.param_value) && !isinf(set.param_value)) {
313 DlSetting(idx, set.param_value);
314 // Report back new value
320 idx);
322 }
323 }
324 }
325 }
326 break;
327
328#ifdef ROTORCRAFT_FIRMWARE
329 /* only for rotorcraft */
333 // Check if this message is for this system
334 if ((uint8_t) cmd.target_system == AC_ID) {
336 switch (cmd.command) {
337
339 case MAV_CMD_DO_SET_MODE: {
340 char error_msg[200];
341 int rc = snprintf(error_msg, 200, "Do set %d: %0.0f %0.0f (%d)", cmd.command, cmd.param1, cmd.param2, cmd.target_system);
342 if (rc > 0) {
344 }
345 result = MAV_RESULT_ACCEPTED;
346 break;
347 }
348
350 MAVLINK_DEBUG("got cmd NAV_GUIDED_ENABLE: %f\n", cmd.param1);
351 result = MAV_RESULT_FAILED;
352 if (cmd.param1 > 0.5) {
355 result = MAV_RESULT_ACCEPTED;
356 }
357 }
358 else {
359 // turn guided mode off - to what? maybe NAV? or MODE_AUTO2?
360 }
361 break;
362
364 /* supposed to use this command to arm or SET_MODE?? */
365 MAVLINK_DEBUG("got cmd COMPONENT_ARM_DISARM: %f\n", cmd.param1);
366 result = MAV_RESULT_FAILED;
367 if (cmd.param1 > 0.5) {
370 result = MAV_RESULT_ACCEPTED;
371 }
372 else {
375 result = MAV_RESULT_ACCEPTED;
376 }
377 break;
378
379 default:
380 break;
381 }
382 // confirm command with result
383 mavlink_msg_command_ack_send(MAVLINK_COMM_0, cmd.command, result, 0, UINT8_MAX, msg->sysid, msg->compid);
385 }
386 break;
387 }
388
389#ifdef WP_ML_global_target
393
394 // Check if this message is for this system
395 //if (target.target_system == AC_ID) {
396 MAVLINK_DEBUG("SET_POSITION_TARGET_GLOBAL_INT, type_mask: %d, frame: %d\n", target.type_mask, target.coordinate_frame);
397 /* if position and yaw bits are not set to ignored, use only position for now */
398 if (target.coordinate_frame == MAV_FRAME_GLOBAL || target.coordinate_frame == MAV_FRAME_GLOBAL_INT) {
399 MAVLINK_DEBUG("set position target, frame MAV_FRAME_GLOBAL %f \n", target.alt);
400 struct NedCoor_i ned;
401 //struct NedCoor_f ned_f;
402 struct LlaCoor_i lla;
403 lla.lat = target.lat_int;
404 lla.lon = target.lon_int;
405 lla.alt = MM_OF_M(target.alt);
407 if (origin == NULL) {
408 MAVLINK_DEBUG("NED origin not set, cannot set target position\n");
409 return;
410 }
412 //NED_FLOAT_OF_BFP(ned_f, ned);
413 //autopilot_guided_goto_ned(ned_f.x, ned_f.y, ned_f.z, target.yaw);
416
417 // Downlink the new waypoint
421 &lla.lat, &lla.lon, &hmsl);
422
423 }
424 break;
425 }
426#endif
427
431 if (mode.target_system == AC_ID) {
432 MAVLINK_DEBUG("got SET_MODE: base_mode:%d\n", mode.base_mode);
433 if (mode.base_mode & MAV_MODE_FLAG_SAFETY_ARMED) {
435 }
436 else {
438 }
439 if (mode.base_mode & MAV_MODE_FLAG_GUIDED_ENABLED) {
441 }
442 else if (mode.base_mode & MAV_MODE_FLAG_AUTO_ENABLED) {
444 }
445 }
446 break;
447 }
448
452 // Check if this message is for this system
453 if (target.target_system == AC_ID) {
454 MAVLINK_DEBUG("SET_POSITION_TARGET_LOCAL_NED, byte_mask: %d\n", target.type_mask);
455 /* if position and yaw bits are not set to ignored, use only position for now */
456 if (!(target.type_mask & 0b1110000000100000)) {
457 switch (target.coordinate_frame) {
459 MAVLINK_DEBUG("set position target, frame LOCAL_NED\n");
461 break;
463 MAVLINK_DEBUG("set position target, frame LOCAL_OFFSET_NED\n");
465 break;
467 MAVLINK_DEBUG("set position target, frame BODY_OFFSET_NED\n");
469 break;
470 default:
471 break;
472 }
473 }
474 else if (!(target.type_mask & 0b0001110000100000)) {
475 /* position is set to ignore, but velocity not */
476 switch (target.coordinate_frame) {
478 MAVLINK_DEBUG("set velocity target, frame LOCAL_NED\n");
480 break;
481 default:
482 break;
483 }
484 }
485 }
486 break;
487 }
488#endif
489
490 default:
491 //Do nothing
492 MAVLINK_DEBUG("Received message with id: %d\r\n", msg->msgid);
493 break;
494 }
495}
496
497/* ignore the unused-parameter warnings */
498#pragma GCC diagnostic push
499#pragma GCC diagnostic ignored "-Wunused-parameter"
500
504static void mavlink_send_heartbeat(struct transport_tx *trans, struct link_device *dev)
505{
507 uint8_t mav_mode = MAV_MODE_FLAG_CUSTOM_MODE_ENABLED; // Ardupilot custom mode enabled
508 uint32_t custom_mode = 0;
509#if defined(FIXEDWING_FIRMWARE)
511 switch (autopilot_get_mode()) {
512 case AP_MODE_MANUAL:
514 break;
515 case AP_MODE_AUTO1:
517 break;
518 case AP_MODE_AUTO2:
520 break;
521 case AP_MODE_HOME:
523 break;
524 default:
525 break;
526 }
527#elif defined(ROTORCRAFT_FIRMWARE)
529 switch (autopilot_get_mode()) {
530 case AP_MODE_HOME:
532 break;
538 break;
548 break;
549 case AP_MODE_NAV:
551 custom_mode = PLANE_MODE_GUIDED;
552 break;
553 case AP_MODE_GUIDED:
555 custom_mode = PLANE_MODE_GUIDED;
556 default:
557 break;
558 }
559#else
560#error "mavlink datalink: unsupported firmware"
561#endif
562 if (stateIsAttitudeValid()) {
565 } else {
568 }
569 }
571 mav_type,
573 mav_mode,
574 custom_mode,
575 mav_state);
577}
578
579/*
580 * Send extended system state
581*/
587
591static void mavlink_send_sys_status(struct transport_tx *trans, struct link_device *dev)
592{
594#define UAV_SENSORS (MAV_SYS_STATUS_SENSOR_3D_GYRO|MAV_SYS_STATUS_SENSOR_3D_ACCEL|MAV_SYS_STATUS_SENSOR_3D_MAG|MAV_SYS_STATUS_SENSOR_ABSOLUTE_PRESSURE)
595
597 UAV_SENSORS, // On-board sensors: present (bitmap)
598 UAV_SENSORS, // On-board sensors: active (bitmap)
599 UAV_SENSORS, // On-board sensors: state (bitmap)
600 -1,//10*sys_mon.cpu_load, // System loadof main-loop time (0=0% to 1000=100%)
601 electrical.vsupply * 1000.f, // Battery voltage (milivolts)
602 electrical.current * 100.f, // Battery current (10x miliampere)
603 -1, // Battery remaining (0-100 in %)
604 0, // Communication packet drops (0=0% to 10000=100%)
605 0, // Communication error(per packet) (0=0% to 10000=100%)
606 0, // Autopilot specific error 1
607 0, // Autopilot specific error 2
608 0, // Autopilot specific error 3
609 0, // Autopilot specific error 4
610 0,
611 0,
612 0);
614}
615
626
630static void mavlink_send_attitude(struct transport_tx *trans, struct link_device *dev)
631{
634 stateGetNedToBodyEulers_f()->phi, // Phi
635 stateGetNedToBodyEulers_f()->theta, // Theta
636 stateGetNedToBodyEulers_f()->psi, // Psi
637 stateGetBodyRates_f()->p, // p
638 stateGetBodyRates_f()->q, // q
639 stateGetBodyRates_f()->r); // r
641}
642
655
683
695
715
717{
720 static uint64_t sha;
723 18446744073709551615U, //uint64_t capabilities,
724 ver, //uint32_t flight_sw_version,
725 0, //uint32_t middleware_sw_version,
726 0, //uint32_t os_sw_version,
727 0, //uint32_t board_version,
728 0, //const uint8_t *flight_custom_version,
729 0, //const uint8_t *middleware_custom_version,
730 0, //const uint8_t *os_custom_version,
731 0, //uint16_t vendor_id,
732 0, //uint16_t product_id,
733 sha, //uint64_t uid
734 0);
736}
737
753
754#if USE_GPS
755#include "modules/gps/gps.h"
756#endif
757
758static void mavlink_send_gps_raw_int(struct transport_tx *trans, struct link_device *dev)
759{
760#if USE_GPS
762 if (course < 0) {
763 course += 36000;
764 }
767 gps.fix,
770 gps.hmsl,
771 gps.pdop,
772 UINT16_MAX, // VDOP
773 gps.gspeed,
774 course,
775 gps.num_sv,
777 gps.hacc,
778 gps.vacc,
779 gps.sacc,
780 0,
781 0);
783#endif
784}
785
796static void mavlink_send_gps_status(struct transport_tx *trans, struct link_device *dev)
797{
798#if USE_GPS
800 uint8_t prn[20];
801 uint8_t used[20];
802 uint8_t elevation[20];
803 uint8_t azimuth[20];
804 uint8_t snr[20];
805 for (uint8_t i = 0; i < nb_sats; i++) {
806 prn[i] = gps.svinfos[i].svid;
807 // set sat as used if cno > 0, not quite true though
808 if (gps.svinfos[i].cno > 0) {
809 used[i] = 1;
810 }
811 elevation[i] = gps.svinfos[i].elev;
812 // convert azimuth to unsigned representation: 0: 0 deg, 255: 360 deg.
813 uint8_t azim;
814 if (gps.svinfos[i].azim < 0) {
815 azim = (float)(-gps.svinfos[i].azim + 180) / 360 * 255;
816 } else {
817 azim = (float)gps.svinfos[i].azim / 360 * 255;
818 }
819 azimuth[i] = azim;
820 }
822 gps.num_sv, prn, used, elevation, azimuth, snr);
824#endif
825}
826
827#if defined RADIO_CONTROL
829// since they really want PPM values, use a hack to check if are using ppm subsystem
830#ifdef PPM_PULSE_TYPE_POSITIVE
831#define RC_CHANNELS RADIO_CTL_NB
833#define PPM_PULSES(_i) ((_i) < RADIO_CTL_NB ? ppm_pulses[(_i)] : UINT16_MAX)
834#else
835// use radio_control.values for now...
836#define RC_CHANNELS RADIO_CONTROL_NB_CHANNEL
837#define PPM_OF_PPRZ(_v) ((_v) / 19.2 + 1500)
838#define PPM_PULSES(_i) ((_i) < RADIO_CONTROL_NB_CHANNEL ? PPM_OF_PPRZ(radio_control.values[(_i)]) + MAX_PPRZ : UINT16_MAX)
839#endif
840#endif
841
842static void mavlink_send_rc_channels(struct transport_tx *trans, struct link_device *dev)
843{
844#if defined RADIO_CONTROL
851 PPM_PULSES(9), PPM_PULSES(10), PPM_PULSES(11),
852 PPM_PULSES(12), PPM_PULSES(13), PPM_PULSES(14),
853 PPM_PULSES(15), PPM_PULSES(16), PPM_PULSES(17),
854 255); // rssi unknown
855#else
858 0, // zero channels available
863 UINT16_MAX, UINT16_MAX, 255);
864#endif
866}
867
869static void mavlink_send_battery_status(struct transport_tx *trans, struct link_device *dev)
870{
871 static uint16_t voltages[14] = {0};
872 // we simply only set one cell for now
873 voltages[0] = electrical.vsupply * 1000.f; // convert to mV
876 0, // id
877 0, // battery_function
878 0, // type
879 INT16_MAX, // unknown temperature
880 voltages, // cell voltages
881 electrical.current * 100.f, // convert to deciA
882 electrical.charge * 1000.f, // convert to mAh
883 electrical.energy * 36, // convert to hecto Joule
884 -1, // remaining percentage not estimated
885 0,
887 &voltages[10],
889 0);
891}
892
897static void mavlink_send_vfr_hud(struct transport_tx *trans, struct link_device *dev)
898{
899 /* Current heading in degrees, in compass units (0..360, 0=north) */
901 /* Current throttle setting in integer percent, 0 to 100 */
902 // is a 16bit unsigned int but supposed to be from 0 to 100??
903 uint16_t throttle;
904#ifdef COMMAND_THRUST
905 throttle = commands[COMMAND_THRUST] / (MAX_PPRZ / 100);
906#elif defined COMMAND_THROTTLE
907 throttle = commands[COMMAND_THROTTLE] / (MAX_PPRZ / 100);
908#endif
912 stateGetHorizontalSpeedNorm_f(), // groundspeed
913 heading,
914 throttle,
916 stateGetSpeedNed_f()->z); // climb rate
918}
919
920/* end ignore unused-paramter */
921#pragma GCC diagnostic pop
static int16_t course[3]
bool autopilot_set_mode(uint8_t new_autopilot_mode)
set autopilot mode
Definition autopilot.c:193
uint8_t autopilot_get_mode(void)
get autopilot mode
Definition autopilot.c:222
bool autopilot_set_motors_on(bool motors_on)
turn motors on/off, eventually depending of the current mode set kill_throttle accordingly FIXME is i...
Definition autopilot.c:250
bool autopilot_get_motors_on(void)
get motors status
Definition autopilot.c:295
bool autopilot_in_flight(void)
get in_flight flag
Definition autopilot.c:340
bool autopilot_throttle_killed(void)
get kill status
Definition autopilot.c:313
Core autopilot interface common to all firmwares.
bool autopilot_guided_move_ned(float vx, float vy, float vz, float heading)
Set velocity and heading setpoints in GUIDED mode.
bool autopilot_guided_goto_ned_relative(float dx, float dy, float dz, float dyaw)
Set position and heading setpoints wrt.
bool autopilot_guided_goto_body_relative(float dx, float dy, float dz, float dyaw)
Set position and heading setpoints wrt.
bool autopilot_guided_goto_ned(float x, float y, float z, float heading)
Set position and heading setpoints in GUIDED mode.
Autopilot guided mode interface.
static uint8_t status
uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
uint32_t get_sys_time_msec(void)
Get the time in milliseconds since startup.
Hardware independent code for commands handling.
struct Electrical electrical
Definition electrical.c:92
Interface for electrical status: supply voltage, current, battery status, etc.
float energy
consumed energy in Wh
Definition electrical.h:49
float current
current in A
Definition electrical.h:47
float charge
consumed electric charge in Ah
Definition electrical.h:48
float vsupply
supply voltage in V
Definition electrical.h:45
#define Min(x, y)
Definition esc_dshot.c:109
#define AP_MODE_HOME
#define AP_MODE_MANUAL
AP modes.
#define AP_MODE_AUTO2
#define AP_MODE_AUTO1
struct GpsState gps
global GPS state
Definition gps.c:74
Device independent GPS code (interface)
int16_t azim
azimuth in deg
Definition gps.h:83
int32_t hmsl
height above mean sea level (MSL) in mm
Definition gps.h:94
int8_t elev
elevation in deg
Definition gps.h:82
struct LlaCoor_i lla_pos
position in LLA (lat,lon: deg*1e7; alt: mm over ellipsoid)
Definition gps.h:92
uint32_t sacc
speed accuracy in cm/s
Definition gps.h:103
int32_t course
GPS course over ground in rad*1e7, [0, 2*Pi]*1e7 (CW/north)
Definition gps.h:99
uint8_t cno
Carrier to Noise Ratio (Signal Strength) in dbHz.
Definition gps.h:81
uint32_t hacc
horizontal accuracy in cm
Definition gps.h:101
#define GPS_NB_CHANNELS
Definition gps.h:57
uint16_t pdop
position dilution of precision scaled by 100
Definition gps.h:105
uint8_t svid
Satellite ID.
Definition gps.h:78
uint16_t gspeed
norm of 2d ground speed in cm/s
Definition gps.h:97
uint32_t vacc
vertical accuracy in cm
Definition gps.h:102
struct SVinfo svinfos[GPS_NB_CHANNELS]
holds information from the Space Vehicles (Satellites)
Definition gps.h:112
uint8_t num_sv
number of sat in fix
Definition gps.h:106
uint8_t fix
status of fix
Definition gps.h:107
int32_t lat
in degrees*1e7
int32_t hmsl
Height above mean sea level in mm.
int32_t alt
in millimeters above WGS84 reference ellipsoid
struct LlaCoor_i lla
Reference point in lla.
int32_t lon
in degrees*1e7
void ned_of_lla_point_i(struct NedCoor_i *ned, struct LtpDef_i *def, struct LlaCoor_i *lla)
Convert a point from LLA to local NED.
#define MM_OF_M(_m)
vector in Latitude, Longitude and Altitude
definition of the local (flat earth) coordinate system
vector in North East Down coordinates
static bool stateIsAttitudeValid(void)
Test if attitudes are valid.
Definition state.h:1224
static struct FloatEulers * stateGetNedToBodyEulers_f(void)
Get vehicle body attitude euler angles (float).
Definition state.h:1306
static struct FloatQuat * stateGetNedToBodyQuat_f(void)
Get vehicle body attitude quaternion (float).
Definition state.h:1294
struct State state
Definition state.c:36
static struct LlaCoor_f * stateGetPositionLla_f(void)
Get position in LLA coordinates (float).
Definition state.h:857
static struct LlaCoor_i * stateGetPositionLla_i(void)
Get position in LLA coordinates (int).
Definition state.h:812
bool ned_initialized_i
true if local int coordinate frame is initialsed
Definition state.h:199
int32_t stateGetHmslOrigin_i(void)
Get the HMSL of the frame origin (int)
Definition state.c:190
float stateGetHmslOrigin_f(void)
Get the HMSL of the frame origin (float)
Definition state.c:204
struct LlaCoor_i stateGetLlaOrigin_i(void)
Get the LLA position of the frame origin (int)
Definition state.c:124
struct LlaCoor_f stateGetLlaOrigin_f(void)
Get the LLA position of the frame origin (float)
Definition state.c:143
static struct LtpDef_i * stateGetNedOrigin_i(void)
Get the coordinate NED frame origin (int)
Definition state.h:556
static struct NedCoor_f * stateGetPositionNed_f(void)
Get position in local NED coordinates (float).
Definition state.h:839
static struct FloatRates * stateGetBodyRates_f(void)
Get vehicle body angular rate (float).
Definition state.h:1367
static float stateGetHorizontalSpeedNorm_f(void)
Get norm of horizontal ground speed (float).
Definition state.h:1076
static struct NedCoor_f * stateGetSpeedNed_f(void)
Get ground speed in local NED coordinates (float).
Definition state.h:1049
static float stateGetAirspeed_f(void)
Get airspeed (float).
Definition state.h:1590
static char origin[GSM_ORIGIN_MAXLEN]
Definition gsm.c:101
uint8_t msg[10]
Buffer used for general comunication over SPI (out buffer)
static float p[2][2]
uint16_t foo
Definition main_demo5.c:58
void mavlink_mission_init(mavlink_mission_mgr *mgr)
void mavlink_mission_message_handler(const mavlink_message_t *msg)
void mavlink_mission_periodic(void)
update current block and send if changed
Common functions used within the mission library, blocks and waypoints cannot be send simultaneously ...
void waypoint_set_latlon(uint8_t wp_id, struct LlaCoor_i *lla)
set waypoint latitude/longitude without updating altitude
Definition waypoints.c:273
void waypoint_set_alt(uint8_t wp_id, float alt)
Set altitude of waypoint in meters (above reference)
Definition waypoints.c:233
static uint32_t idx
#define MAX_PPRZ
Definition paparazzi.h:8
float alt
in meters (normally above WGS84 reference ellipsoid)
Generic interface for radio control modules.
#define AP_MODE_HOVER_DIRECT
#define AP_MODE_RATE_DIRECT
#define AP_MODE_RATE_RC_CLIMB
#define AP_MODE_HOVER_CLIMB
#define AP_MODE_HOVER_Z_HOLD
#define AP_MODE_RC_DIRECT
#define AP_MODE_ATTITUDE_DIRECT
#define AP_MODE_ATTITUDE_CLIMB
#define AP_MODE_NAV
#define AP_MODE_GUIDED
#define AP_MODE_ATTITUDE_Z_HOLD
#define AP_MODE_ATTITUDE_RC_CLIMB
#define AP_MODE_RATE_Z_HOLD
#define AP_MODE_CARE_FREE_DIRECT
static const ShellCommand commands[]
Definition shell_arch.c:78
static uint8_t mode
mode holds the current sonar mode mode = 0 used at high altitude, uses 16 wave patterns mode = 1 used...
Definition sonar_bebop.c:65
API to get/set the generic vehicle states.
#define TRUE
Definition std.h:4
#define FALSE
Definition std.h:5
static const struct usb_device_descriptor dev
Definition usb_ser_hw.c:74
Architecture independent timing functions.
struct target_t target
Definition target_pos.c:65
int16_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint16_t _id, telemetry_cb _cb)
Register a telemetry callback function.
Definition telemetry.c:51
Common tools for periodic telemetry interface Allows subsystem to register callback functions.
Periodic telemetry structure.
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
int int32_t
Typedef defining 32 bit int type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
short int16_t
Typedef defining 16 bit short type.
unsigned long long uint64_t
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
signed char int8_t
Typedef defining 8 bit char type.
float heading
Definition wedgebug.c:258