![]() |
Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
#include "generated/airframe.h"
#include "modules/sonar/sonar_i2c.h"
#include "modules/core/abi.h"
#include "modules/datalink/telemetry.h"
#include "pprzlink/messages.h"
#include "filters/median_filter.h"
Go to the source code of this file.
Macros | |
#define | SONAR_I2C_ADDR 0xE0 |
#define | READ_MODE_SINGLE 0x51 |
#define | SONAR_I2C_MIN_RANGE 0.24f |
The minimum chosen distance for the device to be give readings. | |
#define | SONAR_I2C_MAX_RANGE 4.0f |
The maximum chosen distance for the device to be give readings. | |
#define | SONAR_I2C_OFFSET 0.0f |
Rangefinder distance offset value for what should be considered zero distance, e.g. high landing gear of 1.1m to tarmac still could be considered zero. | |
#define | USE_SONAR_I2C_AGL 0 |
Send AGL data over ABI. | |
#define | SONAR_I2C_USE_FILTER 1 |
Filter the raw measuread sonar data. | |
#define | SONAR_I2C_MEDIAN_SIZE 7 |
The amount of sensor samples to keep in the median filter buffer. | |
#define | SONAR_I2C_COMPENSATE_ROTATION 0 |
#define | SONAR_I2C_SCALE 0.000044f |
Functions | |
static void | sonar_i2c_send_sonar (struct transport_tx *trans, struct link_device *dev) |
Send measured value and status information so it can be read back in e.g. | |
void | sonar_i2c_init (void) |
Set the default values at initialization. | |
void | sonar_i2c_event (void) |
Rangefinder event function Basically just check the progress of the transation to prevent overruns during high speed operation (ie. | |
void | sonar_i2c_periodic (void) |
Get the ranger current distance value. | |
void | sonar_i2c_report (void) |
Option to send debug informative values over telemetry if you do not want sonar message in telemetry. | |
Variables | |
struct MedianFilterFloat | sonar_i2c_filter |
struct SonarI2C | sonar_i2c |
#define READ_MODE_SINGLE 0x51 |
Definition at line 54 of file sonar_i2c.c.
#define SONAR_I2C_ADDR 0xE0 |
Definition at line 51 of file sonar_i2c.c.
#define SONAR_I2C_COMPENSATE_ROTATION 0 |
Definition at line 93 of file sonar_i2c.c.
#define SONAR_I2C_MAX_RANGE 4.0f |
The maximum chosen distance for the device to be give readings.
Definition at line 65 of file sonar_i2c.c.
#define SONAR_I2C_MEDIAN_SIZE 7 |
The amount of sensor samples to keep in the median filter buffer.
Definition at line 87 of file sonar_i2c.c.
The minimum chosen distance for the device to be give readings.
Definition at line 60 of file sonar_i2c.c.
#define SONAR_I2C_OFFSET 0.0f |
Rangefinder distance offset value for what should be considered zero distance, e.g. high landing gear of 1.1m to tarmac still could be considered zero.
Definition at line 70 of file sonar_i2c.c.
Definition at line 98 of file sonar_i2c.c.
#define SONAR_I2C_USE_FILTER 1 |
Filter the raw measuread sonar data.
Definition at line 80 of file sonar_i2c.c.
#define USE_SONAR_I2C_AGL 0 |
Send AGL data over ABI.
Definition at line 75 of file sonar_i2c.c.
Rangefinder event function Basically just check the progress of the transation to prevent overruns during high speed operation (ie.
polling the sensor at more than maximum, e.g. > 10Hz)
Definition at line 142 of file sonar_i2c.c.
References I2CTransDone, I2CTransFailed, I2CTransPending, I2CTransRunning, I2CTransSuccess, sonar_i2c, sonar_i2c_report(), i2c_transaction::status, and SonarI2C::trans.
Set the default values at initialization.
Definition at line 114 of file sonar_i2c.c.
References SonarI2C::addr, DefaultPeriodic, SonarI2C::distance, foo, I2CTransDone, init_median_filter_f(), SonarI2C::raw, register_periodic_telemetry(), sonar_i2c, SONAR_I2C_ADDR, sonar_i2c_filter, SONAR_I2C_MEDIAN_SIZE, SONAR_I2C_MIN_RANGE, SONAR_I2C_REQ_DATA, SONAR_I2C_SCALE, sonar_i2c_send_sonar(), i2c_transaction::status, SonarI2C::status, SonarI2C::trans, SonarI2C::update_agl, and USE_SONAR_I2C_AGL.
Get the ranger current distance value.
Definition at line 169 of file sonar_i2c.c.
References SonarI2C::addr, AGL_SONAR_I2C_ID, i2c_transaction::buf, SonarI2C::distance, foo, get_sys_time_usec(), i2c_receive(), i2c_transmit(), I2CTransDone, FloatEulers::phi, SonarI2C::raw, READ_MODE_SINGLE, sonar_i2c, sonar_i2c_filter, SONAR_I2C_MAX_RANGE, SONAR_I2C_MIN_RANGE, SONAR_I2C_OFFSET, SONAR_I2C_PARSE_DATA, SONAR_I2C_READ_DATA, SONAR_I2C_REQ_DATA, SONAR_I2C_SCALE, stateGetNedToBodyEulers_f(), stateGetPositionEnu_f(), i2c_transaction::status, SonarI2C::status, FloatEulers::theta, SonarI2C::trans, SonarI2C::update_agl, update_median_filter_f(), and EnuCoor_f::z.
Option to send debug informative values over telemetry if you do not want sonar message in telemetry.
Definition at line 246 of file sonar_i2c.c.
References DefaultChannel, DefaultDevice, SonarI2C::distance, foo, SonarI2C::raw, and sonar_i2c.
Referenced by sonar_i2c_event().
|
static |
Send measured value and status information so it can be read back in e.g.
log file for debugging
Definition at line 106 of file sonar_i2c.c.
References dev, SonarI2C::distance, foo, SonarI2C::raw, sonar_i2c, and SonarI2C::trans.
Referenced by sonar_i2c_init().
struct SonarI2C sonar_i2c |
Definition at line 101 of file sonar_i2c.c.
Referenced by sonar_i2c_event(), sonar_i2c_init(), sonar_i2c_periodic(), sonar_i2c_report(), and sonar_i2c_send_sonar().
struct MedianFilterFloat sonar_i2c_filter |
Definition at line 89 of file sonar_i2c.c.
Referenced by sonar_i2c_init(), and sonar_i2c_periodic().