9 #include <Ivy/ivyloop.h>
12 #include "generated/airframe.h"
21 #include "generated/settings.h"
22 #include "pprzlink/dl_protocol.h"
29 #include NPS_SENSORS_PARAMS
38 static void on_WORLD_ENV(IvyClientPtr app __attribute__((unused)),
39 void *user_data __attribute__((unused)),
40 int argc __attribute__((unused)),
char *argv[]);
43 static void on_DL_SETTING(IvyClientPtr app __attribute__((unused)),
44 void *user_data __attribute__((unused)),
45 int argc __attribute__((unused)),
char *argv[]);
61 const char *agent_name = AIRFRAME_NAME
"_NPS";
62 const char *ready_msg = AIRFRAME_NAME
"_NPS Ready";
63 IvyInit(agent_name, ready_msg, NULL, NULL, NULL, NULL);
66 IvyBindMsg(
on_WORLD_ENV, NULL,
"^(\\S*) WORLD_ENV (\\S*) (\\S*) (\\S*) (\\S*) (\\S*) (\\S*)");
69 IvyBindMsg(
on_DL_SETTING, NULL,
"^(\\S*) DL_SETTING (\\S*) (\\S*) (\\S*)");
72 const char *default_ivy_bus =
"224.255.255.255";
74 const char *default_ivy_bus =
"127.255.255.255";
76 if (ivy_bus == NULL) {
77 IvyStart(default_ivy_bus);
96 void *user_data __attribute__((unused)),
97 int argc __attribute__((unused)),
char *argv[])
101 wind.
x = atof(argv[1]);
102 wind.
y = atof(argv[2]);
103 wind.
z = atof(argv[3]);
133 int pid = (int)getpid();
136 ivyPtr = IvyBindMsg(
on_WORLD_ENV, NULL,
"^%d_%d (\\S*) WORLD_ENV (\\S*) (\\S*) (\\S*) (\\S*) (\\S*) (\\S*)", pid,
seq);
140 memcpy(&fdm_ivy, &
fdm,
sizeof(
struct NpsFdm));
142 IvySendMsg(
"nps %d_%d WORLD_ENV_REQ %f %f %f %f %f %f",
157 static const char ap_launch[] =
"aut_lau";
158 char *ap_settings[NB_SETTING] = SETTINGS_NAMES_SHORT;
163 if (strcmp(ap_settings[
idx],ap_launch) == 0) {
171 void *user_data __attribute__((unused)),
172 int argc __attribute__((unused)),
char *argv[])
174 if (atoi(argv[1]) != AC_ID) {
184 float value = atof(argv[3]);
185 DlSetting(index, value);
187 printf(
"setting %d %f\n", index, value);
207 memcpy (&fdm_ivy, fdm_data,
sizeof(
struct NpsFdm));
210 memcpy (&sensors_ivy, sensors_data,
sizeof(
struct NpsSensors));
212 IvySendMsg(
"%d NPS_RATE_ATTITUDE %f %f %f %f %f %f",
220 IvySendMsg(
"%d NPS_POS_LLH %f %f %f %f %f %f %f %f %f",
231 IvySendMsg(
"%d NPS_SPEED_POS %f %f %f %f %f %f %f %f %f",
242 IvySendMsg(
"%d NPS_GYRO_BIAS %f %f %f",
252 IvySendMsg(
"%d NPS_SENSORS_SCALED %f %f %f %f %f %f",
261 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
struct NpsSensorGyro gyro
struct LlaCoor_d lla_pos_pprz
static int ap_launch_index
struct DoubleEulers ltp_to_body_eulers
void nps_update_launch_from_dl(uint8_t value)
struct NedCoor_d ltpprz_pos
Paparazzi floating point algebra.
bool nps_ivy_send_world_env
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)
void nps_ivy_display(struct NpsFdm *fdm_data, struct NpsSensors *sensors_data)
struct LlaCoor_d lla_pos_geod
void nps_set_time_factor(float time_factor)
#define RATE_FLOAT_OF_BFP(_ai)
struct DoubleVect3 bias_random_walk_value
struct DoubleVect3 neutral
Common code for AP and FBW telemetry.
int find_launch_index(void)
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
void * ivy_main_loop(void *data)
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[])