8 #include <Ivy/ivyglibloop.h>
10 #include "generated/airframe.h"
25 #include NPS_SENSORS_PARAMS
28 static void on_WORLD_ENV(IvyClientPtr app __attribute__((unused)),
29 void *user_data __attribute__((unused)),
30 int argc __attribute__((unused)),
char *argv[]);
33 static void on_DL_SETTING(IvyClientPtr app __attribute__((unused)),
34 void *user_data __attribute__((unused)),
35 int argc __attribute__((unused)),
char *argv[]);
39 const char *agent_name = AIRFRAME_NAME
"_NPS";
40 const char *ready_msg = AIRFRAME_NAME
"_NPS Ready";
41 IvyInit(agent_name, ready_msg, NULL, NULL, NULL, NULL);
44 IvyBindMsg(
on_WORLD_ENV, NULL,
"^(\\S*) WORLD_ENV (\\S*) (\\S*) (\\S*) (\\S*) (\\S*) (\\S*)");
47 IvyBindMsg(
on_DL_SETTING, NULL,
"^(\\S*) DL_SETTING (\\S*) (\\S*) (\\S*)");
50 const char *default_ivy_bus =
"224.255.255.255";
52 const char *default_ivy_bus =
"127.255.255.255";
54 if (ivy_bus == NULL) {
55 IvyStart(default_ivy_bus);
66 void *user_data __attribute__((unused)),
67 int argc __attribute__((unused)),
char *argv[])
71 wind.
x = atof(argv[1]);
72 wind.
y = atof(argv[2]);
73 wind.
z = atof(argv[3]);
100 IvyUnbindMsg(ivyPtr);
104 int pid = (int)getpid();
106 ivyPtr = IvyBindMsg(
on_WORLD_ENV, NULL,
"^%d_%d (\\S*) WORLD_ENV (\\S*) (\\S*) (\\S*) (\\S*) (\\S*) (\\S*)", pid, seq);
108 IvySendMsg(
"nps %d_%d WORLD_ENV_REQ %f %f %f %f %f %f",
120 #include "generated/settings.h"
121 #include "pprzlink/dl_protocol.h"
124 void *user_data __attribute__((unused)),
125 int argc __attribute__((unused)),
char *argv[])
127 if (atoi(argv[1]) != AC_ID) {
138 float value = atof(argv[3]);
139 DlSetting(index, value);
141 printf(
"setting %d %f\n", index, value);
146 IvySendMsg(
"%d NPS_RATE_ATTITUDE %f %f %f %f %f %f",
154 IvySendMsg(
"%d NPS_POS_LLH %f %f %f %f %f %f %f %f %f",
165 IvySendMsg(
"%d NPS_SPEED_POS %f %f %f %f %f %f %f %f %f",
176 IvySendMsg(
"%d NPS_GYRO_BIAS %f %f %f",
186 IvySendMsg(
"%d NPS_SENSORS_SCALED %f %f %f %f %f %f",
195 IvySendMsg(
"%d NPS_WIND %f %f %f",
void nps_atmosphere_set_wind_ned(double wind_north, double wind_east, double wind_down)
struct NpsSensorAccel accel
struct NedCoor_d ltpprz_ecef_accel
accel in ltppprz frame, wrt ECEF frame
struct DoubleVect3 bias_initial
struct LlaCoor_d lla_pos_geoc
struct DoubleRates body_ecef_rotvel
struct NpsFdm fdm
Holds all necessary NPS FDM state information.
void nps_ivy_init(char *ivy_bus)
double alt
in meters above WGS84 reference ellipsoid
void nps_ivy_display(void)
struct NpsSensorGyro gyro
struct LlaCoor_d lla_pos_pprz
struct DoubleEulers ltp_to_body_eulers
struct NedCoor_d ltpprz_pos
Paparazzi floating point algebra.
void double_quat_vmult(struct DoubleVect3 *v_out, struct DoubleQuat *q, struct DoubleVect3 *v_in)
Device independent GPS code (interface)
struct DoubleVect3 wind
velocity in m/s in NED
void nps_ivy_send_WORLD_ENV_REQ(void)
struct LlaCoor_d lla_pos_geod
struct NpsSensors sensors
#define RATE_FLOAT_OF_BFP(_ai)
void nps_set_time_factor(float time_factor)
#define DefaultChannel
SITL.
struct DoubleVect3 bias_random_walk_value
struct DoubleVect3 neutral
Common code for AP and FBW telemetry.
static void on_WORLD_ENV(IvyClientPtr app, void *user_data, int argc, char *argv[])
Paparazzi double precision floating point algebra.
struct NedCoor_d ltpprz_ecef_vel
velocity in ltppprz frame, wrt ECEF frame
Atmosphere model (pressure, wind) for NPS.
struct DoubleQuat ltp_to_body_quat
static void on_DL_SETTING(IvyClientPtr app, void *user_data, int argc, char *argv[])