|
Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
Go to the documentation of this file.
43 #if PERIODIC_TELEMETRY
45 #include "pprzlink/messages.h"
47 #ifdef SENSOR_SYNC_SEND_SONAR
50 #include "generated/airframe.h"
55 #ifdef SONAR_USE_PWM_FILTER
62 #ifndef SONAR_PWM_CHANNEL
63 #error "No SONAR_PWM_CHANNEL defined to use sonar_pwm module, add a line like define=SONAR_PWM_CHANNEL value=PWM_INPUT1"
68 #define SONAR_OFFSET 0
72 #ifndef SONAR_PWM_PERIOD
73 #define SONAR_PWM_PERIOD 4096
78 #define SONAR_SCALE SONAR_PWM_PERIOD
82 #ifndef SONAR_MEDIAN_SIZE
83 #define SONAR_MEDIAN_SIZE 7 //Good for a noisy sonar
87 #ifndef SONAR_MIN_RANGE
88 #define SONAR_MIN_RANGE 0.15f //Default is a common value for regular sonars. Cannot measure closer than that
92 #ifndef SONAR_MAX_RANGE
93 #define SONAR_MAX_RANGE 7.0f //Reasonable maximum value for regular sonars.
97 #ifndef SONAR_PWM_OFFSET
98 #define SONAR_PWM_OFFSET 820 //822
102 #ifndef SENSOR_SYNC_SEND_SONAR
103 #define SENSOR_SYNC_SEND_SONAR TRUE
114 #ifdef SONAR_USE_PWM_FILTER
129 #ifdef SONAR_USE_PWM_FILTER
137 #if SONAR_COMPENSATE_ROTATION
140 float gain = (float)fabs( (
double) (cosf(phi) * cosf(theta)));
153 #ifdef SENSOR_SYNC_SEND_SONAR
struct SonarPwm sonar_pwm
float distance
Distance measured.
float scale
scale to convert raw to a real distance
#define SONAR_MEDIAN_SIZE
The Median Filter strength.
static struct EnuCoor_f * stateGetPositionEnu_f(void)
Get position in local ENU coordinates (float).
static struct FloatEulers * stateGetNedToBodyEulers_f(void)
Get vehicle body attitude euler angles (float).
#define SONAR_SCALE
Ranger scale or sensitivity as you wish.
uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
#define SONAR_PWM_OFFSET
Some sensor may need an initial PWM offset (823 usec in the case of an EZ1 sensor)
void sonar_pwm_init(void)
struct SonarAdc sonar_adc
Common code for AP and FBW telemetry.
#define SONAR_MAX_RANGE
The maximum range for the device to be able to measure.
float distance
Distance measured in meters.
#define SONAR_MIN_RANGE
The minimum range for the device to be able to measure.
void sonar_pwm_read(void)
struct MedianFilterFloat sonar_filt
uint16_t raw
raw PWM value
#define SONAR_OFFSET
The input channel of the PWM based sensor.