sonar_pwm

Driver for a PWM based sonar range sensor Reads sensor using PWM input and outputs sonar distance to object in [cm] Why PWM over ADC: One only needs to connect GND, VCC and one more signal wire, same as ADC but not the disadvantages of ADC sensors noise Sensor example: Maxbotix LV-EZ1

Configures

Name

Value

Description

SONAR_PWM_CHANNEL

PWM_INPUTx

Select PWM input channel for sensor to use e.g. PWM_INPUT1

Defines

Name

Value

Description

USE_SONAR

TRUE

Activate use of sonar in INS extended filter (only rotorcraft) or not if one only wants to measure distance

SONAR_OFFSET

0.1234

Sensor offset in CM, as in where one onts zero to be, default is 0

SONAR_SCALE

SONAR_PWM_PERIOD

Sensor scale

SONAR_MIN_RANGE

0.44

If defined, set limit to minimum value reported, default 0.15

SONAR_MAX_RANGE

3.0

If defined, set limit to maximum value reported, default 6.0

SONAR_COMPENSATE_ROTATION

TRUE

Compensate AGL for body rotation, if not defined, defaults to FALSE

SONAR_UPDATE_ON_AGL

TRUE

Updates the AGL value in state,if not defined, defaults to FALSE

SONAR_PWM_PERIOD

4096

period in microsec (e.g. 4096 for 12 bits sensor)

SONAR_PWM_OFFSET

20

initial offset on the raw pwm signal if needed (default: 820usec)

SONAR_USE_PWM_FILTER

TRUE

Enable or disable a median filter on the sensor output values

SONAR_MEDIAN_SIZE

9

If median filter is enabled then set this option to filter the output more(or less), default is 7

SENSOR_SYNC_SEND_SONAR

If defined, sends raw and scaled sonar values, useful for debugging sensor issues

Depends

  • pwm_meas

Provides

  • sonar