|
Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
#include "modules/decawave/uwb_positioning.h"#include "std.h"#include "mcu_periph/uart.h"#include "pprzlink/messages.h"#include "modules/datalink/downlink.h"#include "modules/core/abi.h"#include "modules/decawave/trilateration.h"#include "modules/gps/gps.h"#include "state.h"#include "generated/flight_plan.h"#include "generated/airframe.h"#include <stdio.h>#include <stdlib.h>#include <string.h>
Include dependency graph for uwb_positioning.c:Go to the source code of this file.
Data Structures | |
| struct | UwbPositioning |
| waypoints to use as anchors in simulation More... | |
Macros | |
| #define | UWB_POSITIONING_USE_AS_LOCAL_POS TRUE |
| TRUE if UWB positioning is used as local position estimate. | |
| #define | UWB_POSITIONING_USE_AS_GPS FALSE |
| TRUE if UWB positioning is used as GPS. | |
| #define | UWB_POSITIONING_USE_EKF TRUE |
| TRUE if EKF range filter is use. | |
| #define | UWB_POSITIONING_NB_ANCHORS 3 |
| Number of anchors. | |
| #define | UWB_POSITIONING_RANGE_OFFSET { 0.f, 0.f, 0.f } |
| default offset, applied to individual distances | |
| #define | UWB_POSITIONING_RANGE_SCALE { 1.f, 1.f, 1.f } |
| default scale factor, applied to individual distances | |
| #define | UWB_POSITIONING_TAG_ID 0 |
| My UWB tag id. | |
| #define | UWB_POSITIONING_INITIAL_HEADING 0.f |
| default initial heading correction between anchors frame and global frame | |
| #define | UWB_POSITIONING_TIMEOUT 500 |
| default timeout (in ms) | |
| #define | UWB_POSITIONING_NOISE_X 0.1f |
| UWB positioning output noise. | |
| #define | UWB_POSITIONING_NOISE_Y 0.1f |
| #define | UWB_POSITIONING_NOISE_Z 0.1f |
| #define | UWB_POSITIONING_VEL_NOISE_X 0.1f |
| #define | UWB_POSITIONING_VEL_NOISE_Y 0.1f |
| #define | UWB_POSITIONING_VEL_NOISE_Z 0.1f |
Functions | |
| static void | process_data (struct UwbPositioning *uwb) |
| static void | uwb_ranging_cb (uint8_t sender_id, uint32_t stamp, uint16_t src_id, uint16_t dst_id, float range) |
| static bool | check_anchor_timeout (struct UwbPositioning *uwb, float timeout) |
| check timeout for each anchor | |
| static bool | check_and_compute_data (struct UwbPositioning *uwb) |
| check new data and compute with the proper algorithm | |
| void | uwb_positioning_reset_heading_ref (void) |
| Reset reference heading to current heading AHRS/INS should be aligned before calling this function. | |
| void | uwb_positioning_init (void) |
| void | uwb_positioning_periodic (void) |
| void | uwb_positioning_range_periodic (void) |
| void | uwb_positioning_report (void) |
| void | uwb_positioning_update_ekf_q (float v) |
| settings handler | |
| void | uwb_positioning_update_ekf_r_dist (float v) |
| void | uwb_positioning_update_ekf_r_speed (float v) |
| void WEAK | uwb_range (uint16_t id) |
| Weak empty implementation. | |
Variables | |
| static struct UwbPositioning | uwb_positioning |
| static abi_event | uwb_ranging_ev |
| bool | uwb_positioning_use_ekf |
| enable EKF filtering | |
| float | uwb_positioning_ekf_q |
| process and measurements noise | |
| float | uwb_positioning_ekf_r_dist |
| float | uwb_positioning_ekf_r_speed |
| static const uint16_t | ids [] = UWB_POSITIONING_ANCHORS_IDS |
| init arrays from airframe file | |
| static const float | pos_x [] = UWB_POSITIONING_ANCHORS_POS_X |
| static const float | pos_y [] = UWB_POSITIONING_ANCHORS_POS_Y |
| static const float | pos_z [] = UWB_POSITIONING_ANCHORS_POS_Z |
| static const float | offset [] = UWB_POSITIONING_RANGE_OFFSET |
| static const float | scale [] = UWB_POSITIONING_RANGE_SCALE |
Definition in file uwb_positioning.c.
| struct UwbPositioning |
waypoints to use as anchors in simulation
ChibiOS SD logger UWB positioning system structure
Definition at line 164 of file uwb_positioning.c.
Collaboration diagram for UwbPositioning:| Data Fields | ||
|---|---|---|
| uint8_t | anchor_ranging_idx | Next anchor index (in the anchors array) to be ranged. |
| struct Anchor | anchors[UWB_POSITIONING_NB_ANCHORS] | anchors data |
| struct EKFRange | ekf_range | EKF filter. |
| bool | ekf_running | EKF logic status. |
| struct GpsState | gps_uwb | "fake" gps structure |
| float | initial_heading | initial heading correction |
| struct LtpDef_i | ltp_def | ltp reference |
| struct MedianFilterFloat | mf[UWB_POSITIONING_NB_ANCHORS] | median filter for EKF input data |
| struct EnuCoor_f | pos | local pos in anchors frame |
| float | raw_dist[UWB_POSITIONING_NB_ANCHORS] | raw distance from anchors |
| struct EnuCoor_f | speed | local speed in anchors frame |
| bool | updated | new anchor data available |
default initial heading correction between anchors frame and global frame
Definition at line 84 of file uwb_positioning.c.
| #define UWB_POSITIONING_NB_ANCHORS 3 |
Number of anchors.
using standard trilateration algorithm, only 3 anchors are required/supported at the moment. More advanced multilateration algorithms might allow more anchors in the future
Definition at line 64 of file uwb_positioning.c.
UWB positioning output noise.
Definition at line 94 of file uwb_positioning.c.
Definition at line 98 of file uwb_positioning.c.
Definition at line 102 of file uwb_positioning.c.
default offset, applied to individual distances
Definition at line 69 of file uwb_positioning.c.
default scale factor, applied to individual distances
Definition at line 74 of file uwb_positioning.c.
| #define UWB_POSITIONING_TAG_ID 0 |
My UWB tag id.
Definition at line 79 of file uwb_positioning.c.
| #define UWB_POSITIONING_TIMEOUT 500 |
default timeout (in ms)
Definition at line 89 of file uwb_positioning.c.
TRUE if UWB positioning is used as GPS.
Definition at line 49 of file uwb_positioning.c.
TRUE if UWB positioning is used as local position estimate.
Definition at line 44 of file uwb_positioning.c.
TRUE if EKF range filter is use.
Definition at line 54 of file uwb_positioning.c.
Definition at line 106 of file uwb_positioning.c.
Definition at line 110 of file uwb_positioning.c.
Definition at line 114 of file uwb_positioning.c.
|
static |
check timeout for each anchor
| uwb | UWB positioning state |
| timeout | timeout in seconds |
Definition at line 305 of file uwb_positioning.c.
References foo, get_sys_time_float(), timeout, and UWB_POSITIONING_NB_ANCHORS.
Referenced by check_and_compute_data().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlinestatic |
check new data and compute with the proper algorithm
Definition at line 319 of file uwb_positioning.c.
References check_anchor_timeout(), ekf_range_get_pos(), ekf_range_get_speed(), ekf_range_set_state(), ekf_range_update_dist(), foo, timeout, trilateration_compute(), UWB_POSITIONING_NB_ANCHORS, UWB_POSITIONING_TIMEOUT, and uwb_positioning_use_ekf.
Referenced by process_data().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 369 of file uwb_positioning.c.
References UwbPositioning::anchors, check_and_compute_data(), Anchor::distance, foo, log_started, MAT33_ELMT, FloatRates::p, UwbPositioning::pos, pprzLogFile, FloatRates::q, FloatRates::r, stateGetBodyRates_f(), stateGetNedToBodyRMat_f(), stateGetPositionEnu_f(), stateGetSpeedEnu_f(), Anchor::time, uwb_positioning, EnuCoor_f::x, EnuCoor_f::y, and EnuCoor_f::z.
Referenced by uwb_positioning_periodic(), and uwb_ranging_cb().
Here is the call graph for this function:
Here is the caller graph for this function:Definition at line 465 of file uwb_positioning.c.
References ABI_BROADCAST, UwbPositioning::anchor_ranging_idx, UwbPositioning::anchors, GpsState::cacc, GpsState::comp_id, Anchor::distance, UwbPositioning::ekf_range, ekf_range_init(), UwbPositioning::ekf_running, GpsState::fix, foo, GPS_FIX_NONE, UwbPositioning::gps_uwb, GPS_UWB_ID, Anchor::id, ids, init_median_filter_f(), UwbPositioning::initial_heading, LlaCoor_i::lat, UwbPositioning::ltp_def, ltp_def_from_lla_i(), UwbPositioning::mf, GpsState::pacc, GpsState::pdop, Anchor::pos, UwbPositioning::pos, pos_x, pos_y, pos_z, UwbPositioning::raw_dist, GpsState::sacc, UwbPositioning::speed, Anchor::time, trilateration_init(), Anchor::updated, UwbPositioning::updated, uwb_positioning, uwb_positioning_ekf_q, uwb_positioning_ekf_r_dist, uwb_positioning_ekf_r_speed, UWB_POSITIONING_INITIAL_HEADING, UWB_POSITIONING_NB_ANCHORS, UWB_POSITIONING_USE_EKF, uwb_positioning_use_ekf, uwb_ranging_cb(), uwb_ranging_ev, EnuCoor_f::x, EnuCoor_f::y, and EnuCoor_f::z.
Here is the call graph for this function:Definition at line 521 of file uwb_positioning.c.
References UwbPositioning::ekf_range, ekf_range_get_pos(), ekf_range_get_speed(), ekf_range_predict(), UwbPositioning::ekf_running, foo, gps_periodic_check(), UwbPositioning::gps_uwb, log_started, UwbPositioning::pos, pprzLogFile, process_data(), UwbPositioning::speed, uwb_positioning, and uwb_positioning_use_ekf.
Here is the call graph for this function:Definition at line 552 of file uwb_positioning.c.
References UwbPositioning::anchor_ranging_idx, UwbPositioning::anchors, foo, uwb_positioning, UWB_POSITIONING_NB_ANCHORS, and uwb_range().
Here is the call graph for this function:Definition at line 558 of file uwb_positioning.c.
References UwbPositioning::anchors, DefaultChannel, DefaultDevice, Anchor::distance, foo, UwbPositioning::pos, UwbPositioning::raw_dist, UwbPositioning::speed, uwb_positioning, EnuCoor_f::x, EnuCoor_f::y, and EnuCoor_f::z.
Reset reference heading to current heading AHRS/INS should be aligned before calling this function.
Definition at line 415 of file uwb_positioning.c.
References foo, UwbPositioning::initial_heading, FloatEulers::psi, stateGetNedToBodyEulers_f(), and uwb_positioning.
Here is the call graph for this function:settings handler
Definition at line 579 of file uwb_positioning.c.
References UwbPositioning::ekf_range, ekf_range_update_noise(), uwb_positioning, uwb_positioning_ekf_q, uwb_positioning_ekf_r_dist, and uwb_positioning_ekf_r_speed.
Here is the call graph for this function:Definition at line 585 of file uwb_positioning.c.
References UwbPositioning::ekf_range, ekf_range_update_noise(), uwb_positioning, uwb_positioning_ekf_q, uwb_positioning_ekf_r_dist, and uwb_positioning_ekf_r_speed.
Here is the call graph for this function:Definition at line 591 of file uwb_positioning.c.
References UwbPositioning::ekf_range, ekf_range_update_noise(), uwb_positioning, uwb_positioning_ekf_q, uwb_positioning_ekf_r_dist, and uwb_positioning_ekf_r_speed.
Here is the call graph for this function:Weak empty implementation.
Definition at line 598 of file uwb_positioning.c.
Referenced by uwb_positioning_range_periodic().
Here is the caller graph for this function:
|
static |
Definition at line 201 of file uwb_positioning.c.
References UwbPositioning::anchors, Anchor::distance, foo, get_sys_time_float(), Anchor::id, UwbPositioning::mf, offset, process_data(), UwbPositioning::raw_dist, scale, Anchor::time, update_median_filter_f(), Anchor::updated, UwbPositioning::updated, uwb_positioning, UWB_POSITIONING_NB_ANCHORS, and UWB_POSITIONING_TAG_ID.
Referenced by uwb_positioning_init().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
init arrays from airframe file
Definition at line 192 of file uwb_positioning.c.
Referenced by uwb_positioning_init().
|
static |
Definition at line 196 of file uwb_positioning.c.
Referenced by _pdec_periodic_report(), actuators_uavcan_next_telem(), airspeed_ets_downlink(), airspeed_uavcan_downlink(), handle_reply(), if(), iomcu_write_register(), iomcu_write_registers(), ker_mul_3x3(), offset_commands(), parse_xsens700_msg(), parse_xsens_msg(), put_lat_lon_home(), RdMulti(), read_var(), rtp_frame_send(), sys_time_register_timer_offset(), terminal_move_cursor(), uwb_ranging_cb(), VL53L1X_GetOffset(), w5100_send(), write_var(), and WrMulti().
|
static |
Definition at line 193 of file uwb_positioning.c.
Referenced by uwb_positioning_init().
|
static |
Definition at line 194 of file uwb_positioning.c.
Referenced by uwb_positioning_init().
|
static |
Definition at line 195 of file uwb_positioning.c.
Referenced by send_ins_z(), and uwb_positioning_init().
|
static |
Definition at line 197 of file uwb_positioning.c.
Referenced by detection_cb(), dnrm2(), float_vect2_bound_in_2d(), float_vect2_scale_in_2d(), float_vect3_bound_in_2d(), float_vect3_bound_in_3d(), float_vect3_scale_in_2d(), h(), lis3mdl_init(), lla_of_utm_d(), lla_of_utm_f(), sobel_OCV(), uwb_ranging_cb(), vect_bound_nd(), xnrm2(), and xnrm2_f().
|
static |
Definition at line 182 of file uwb_positioning.c.
Referenced by process_data(), uwb_positioning_init(), uwb_positioning_periodic(), uwb_positioning_range_periodic(), uwb_positioning_report(), uwb_positioning_reset_heading_ref(), uwb_positioning_update_ekf_q(), uwb_positioning_update_ekf_r_dist(), uwb_positioning_update_ekf_r_speed(), and uwb_ranging_cb().
| float uwb_positioning_ekf_q |
process and measurements noise
Definition at line 187 of file uwb_positioning.c.
Referenced by uwb_positioning_init(), uwb_positioning_update_ekf_q(), uwb_positioning_update_ekf_r_dist(), and uwb_positioning_update_ekf_r_speed().
| float uwb_positioning_ekf_r_dist |
Definition at line 188 of file uwb_positioning.c.
Referenced by uwb_positioning_init(), uwb_positioning_update_ekf_q(), uwb_positioning_update_ekf_r_dist(), and uwb_positioning_update_ekf_r_speed().
| float uwb_positioning_ekf_r_speed |
Definition at line 189 of file uwb_positioning.c.
Referenced by uwb_positioning_init(), uwb_positioning_update_ekf_q(), uwb_positioning_update_ekf_r_dist(), and uwb_positioning_update_ekf_r_speed().
| bool uwb_positioning_use_ekf |
enable EKF filtering
Definition at line 186 of file uwb_positioning.c.
Referenced by check_and_compute_data(), uwb_positioning_init(), and uwb_positioning_periodic().
|
static |
Definition at line 184 of file uwb_positioning.c.
Referenced by uwb_positioning_init().