30 #include "pprzlink/messages.h"
36 #include "generated/flight_plan.h"
37 #include "generated/airframe.h"
48 #ifndef DW1000_NB_ANCHORS
49 #define DW1000_NB_ANCHORS 3
54 #define DW1000_OFFSET { 0.f, 0.f, 0.f }
59 #define DW1000_SCALE { 1.f, 1.f, 1.f }
63 #ifndef DW1000_INITIAL_HEADING
64 #define DW1000_INITIAL_HEADING 0.f
68 #ifndef DW1000_TIMEOUT
69 #define DW1000_TIMEOUT 500
102 memcpy((
uint8_t*)(&f), b,
sizeof(
float));
198 dw1000_arduino_dw1000_reset_heading_ref_status = MODULES_STOP;
203 static const float pos_x[] = DW1000_ANCHORS_POS_X;
204 static const float pos_y[] = DW1000_ANCHORS_POS_Y;
205 static const float pos_z[] = DW1000_ANCHORS_POS_Z;
245 llh_nav0.
lat = NAV_LAT0;
246 llh_nav0.
lon = NAV_LON0;
248 llh_nav0.
alt = NAV_ALT0 + NAV_MSL0;
#define DW1000_OFFSET
default offset, applied to final result not to individual distances
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
int trilateration_compute(struct Anchor *anchors, struct EnuCoor_f *pos)
Compute trilateration based on the latest measurments.
uint32_t pacc
position accuracy in cm
definition of the local (flat earth) coordinate system
static struct FloatEulers * stateGetNedToBodyEulers_f(void)
Get vehicle body attitude euler angles (float).
uint8_t state
parser state
void ecef_of_enu_point_i(struct EcefCoor_i *ecef, struct LtpDef_i *def, struct EnuCoor_i *enu)
Convert a point in local ENU to ECEF.
uint8_t uart_getch(struct uart_periph *p)
uint32_t get_sys_time_msec(void)
Get the time in milliseconds since startup.
uint8_t valid_fields
bitfield indicating valid fields (GPS_VALID_x_BIT)
struct EnuCoor_f raw_pos
unscaled local pos in anchors frame
vector in East North Up coordinates Units: meters
uint16_t uart_char_available(struct uart_periph *p)
Check UART for available chars in receive buffer.
static const float pos_z[]
uint8_t buf[DW_NB_DATA]
incoming data buffer
Main include for ABI (AirBorneInterface).
void dw1000_arduino_report()
static uint16_t uint16_from_buf(uint8_t *b)
Utility function to get uint16_t from buffer.
void dw1000_arduino_init()
vector in Latitude, Longitude and Altitude
#define GPS_FIX_3D
3D GPS fix
void ltp_def_from_lla_i(struct LtpDef_i *def, struct LlaCoor_i *lla)
static void scale_position(struct DW1000 *dw)
#define DW1000_TIMEOUT
default timeout (in ms)
static float get_sys_time_float(void)
Get the time in seconds since startup.
int trilateration_init(struct Anchor *anchors)
Init internal trilateration structures.
int32_t hmsl
Height above mean sea level in mm.
uint32_t last_3dfix_ticks
cpu time ticks at last valid 3D fix
int32_t alt
in millimeters above WGS84 reference ellipsoid
uint32_t sacc
speed accuracy in cm/s
uint32_t last_msg_time
cpu time in sec at last received GPS message
uint32_t cacc
course accuracy in rad*1e7
struct Anchor anchors[DW1000_NB_ANCHORS]
anchors data
bool updated
new anchor data available
int32_t hmsl
height above mean sea level (MSL) in mm
static const uint16_t ids[]
init arrays from airframe file
static const float offset[]
static const float pos_x[]
static struct DW1000 dw1000
data structure for GPS information
uint32_t tow
GPS time of week in ms.
#define GPS_FIX_NONE
No GPS fix.
Device independent GPS code (interface)
uint16_t pdop
position dilution of precision scaled by 100
struct EcefCoor_i ecef_pos
position in ECEF in cm
static void send_gps_dw1000_small(struct DW1000 *dw)
#define GPS_VALID_HMSL_BIT
int32_t lon
in degrees*1e7
float time
time of the last received data
void dw1000_reset_heading_ref(void)
Reset reference heading to current heading AHRS/INS should be aligned before calling this function...
float distance
last measured distance
void dw1000_arduino_periodic()
volatile uint32_t nb_sec_rem
remainder of seconds since startup in CPU_TICKS
uint16_t u16
Unsigned 16-bit integer.
#define DW1000_INITIAL_HEADING
default initial heading correction between anchors frame and global frame
static void dw1000_arduino_parse(struct DW1000 *dw, uint8_t c)
Data parsing function.
static const float scale[]
static void fill_anchor(struct DW1000 *dw)
Utility function to fill anchor from buffer.
uint32_t last_3dfix_time
cpu time in sec at last valid 3D fix
static bool check_anchor_timeout(struct DW1000 *dw)
check timeout for each anchor
vector in East North Up coordinates
#define DW1000_SCALE
default scale factor, applied to final result not to individual distances
API to get/set the generic vehicle states.
uint8_t comp_id
id of current gps
volatile uint32_t nb_sec
full seconds since startup
struct LtpDef_i ltp_def
ltp reference
#define GPS_VALID_POS_ECEF_BIT
Common code for AP and FBW telemetry.
#define DW_STX
frame sync byte
uint32_t last_msg_ticks
cpu time ticks at last received GPS message
#define GPS_VALID_POS_LLA_BIT
uint8_t num_sv
number of sat in fix
struct EnuCoor_f pos
position of the anchor
#define DW_WAIT_STX
Parsing states.
float initial_heading
initial heading correction
DW1000 positionning system structure.
struct LlaCoor_i lla_pos
position in LLA (lat,lon: deg*1e7; alt: mm over ellipsoid)
void lla_of_ecef_i(struct LlaCoor_i *out, struct EcefCoor_i *in)
Convert a ECEF to LLA.
struct EnuCoor_f pos
local pos in anchors frame
struct GpsState gps_dw1000
"fake" gps structure
void dw1000_arduino_event()
uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
int32_t lat
in degrees*1e7
#define DW1000_NB_ANCHORS
Number of anchors.
static float float_from_buf(uint8_t *b)
Utility function to get float from buffer.
static const float pos_y[]
void gps_periodic_check(struct GpsState *gps_s)
Periodic GPS check.