34 #if PERIODIC_TELEMETRY
37 static void send_ins(
struct transport_tx *trans,
struct link_device *
dev)
39 pprz_msg_send_INS(trans,
dev, AC_ID,
45 static void send_ins_z(
struct transport_tx *trans,
struct link_device *
dev)
47 pprz_msg_send_INS_Z(trans,
dev, AC_ID,
54 pprz_msg_send_INS_REF(trans,
dev, AC_ID,
63 pprz_msg_send_VECTORNAV_INFO(trans,
dev, AC_ID,
75 static void send_accel(
struct transport_tx *trans,
struct link_device *
dev)
78 pprz_msg_send_IMU_ACCEL(trans,
dev, AC_ID, &
id,
82 static void send_gyro(
struct transport_tx *trans,
struct link_device *
dev)
85 pprz_msg_send_IMU_GYRO(trans,
dev, AC_ID, &
id,
92 pprz_msg_send_IMU_ACCEL_SCALED(trans,
dev, AC_ID, &
id,
99 pprz_msg_send_IMU_GYRO_SCALED(trans,
dev, AC_ID, &
id,
104 #ifndef USE_INS_NAV_INIT
105 #define USE_INS_NAV_INIT TRUE
202 #if PERIODIC_TELEMETRY
266 static struct FloatRMat ltp_to_body_rmat;
286 VECT3_ASSIGN(ltp_accel, accel_meas_ltp.
x, accel_meas_ltp.
y, accel_meas_ltp.
z);
struct GpsState gps
global GPS state
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)
uint8_t cno
Carrier to Noise Ratio (Signal Strength) in dbHz.
struct EcefCoor_i ecef_pos
position in ECEF in cm
#define GPS_VALID_POS_LLA_BIT
uint32_t last_3dfix_ticks
cpu time ticks at last valid 3D fix
#define GPS_FIX_NONE
No GPS fix.
#define GPS_VALID_POS_ECEF_BIT
#define GPS_VALID_HMSL_BIT
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)
#define GPS_FIX_3D
3D GPS fix
struct SVinfo svinfos[GPS_NB_CHANNELS]
holds information from the Space Vehicles (Satellites)
#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
void float_rmat_ratemult(struct FloatRates *rb, struct FloatRMat *m_a2b, struct FloatRates *ra)
rotate anglular rates by rotation matrix.
void float_rmat_of_quat(struct FloatRMat *rm, struct FloatQuat *q)
void float_rmat_comp(struct FloatRMat *m_a2c, struct FloatRMat *m_a2b, struct FloatRMat *m_b2c)
Composition (multiplication) of two rotation matrices.
void float_quat_of_eulers(struct FloatQuat *q, struct FloatEulers *e)
quat of euler roation 'ZYX'
void float_rmat_transp_vmult(struct FloatVect3 *vb, struct FloatRMat *m_b2a, struct FloatVect3 *va)
rotate 3D vector by transposed rotation matrix.
#define VECT3_ASSIGN(_a, _x, _y, _z)
#define RATES_BFP_OF_REAL(_ri, _rf)
#define ACCELS_BFP_OF_REAL(_ef, _ei)
int32_t p
in rad/s with INT32_RATE_FRAC
int32_t r
in rad/s with INT32_RATE_FRAC
int32_t q
in rad/s with INT32_RATE_FRAC
#define INT32_VECT3_ZERO(_v)
int32_t lat
in degrees*1e7
int32_t hmsl
Height above mean sea level in mm.
int32_t alt
in millimeters above WGS84 reference ellipsoid
struct LlaCoor_i lla
Reference point in lla.
struct EcefCoor_i ecef
Reference point in ecef.
int32_t lon
in degrees*1e7
#define LLA_BFP_OF_REAL(_o, _i)
static float wgs84_ellipsoid_to_geoid_f(float lat, float lon)
Get WGS84 ellipsoid/geoid separation.
static void orientationSetEulers_f(struct OrientationReps *orientation, struct FloatEulers *eulers)
Set vehicle body attitude from euler angles (float).
static struct FloatRMat * orientationGetRMat_f(struct OrientationReps *orientation)
Get vehicle body attitude rotation matrix (float).
static void stateSetAccelNed_f(uint16_t id, struct NedCoor_f *ned_accel)
Set acceleration in NED coordinates (float).
static struct NedCoor_i * stateGetAccelNed_i(void)
Get acceleration in NED coordinates (int).
static void stateSetNedToBodyRMat_f(uint16_t id, struct FloatRMat *ned_to_body_rmat)
Set vehicle body attitude from rotation matrix (float).
static struct EcefCoor_i * stateGetPositionEcef_i(void)
Get position in ECEF coordinates (int).
static void stateSetPositionLla_i(uint16_t id, struct LlaCoor_i *lla_pos)
Set position from LLA coordinates (int).
static struct NedCoor_i * stateGetPositionNed_i(void)
Get position in local NED coordinates (int).
static void stateSetBodyRates_f(uint16_t id, struct FloatRates *body_rate)
Set vehicle body angular rate (float).
static void stateSetSpeedNed_f(uint16_t id, struct NedCoor_f *ned_speed)
Set ground speed in local NED coordinates (float).
static struct NedCoor_i * stateGetSpeedNed_i(void)
Get ground speed in local NED coordinates (int).
void ins_init_origin_i_from_flightplan(uint16_t id, struct LtpDef_i *ltp_def)
initialize the local origin (ltp_def in fixed point) from flight plan position
void ins_vectornav_monitor(void)
Monitors vectornav data rate and changes GPS lock if the data rate is too low.
static void send_ins(struct transport_tx *trans, struct link_device *dev)
void ins_vectornav_set_pacc(void)
Find maximum uncertainty (NED) position accuracy in cm.
struct InsVectornav ins_vn
static void send_ins_ref(struct transport_tx *trans, struct link_device *dev)
static void send_ins_z(struct transport_tx *trans, struct link_device *dev)
void ins_vectornav_set_sacc(void)
Set speed (velocity) uncertainty (NED) speed accuracy in cm/s.
PRINT_CONFIG_MSG("USE_INS_NAV_INIT defaulting to TRUE")
static void send_gyro_scaled(struct transport_tx *trans, struct link_device *dev)
static void send_gyro(struct transport_tx *trans, struct link_device *dev)
void ins_vectornav_init(void)
Initialize Vectornav struct.
void ins_vectornav_event(void)
Event handling for Vectornav.
static void send_vn_info(struct transport_tx *trans, struct link_device *dev)
static void send_accel(struct transport_tx *trans, struct link_device *dev)
static void send_accel_scaled(struct transport_tx *trans, struct link_device *dev)
void ins_vectornav_propagate()
Propagate the received states into the vehicle state machine.
Vectornav VN-200 INS module.
#define INS_VN_BODY_TO_IMU_PHI
struct NedCoor_f ltp_accel_f
struct NedCoor_i ltp_accel_i
struct Int32Vect3 accel_i
struct VNData vn_data
Data struct.
struct VNPacket vn_packet
Packet struct.
float baro_z
z-position calculated from baro in meters (z-down)
struct OrientationReps body_to_imu
body_to_imu rotation
enum VNStatus vn_status
VN status.
struct NedCoor_i ltp_pos_i
#define INS_VN_BODY_TO_IMU_PSI
struct NedCoor_i ltp_speed_i
#define INS_VN_BODY_TO_IMU_THETA
uint16_t vn_rate
data frequency
float alt
in meters (normally above WGS84 reference ellipsoid)
vector in North East Down coordinates Units: meters
static const struct usb_device_descriptor dev
volatile uint32_t nb_sec
full seconds since startup
volatile uint32_t nb_sec_rem
remainder of seconds since startup in CPU_TICKS
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
Periodic telemetry system header (includes downlink utility and generated code).
#define DefaultPeriodic
Set default periodic telemetry.
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
int int32_t
Typedef defining 32 bit int type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
void vn200_read_message(struct VNPacket *vn_packet, struct VNData *vn_data)
Read received message and populate data struct with new measurements.
void vn200_event(struct VNPacket *vnp)
uint8_t err
see page 122 of VN-200 datasheet
struct FloatRates gyro
Rates in the imu frame m/s.
struct FloatEulers attitude
Attitude, float, [rad], yaw, pitch, roll.
struct FloatEulers ypr_u
Attitude uncertainty, 1sigma, float, [degrees], yaw, pitch, roll.
struct FloatVect3 accel
Acceleration in the imu frame, m/s.
uint8_t mode
0-not tracking, 1 - poor performance, 2- OK
float timestamp
Time since VN startup [s].
float pos_u[3]
The current GPS position uncertainty in the North East Down (NED) coordinate frame,...
float vel_u
NED velocity uncertainty [m/s].
uint8_t gps_fix
None|2D|3D.
uint8_t num_sv
number of visible satellites
struct FloatVect3 lin_accel
Linear acceleration in imu frame [m/s^2].
struct NedCoor_f vel_ned
The estimated velocity in the North East Down (NED) frame, given in m/s.