27#include "generated/airframe.h"
30#include "nps_sensors_params_common.h"
31#if USE_BATTERY_MONITOR
65 const struct Int32Rates gyro_neutral = {NPS_GYRO_NEUTRAL_P, NPS_GYRO_NEUTRAL_Q, NPS_GYRO_NEUTRAL_R};
67 const struct Int32Vect3 accel_neutral = {NPS_ACCEL_NEUTRAL_X, NPS_ACCEL_NEUTRAL_Y, NPS_ACCEL_NEUTRAL_Z};
69 const struct Int32Vect3 mag_neutral = {NPS_MAG_NEUTRAL_X, NPS_MAG_NEUTRAL_Y, NPS_MAG_NEUTRAL_Z};
77#if USE_BATTERY_MONITOR
89 if (DL_HITL_IMU_ac_id(buf) != AC_ID) {
94 NPS_GYRO_SIGN_P * DL_HITL_IMU_gp(buf),
95 NPS_GYRO_SIGN_Q * DL_HITL_IMU_gq(buf),
96 NPS_GYRO_SIGN_R * DL_HITL_IMU_gr(buf));
98 NPS_ACCEL_SIGN_X * DL_HITL_IMU_ax(buf),
99 NPS_ACCEL_SIGN_Y * DL_HITL_IMU_ay(buf),
100 NPS_ACCEL_SIGN_Z * DL_HITL_IMU_az(buf));
102 NPS_MAG_SIGN_X * DL_HITL_IMU_mx(buf),
103 NPS_MAG_SIGN_Y * DL_HITL_IMU_my(buf),
104 NPS_MAG_SIGN_Z * DL_HITL_IMU_mz(buf));
113 if (DL_HITL_GPS_ac_id(buf) != AC_ID) {
118 gps_hitl.tow = DL_HITL_GPS_time(buf) * 1000;
120 gps_hitl.ecef_vel.x = DL_HITL_GPS_ecef_vel_x(buf) * 100.;
121 gps_hitl.ecef_vel.y = DL_HITL_GPS_ecef_vel_y(buf) * 100.;
122 gps_hitl.ecef_vel.z = DL_HITL_GPS_ecef_vel_z(buf) * 100.;
125 gps_hitl.lla_pos.lat = DL_HITL_GPS_lat(buf) * 1e7;
126 gps_hitl.lla_pos.lon = DL_HITL_GPS_lon(buf) * 1e7;
127 gps_hitl.lla_pos.alt = DL_HITL_GPS_alt(buf) * 1000.;
130 gps_hitl.hmsl = DL_HITL_GPS_hmsl(buf) * 1000.;
146 gps_hitl.gspeed = sqrtf(ned_vel_f.
x * ned_vel_f.
x + ned_vel_f.
y * ned_vel_f.
y) * 100;
147 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;
150 gps_hitl.course = atan2f(ned_vel_f.
y, ned_vel_f.
x) * 1e7;
179 if (DL_HITL_AIR_DATA_ac_id(buf) != AC_ID) {
183 uint8_t flag = DL_HITL_AIR_DATA_update_flag(buf);
184 if (bit_is_set(flag, 0)) {
186 float pressure = DL_HITL_AIR_DATA_baro(buf);
189 if (bit_is_set(flag, 1)) {
192 if (bit_is_set(flag, 2) || bit_is_set(flag, 3)) {
193 uint8_t incidence_flag = (flag >> 2) & (0x3);
194 float aoa = DL_HITL_AIR_DATA_aoa(buf);
195 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.
#define DATALINK_MSG_SIZE
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.
Device independent GPS code (interface).
#define GPS_VALID_VEL_ECEF_BIT
#define GPS_VALID_VEL_NED_BIT
#define GPS_VALID_POS_LLA_BIT
#define GPS_FIX_NONE
No GPS fix.
#define GPS_VALID_HMSL_BIT
#define GPS_FIX_3D
3D GPS fix
#define GPS_VALID_COURSE_BIT
data structure for GPS information
#define RATES_ASSIGN(_ra, _p, _q, _r)
#define VECT3_ASSIGN(_a, _x, _y, _z)
#define RATE_FLOAT_OF_BFP(_ai)
#define ACCEL_FLOAT_OF_BFP(_ai)
#define MAG_FLOAT_OF_BFP(_ai)
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_gyro(uint8_t abi_id, const struct Int32RMat *imu_to_sensor, const struct Int32Rates *neutral, const struct FloatRates *scale_f)
Set the defaults for a gyro sensor WARNING: Should be called before sensor is publishing messages to ...
void imu_set_defaults_accel(uint8_t abi_id, const struct Int32RMat *imu_to_sensor, const struct Int32Vect3 *neutral, const struct FloatVect3 *scale_f)
Set the defaults for a accel sensor WARNING: Should be called before sensor is publishing messages to...
void imu_set_defaults_mag(uint8_t abi_id, const struct Int32RMat *imu_to_sensor, const struct Int32Vect3 *neutral, const struct FloatVect3 *scale_f)
Set the defaults for a mag sensor WARNING: Should be called before sensor is publishing messages to e...
Inertial Measurement Unit interface.
vector in North East Down coordinates Units: meters
static uint8_t sensors_hitl_dl_buffer[DATALINK_MSG_SIZE]
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)
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
Architecture independent timing functions.
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.