38 #include "pprzlink/messages.h"
48 #ifndef PX4FLOW_QUALITY_THRESHOLD
49 #define PX4FLOW_QUALITY_THRESHOLD 0.1
56 #define PX4FLOW_I2C_FRAME 0x0
57 #define PX4FLOW_I2C_INTEGRAL_FRAME 0x16
58 #define PX4FLOW_I2C_FRAME_LENGTH 22
59 #define PX4FLOW_I2C_INTEGRAL_FRAME_LENGTH 25
60 #define PX4FLOW_I2C_ID 0x4D
67 static float quality = 0;
68 static float noise = 0;
71 noise = noise * noise;
73 static float timestamp = 0;
76 static float flow_comp_m_x = 0.0;
77 static float flow_comp_m_y = 0.0;
81 time_usec = (
uint32_t)(timestamp * 1e6);
97 static int32_t ground_distance = 0;
98 static float ground_distance_float = 0.0;
102 ground_distance_float = ((float)ground_distance) / 1000.0;
108 float gain = (float)fabs( (
double) (cosf(phi) * cosf(theta)));
109 ground_distance_float = ground_distance_float / gain;
135 #if REQUEST_INT_FRAME
268 #if REQUEST_INT_FRAME
272 float flow_comp_m_x = 0.0;
273 float flow_comp_m_y = 0.0;
#define PX4FLOW_I2C_INTEGRAL_FRAME_LENGTH
volatile uint8_t buf[I2C_BUF_LEN]
Transaction buffer With I2C_BUF_LEN number of bytes.
static struct FloatEulers * stateGetNedToBodyEulers_f(void)
Get vehicle body attitude euler angles (float).
transaction successfully finished by I2C driver
#define PX4FLOW_I2C_FRAME
uint32_t integration_timespan
#define AGL_SONAR_PX4FLOW_ID
int16_t gyro_y_rate_integral
Main include for ABI (AirBorneInterface).
#define PX4FLOW_I2C_INTEGRAL_FRAME
uint16_t frame_count_since_last_readout
#define PX4FLOW_VELOCITY_ID
int16_t pixel_flow_y_integral
struct i2c_transaction trans
static void px4flow_i2c_int_frame_cb(void)
Propagate itegral frame.
static float get_sys_time_float(void)
Get the time in seconds since startup.
void px4flow_i2c_init(void)
Initialization function.
#define PX4FLOW_I2C_FRAME_LENGTH
transaction set to done by user level
enum Px4FlowStatus status
struct px4flow_data px4flow
bool i2c_transceive(struct i2c_periph *p, struct i2c_transaction *t, uint8_t s_addr, uint8_t len_w, uint16_t len_r)
Submit a write/read transaction.
enum I2CTransactionStatus status
Transaction status.
int16_t gyro_x_rate_integral
bool i2c_transmit(struct i2c_periph *p, struct i2c_transaction *t, uint8_t s_addr, uint8_t len)
Submit a write only transaction.
static void px4flow_i2c_frame_cb(void)
Propagate optical flow information.
API to get/set the generic vehicle states.
#define PX4FLOW_QUALITY_THRESHOLD
Common code for AP and FBW telemetry.
struct px4flow_i2c_frame i2c_frame
struct MedianFilterInt sonar_filter
void px4flow_i2c_downlink(void)
Downlink message for debug Copy volatile variables from the px4_i2c_frame for safety.
int16_t gyro_z_rate_integral
struct px4flow_i2c_integral_frame i2c_int_frame
void px4flow_i2c_periodic(void)
Poll px4flow for data 152 i2c frames are created per second, so the PX4FLOW can be polled at up to 15...
int16_t pixel_flow_x_integral
if(PrimarySpektrumState.SpektrumTimer)