26 #include "generated/airframe.h"
29 #include "nps_sensors_params_common.h"
30 #if USE_BATTERY_MONITOR
64 {NPS_GYRO_SENSITIVITY_PP_NUM, NPS_GYRO_SENSITIVITY_QQ_NUM, NPS_GYRO_SENSITIVITY_RR_NUM},
65 {NPS_GYRO_SENSITIVITY_PP_DEN, NPS_GYRO_SENSITIVITY_QQ_DEN, NPS_GYRO_SENSITIVITY_RR_DEN}
68 NPS_GYRO_NEUTRAL_P, NPS_GYRO_NEUTRAL_Q, NPS_GYRO_NEUTRAL_R
71 {NPS_ACCEL_SENSITIVITY_XX_NUM, NPS_ACCEL_SENSITIVITY_YY_NUM, NPS_ACCEL_SENSITIVITY_ZZ_NUM},
72 {NPS_ACCEL_SENSITIVITY_XX_DEN, NPS_ACCEL_SENSITIVITY_YY_DEN, NPS_ACCEL_SENSITIVITY_ZZ_DEN}
75 NPS_ACCEL_NEUTRAL_X, NPS_ACCEL_NEUTRAL_Y, NPS_ACCEL_NEUTRAL_Z
78 {NPS_MAG_SENSITIVITY_XX_NUM, NPS_MAG_SENSITIVITY_YY_NUM, NPS_MAG_SENSITIVITY_ZZ_NUM},
79 {NPS_MAG_SENSITIVITY_XX_DEN, NPS_MAG_SENSITIVITY_YY_DEN, NPS_MAG_SENSITIVITY_ZZ_DEN}
82 NPS_MAG_NEUTRAL_X, NPS_MAG_NEUTRAL_Y, NPS_MAG_NEUTRAL_Z
90 #if USE_BATTERY_MONITOR
102 if (DL_HITL_IMU_ac_id(buf) != AC_ID) {
107 NPS_GYRO_SIGN_P * DL_HITL_IMU_gp(buf),
108 NPS_GYRO_SIGN_Q * DL_HITL_IMU_gq(buf),
109 NPS_GYRO_SIGN_R * DL_HITL_IMU_gr(buf));
111 NPS_ACCEL_SIGN_X * DL_HITL_IMU_ax(buf),
112 NPS_ACCEL_SIGN_Y * DL_HITL_IMU_ay(buf),
113 NPS_ACCEL_SIGN_Z * DL_HITL_IMU_az(buf));
115 NPS_MAG_SIGN_X * DL_HITL_IMU_mx(buf),
116 NPS_MAG_SIGN_Y * DL_HITL_IMU_my(buf),
117 NPS_MAG_SIGN_Z * DL_HITL_IMU_mz(buf));
126 if (DL_HITL_GPS_ac_id(buf) != AC_ID) {
160 gps_hitl.
speed_3d = sqrtf(ned_vel_f.
x * ned_vel_f.
x + ned_vel_f.
y * ned_vel_f.
y + ned_vel_f.
z * ned_vel_f.
z) * 100;
192 if (DL_HITL_AIR_DATA_ac_id(buf) != AC_ID) {
196 uint8_t flag = DL_HITL_AIR_DATA_update_flag(buf);
197 if (bit_is_set(flag, 0)) {
199 float pressure = DL_HITL_AIR_DATA_baro(buf);
202 if (bit_is_set(flag, 1)) {
205 if (bit_is_set(flag, 2) || bit_is_set(flag, 3)) {
206 uint8_t incidence_flag = (flag >> 2) & (0x3);
207 float aoa = DL_HITL_AIR_DATA_aoa(buf);
208 float sideslip = DL_HITL_AIR_DATA_sideslip(buf);
Main include for ABI (AirBorneInterface).
#define BARO_SIM_SENDER_ID
uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
Handling of messages coming from ground and other A/Cs.
static void DlCheckAndParse(struct link_device *dev, struct transport_tx *trans, uint8_t *buf, bool *msg_available, bool update_dl)
Check for new message and parse.
struct Electrical electrical
Interface for electrical status: supply voltage, current, battery status, etc.
float vsupply
supply voltage in V
Device independent GPS code (interface)
uint32_t tow
GPS time of week in ms.
int32_t hmsl
height above mean sea level (MSL) in mm
struct LlaCoor_i lla_pos
position in LLA (lat,lon: deg*1e7; alt: mm over ellipsoid)
uint32_t sacc
speed accuracy in cm/s
int32_t course
GPS course over ground in rad*1e7, [0, 2*Pi]*1e7 (CW/north)
#define GPS_VALID_VEL_ECEF_BIT
#define GPS_VALID_VEL_NED_BIT
uint32_t hacc
horizontal accuracy in cm
#define GPS_VALID_POS_LLA_BIT
uint32_t last_3dfix_ticks
cpu time ticks at last valid 3D fix
struct EcefCoor_i ecef_vel
speed ECEF in cm/s
uint16_t pdop
position dilution of precision scaled by 100
#define GPS_FIX_NONE
No GPS fix.
#define GPS_VALID_HMSL_BIT
struct NedCoor_i ned_vel
speed NED in cm/s
uint32_t last_msg_time
cpu time in sec at last received GPS message
uint32_t last_3dfix_time
cpu time in sec at last valid 3D fix
uint32_t pacc
position accuracy in cm
uint16_t gspeed
norm of 2d ground speed in cm/s
uint8_t valid_fields
bitfield indicating valid fields (GPS_VALID_x_BIT)
uint32_t vacc
vertical accuracy in cm
#define GPS_FIX_3D
3D GPS fix
uint16_t speed_3d
norm of 3d speed in cm/s
#define GPS_VALID_COURSE_BIT
uint32_t last_msg_ticks
cpu time ticks at last received GPS message
uint8_t num_sv
number of sat in fix
data structure for GPS information
#define RATES_ASSIGN(_ra, _p, _q, _r)
#define VECT3_ASSIGN(_a, _x, _y, _z)
int32_t lat
in degrees*1e7
int32_t alt
in millimeters above WGS84 reference ellipsoid
int32_t lon
in degrees*1e7
void ned_of_ecef_vect_i(struct NedCoor_i *ned, struct LtpDef_i *def, struct EcefCoor_i *ecef)
Rotate a vector from ECEF to NED.
#define VECT3_FLOAT_OF_CM(_o, _i)
void ltp_def_from_lla_i(struct LtpDef_i *def, struct LlaCoor_i *lla)
definition of the local (flat earth) coordinate system
vector in North East Down coordinates
void imu_set_defaults_mag(uint8_t abi_id, const struct Int32RMat *imu_to_sensor, const struct Int32Vect3 *neutral, const struct Int32Vect3 *scale)
Set the defaults for a mag sensor WARNING: Should be called before sensor is publishing messages to e...
void imu_set_defaults_accel(uint8_t abi_id, const struct Int32RMat *imu_to_sensor, const struct Int32Vect3 *neutral, const struct Int32Vect3 *scale)
Set the defaults for a accel sensor WARNING: Should be called before sensor is publishing messages to...
void imu_set_defaults_gyro(uint8_t abi_id, const struct Int32RMat *imu_to_sensor, const struct Int32Rates *neutral, const struct Int32Rates *scale)
Set the defaults for a gyro sensor WARNING: Should be called before sensor is publishing messages to ...
Inertial Measurement Unit interface.
static const struct Int32Vect3 accel_neutral
static const struct Int32Vect3 mag_scale[2]
Default mag scale.
static const struct Int32Rates gyro_scale[2]
Default gyro scale.
static const struct Int32Vect3 accel_scale[2]
Default accel scale/neutral.
vector in North East Down coordinates Units: meters
static bool sensors_hitl_msg_available
void sensors_hitl_event(void)
void sensors_hitl_periodic(void)
void imu_feed_gyro_accel(void)
void gps_feed_value(void)
static uint8_t sensors_hitl_dl_buffer[MSG_SIZE]
void sensors_hitl_parse_HITL_AIR_DATA(uint8_t *buf)
void sensors_hitl_parse_HITL_GPS(uint8_t *buf)
void sensors_hitl_parse_HITL_IMU(uint8_t *buf)
void sensors_hitl_init(void)
static struct pprz_transport sensors_hitl_tp
volatile uint32_t nb_sec
full seconds since startup
volatile uint32_t nb_sec_rem
remainder of seconds since startup in CPU_TICKS
Periodic telemetry system header (includes downlink utility and generated code).
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.