Paparazzi UAS
v5.10_stable-5-g83a0da5-dirty
Paparazzi is a free software Unmanned Aircraft System.
|
Vectornav VN-200 INS subsystem. More...
#include "subsystems/gps.h"
#include "subsystems/ins.h"
#include "peripherals/vn200_serial.h"
#include "math/pprz_algebra.h"
#include "math/pprz_geodetic_int.h"
#include "math/pprz_algebra_float.h"
#include "math/pprz_isa.h"
#include "generated/airframe.h"
#include "mcu_periph/sys_time.h"
#include "subsystems/abi.h"
Go to the source code of this file.
Data Structures | |
struct | InsVectornav |
Macros | |
#define | INS_VN_BODY_TO_IMU_PHI 0 |
#define | INS_VN_BODY_TO_IMU_THETA 0 |
#define | INS_VN_BODY_TO_IMU_PSI 0 |
Functions | |
void | ins_vectornav_init (void) |
Initialize Vectornav struct. More... | |
void | ins_vectornav_event (void) |
Event handling for Vectornav. More... | |
void | ins_vectornav_read_message (void) |
Read received data. More... | |
void | ins_vectornav_check_status (void) |
Check INS status. More... | |
void | ins_vectornav_set_sacc (void) |
Set speed (velocity) uncertainty (NED) speed accuracy in cm/s. More... | |
void | ins_vectornav_set_pacc (void) |
Find maximum uncertainty (NED) position accuracy in cm. More... | |
void | ins_vectornav_propagate (void) |
Propagate the received states into the vehicle state machine. More... | |
void | ins_vectornav_yaw_pitch_roll_to_attitude (struct FloatEulers *vn_attitude) |
Convert yaw, pitch, and roll data from VectorNav to correct attitude yaw(0), pitch(1), roll(2) -> phi, theta, psi [deg] -> rad. More... | |
Variables | |
struct InsVectornav | ins_vn |
Vectornav VN-200 INS subsystem.
Definition in file ins_vectornav.h.
struct InsVectornav |
Definition at line 64 of file ins_vectornav.h.
Data Fields | ||
---|---|---|
struct FloatVect3 | accel | Acceleration in the imu frame, m/s. |
struct Int32Vect3 | accel_i | |
struct FloatEulers | attitude | Attitude, float, [degrees], yaw, pitch, roll. |
float | baro_z | z-position calculated from baro in meters (z-down) |
struct OrientationReps | body_to_imu | body_to_imu rotation |
uint8_t | err | see page 122 of VN-200 datasheet |
struct FloatRates | gyro | Rates in the imu frame m/s. |
struct Int32Rates | gyro_i | |
uint16_t | ins_status | see page 122 of VN-200 datasheet |
struct FloatVect3 | lin_accel | Linear acceleration in imu frame [m/s^2]. |
struct LlaCoor_f | lla_pos | |
struct NedCoor_f | ltp_accel_f | |
struct NedCoor_i | ltp_accel_i | |
struct LtpDef_i | ltp_def | |
bool | ltp_initialized | |
struct NedCoor_i | ltp_pos_i | |
struct NedCoor_i | ltp_speed_i | |
uint8_t | mode | 0-not tracking, 1 - poor performance, 2- OK |
double | pos_lla[3] | |
float | pos_u[3] | The current GPS position uncertainty in the North East Down (NED) coordinate frame, given in meters. |
float | qfe | |
float | timestamp | System time [s]. |
struct FloatVect3 | vel_body | The estimated velocity in the imu frame, given in m/s. |
struct NedCoor_f | vel_ned | The estimated velocity in the North East Down (NED) frame, given in m/s. |
float | vel_u | NED velocity uncertainty [m/s]. |
uint16_t | vn_chksm | aux variable for checksum |
float | vn_freq | data frequency |
uint32_t | vn_ltime | aux time stamp |
struct VNPacket | vn_packet | Packet struct. |
enum VNStatus | vn_status | VN status. |
uint32_t | vn_time | VN time stamp. |
struct FloatEulers | ypr_u | Attitude uncertainty, 1sigma, float, [degrees], yaw, pitch, roll. |
#define INS_VN_BODY_TO_IMU_PHI 0 |
Definition at line 57 of file ins_vectornav.h.
Referenced by ins_vectornav_init().
#define INS_VN_BODY_TO_IMU_PSI 0 |
Definition at line 59 of file ins_vectornav.h.
Referenced by ins_vectornav_init().
#define INS_VN_BODY_TO_IMU_THETA 0 |
Definition at line 58 of file ins_vectornav.h.
Referenced by ins_vectornav_init().
void ins_vectornav_check_status | ( | void | ) |
Check INS status.
Definition at line 282 of file ins_vectornav.c.
References InsVectornav::err, InsVectornav::ins_status, ins_vn, and InsVectornav::mode.
Referenced by ins_vectornav_propagate().
void ins_vectornav_event | ( | void | ) |
Event handling for Vectornav.
Definition at line 125 of file ins_vectornav.c.
References ins_vectornav_read_message(), ins_vn, VNPacket::msg_available, vn200_event(), and InsVectornav::vn_packet.
void ins_vectornav_init | ( | void | ) |
Initialize Vectornav struct.
Definition at line 141 of file ins_vectornav.c.
References InsVectornav::body_to_imu, VNPacket::chksm_error, DefaultPeriodic, FLOAT_VECT3_ZERO, VNPacket::framing_error, get_sys_time_float(), VNPacket::hdr_error, ins_init_origin_i_from_flightplan(), ins_vn, INS_VN_BODY_TO_IMU_PHI, INS_VN_BODY_TO_IMU_PSI, INS_VN_BODY_TO_IMU_THETA, INT32_VECT3_ZERO, InsVectornav::lin_accel, InsVectornav::ltp_accel_i, InsVectornav::ltp_def, InsVectornav::ltp_initialized, InsVectornav::ltp_pos_i, InsVectornav::ltp_speed_i, VNPacket::msg_available, VNPacket::msg_idx, VNPacket::noise_error, orientationSetEulers_f(), VNPacket::overrun_error, register_periodic_telemetry(), send_accel(), send_accel_scaled(), send_gyro(), send_gyro_scaled(), send_ins(), send_ins_ref(), send_ins_z(), send_vn_info(), VNPacket::status, InsVectornav::vel_body, InsVectornav::vel_ned, InsVectornav::vn_freq, InsVectornav::vn_packet, InsVectornav::vn_status, InsVectornav::vn_time, VNMsgSync, and VNNotTracking.
void ins_vectornav_propagate | ( | void | ) |
Propagate the received states into the vehicle state machine.
Definition at line 336 of file ins_vectornav.c.
References InsVectornav::accel, InsVectornav::accel_i, ACCELS_BFP_OF_REAL, LlaCoor_f::alt, InsVectornav::attitude, InsVectornav::body_to_imu, GpsState::course, ECEF_BFP_OF_REAL, ecef_of_ned_point_f(), GpsState::ecef_pos, GpsState::ecef_vel, GpsState::fix, float_quat_of_eulers(), float_rmat_comp(), float_rmat_of_quat(), float_rmat_ratemult(), float_rmat_transp_vmult(), get_sys_time_usec(), gps, GPS_FIX_3D, GPS_UBX_ID, GPS_VALID_COURSE_BIT, GPS_VALID_HMSL_BIT, GPS_VALID_POS_ECEF_BIT, GPS_VALID_POS_LLA_BIT, GPS_VALID_VEL_ECEF_BIT, GpsState::gspeed, InsVectornav::gyro, InsVectornav::gyro_i, GpsState::hmsl, IMU_ASPIRIN_ID, ins_vectornav_check_status(), ins_vectornav_set_pacc(), ins_vectornav_set_sacc(), ins_vectornav_yaw_pitch_roll_to_attitude(), ins_vn, GpsState::last_3dfix_ticks, GpsState::last_3dfix_time, GpsState::last_msg_ticks, GpsState::last_msg_time, LlaCoor_f::lat, InsVectornav::lin_accel, LLA_BFP_OF_REAL, InsVectornav::lla_pos, GpsState::lla_pos, LlaCoor_f::lon, InsVectornav::ltp_accel_f, InsVectornav::ltp_accel_i, ltp_def_from_lla_f(), InsVectornav::ltp_pos_i, InsVectornav::ltp_speed_i, sys_time::nb_sec, sys_time::nb_sec_rem, orientationGetRMat_f(), InsVectornav::pos_lla, RATES_BFP_OF_REAL, stateGetAccelNed_i(), stateGetPositionEcef_i(), stateGetPositionNed_i(), stateGetSpeedNed_i(), stateSetAccelNed_f(), stateSetBodyRates_f(), stateSetNedToBodyRMat_f(), stateSetPositionLla_i(), stateSetSpeedNed_f(), GpsState::valid_fields, VECT3_ASSIGN, InsVectornav::vel_ned, wgs84_ellipsoid_to_geoid_f(), EcefCoor_i::x, FloatVect3::x, NedCoor_f::x, EcefCoor_i::y, FloatVect3::y, NedCoor_f::y, EcefCoor_i::z, and FloatVect3::z.
Referenced by ins_vectornav_read_message().
void ins_vectornav_read_message | ( | void | ) |
Read received data.
Definition at line 192 of file ins_vectornav.c.
References InsVectornav::accel, InsVectornav::attitude, GpsState::fix, get_sys_time_float(), gps, InsVectornav::gyro, idx, InsVectornav::ins_status, ins_vectornav_propagate(), ins_vn, InsVectornav::lin_accel, VNPacket::msg_buf, GpsState::num_sv, InsVectornav::pos_lla, InsVectornav::pos_u, InsVectornav::timestamp, GpsState::tow, InsVectornav::vel_body, InsVectornav::vel_ned, InsVectornav::vel_u, VN_HEADER_SIZE, InsVectornav::vn_packet, InsVectornav::vn_time, and InsVectornav::ypr_u.
Referenced by ins_vectornav_event().
void ins_vectornav_set_pacc | ( | void | ) |
Find maximum uncertainty (NED) position accuracy in cm.
Definition at line 301 of file ins_vectornav.c.
References gps, ins_vn, GpsState::pacc, and InsVectornav::pos_u.
Referenced by ins_vectornav_propagate().
void ins_vectornav_set_sacc | ( | void | ) |
Set speed (velocity) uncertainty (NED) speed accuracy in cm/s.
Definition at line 292 of file ins_vectornav.c.
References gps, ins_vn, GpsState::sacc, and InsVectornav::vel_u.
Referenced by ins_vectornav_propagate().
void ins_vectornav_yaw_pitch_roll_to_attitude | ( | struct FloatEulers * | vn_attitude | ) |
Convert yaw, pitch, and roll data from VectorNav to correct attitude yaw(0), pitch(1), roll(2) -> phi, theta, psi [deg] -> rad.
Definition at line 320 of file ins_vectornav.c.
References FloatEulers::phi, FloatEulers::psi, and FloatEulers::theta.
Referenced by ins_vectornav_propagate().
struct InsVectornav ins_vn |
Definition at line 32 of file ins_vectornav.c.
Referenced by ins_vectornav_check_status(), ins_vectornav_event(), ins_vectornav_init(), ins_vectornav_propagate(), ins_vectornav_read_message(), ins_vectornav_set_pacc(), ins_vectornav_set_sacc(), send_accel(), send_accel_scaled(), send_gyro(), send_gyro_scaled(), send_ins(), send_ins_ref(), send_ins_z(), and send_vn_info().