Paparazzi UAS  v4.0.4_stable-3-gf39211a
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
jsbsim_transport.c
Go to the documentation of this file.
1 /* Datalink parsing functions */
2 
3 #include "jsbsim_hw.h"
4 
6 
7 #include <stdlib.h>
8 
9 #define MOfCm(_x) (((float)(_x))/100.)
10 
11 void parse_dl_ping(char* argv[] __attribute__ ((unused))) {
12  DOWNLINK_SEND_PONG(DefaultChannel, DefaultDevice);
13 }
14 
15 void parse_dl_acinfo(char* argv[] __attribute__ ((unused))) {
16 #ifdef TRAFFIC_INFO
17  uint8_t id = atoi(argv[8]);
18  float ux = MOfCm(atoi(argv[2]));
19  float uy = MOfCm(atoi(argv[3]));
20  float a = MOfCm(atoi(argv[4]));
21  float c = RadOfDeg(((float)atoi(argv[1]))/ 10.);
22  float s = MOfCm(atoi(argv[6]));
23  float cl = MOfCm(atoi(argv[7]));
24  uint32_t t = atoi(argv[5]);
25  SetAcInfo(id, ux, uy, c, a, s, cl, t);
26 #endif
27 }
28 
29 void parse_dl_setting(char* argv[]) {
30  uint8_t index = atoi(argv[2]);
31  float value = atof(argv[3]);
32  DlSetting(index, value);
33  DOWNLINK_SEND_DL_VALUE(DefaultChannel, DefaultDevice,&index, &value);
34 }
35 
36 void parse_dl_get_setting(char* argv[]) {
37  uint8_t index = atoi(argv[2]);
38  float value = settings_get_value(index);
39  DOWNLINK_SEND_DL_VALUE(DefaultChannel, DefaultDevice,&index, &value);
40 }
41 
42 void parse_dl_block(char* argv[]) {
43  int block = atoi(argv[1]);
44  nav_goto_block(block);
45 }
46 
47 void parse_dl_move_wp(char* argv[]) {
48  uint8_t wp_id = atoi(argv[1]);
49  float a = MOfCm(atoi(argv[5]));
50 
51  /* Computes from (lat, long) in the referenced UTM zone */
52  struct LlaCoor_f lla;
53  lla.lat = RadOfDeg((float)(DL_MOVE_WP_lat(dl_buffer) / 1e7));
54  lla.lon = RadOfDeg((float)(DL_MOVE_WP_lon(dl_buffer) / 1e7));
55  struct UtmCoor_f utm;
56  utm.zone = nav_utm_zone0;
57  utm_of_lla_f(&utm, &lla);
58  nav_move_waypoint(wp_id, utm.east, utm.north, a);
59 
60  /* Waypoint range is limited. Computes the UTM pos back from the relative
61  coordinates */
62  utm.east = waypoints[wp_id].x + nav_utm_east0;
63  utm.north = waypoints[wp_id].y + nav_utm_north0;
64  DOWNLINK_SEND_WP_MOVED(DefaultChannel, DefaultDevice, &wp_id, &utm.east, &utm.north, &a, &nav_utm_zone0);
65 }
66 
void parse_dl_move_wp(char *argv[])
uint8_t nav_utm_zone0
Definition: common_nav.c:43
float lat
in radians
vector in Latitude, Longitude and Altitude
void parse_dl_setting(char *argv[])
Paparazzi floating point math for geodetic calculations.
uint8_t zone
UTM zone number.
int32_t nav_utm_north0
Definition: common_nav.c:42
float north
in meters
void parse_dl_ping(char *argv[] __attribute__((unused)))
position in UTM coordinates Units: meters
unsigned long uint32_t
Definition: types.h:18
void parse_dl_get_setting(char *argv[])
#define SetAcInfo(_id, _utm_x, _utm_y, _course, _alt, _gspeed, _climb, _itow)
Definition: traffic_info.h:52
unsigned char uint8_t
Definition: types.h:14
int32_t nav_utm_east0
Definition: common_nav.c:41
#define MOfCm(_x)
void parse_dl_acinfo(char *argv[] __attribute__((unused)))
float lon
in radians
static struct point c
Definition: discsurvey.c:13
float east
in meters
void nav_goto_block(uint8_t b)
__attribute__((always_inline))
Definition: i2c_arch.c:35
void parse_dl_block(char *argv[])
void utm_of_lla_f(struct UtmCoor_f *utm, struct LlaCoor_f *lla)