Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
px4flow_i2c.c File Reference
#include "modules/optical_flow/px4flow_i2c.h"
#include "modules/core/abi.h"
#include "filters/median_filter.h"
#include "state.h"
#include "pprzlink/messages.h"
#include "modules/datalink/downlink.h"
Include dependency graph for px4flow_i2c.c:

Go to the source code of this file.

Macros

#define PX4FLOW_QUALITY_THRESHOLD   0.1
#define PX4FLOW_I2C_FRAME   0x0
#define PX4FLOW_I2C_INTEGRAL_FRAME   0x16
#define PX4FLOW_I2C_FRAME_LENGTH   22
#define PX4FLOW_I2C_INTEGRAL_FRAME_LENGTH   25
#define PX4FLOW_I2C_ID   0x4D

Functions

static void px4flow_i2c_frame_cb (void)
 Propagate optical flow information.
static void px4flow_i2c_int_frame_cb (void)
 Propagate itegral frame.
void px4flow_i2c_init (void)
 Initialization function.
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 150Hz (faster rate won't bring any finer resolution).
void px4flow_i2c_downlink (void)
 Downlink message for debug Copy volatile variables from the px4_i2c_frame for safety.

Variables

struct px4flow_data px4flow
struct MedianFilterInt sonar_filter

Macro Definition Documentation

◆ PX4FLOW_I2C_FRAME

#define PX4FLOW_I2C_FRAME   0x0

Definition at line 56 of file px4flow_i2c.c.

Referenced by px4flow_i2c_periodic().

◆ PX4FLOW_I2C_FRAME_LENGTH

#define PX4FLOW_I2C_FRAME_LENGTH   22

Definition at line 58 of file px4flow_i2c.c.

Referenced by px4flow_i2c_periodic().

◆ PX4FLOW_I2C_ID

#define PX4FLOW_I2C_ID   0x4D

Definition at line 60 of file px4flow_i2c.c.

Referenced by px4flow_i2c_downlink().

◆ PX4FLOW_I2C_INTEGRAL_FRAME

#define PX4FLOW_I2C_INTEGRAL_FRAME   0x16

Definition at line 57 of file px4flow_i2c.c.

Referenced by px4flow_i2c_periodic().

◆ PX4FLOW_I2C_INTEGRAL_FRAME_LENGTH

#define PX4FLOW_I2C_INTEGRAL_FRAME_LENGTH   25

Definition at line 59 of file px4flow_i2c.c.

Referenced by px4flow_i2c_periodic().

◆ PX4FLOW_QUALITY_THRESHOLD

#define PX4FLOW_QUALITY_THRESHOLD   0.1

Definition at line 49 of file px4flow_i2c.c.

Function Documentation

◆ px4flow_i2c_downlink()

void px4flow_i2c_downlink ( void )

Downlink message for debug Copy volatile variables from the px4_i2c_frame for safety.

Definition at line 264 of file px4flow_i2c.c.

References DefaultChannel, DefaultDevice, get_sys_time_float(), px4flow, and PX4FLOW_I2C_ID.

Here is the call graph for this function:

◆ px4flow_i2c_frame_cb()

void px4flow_i2c_frame_cb ( void )
inlinestatic

Propagate optical flow information.

Definition at line 65 of file px4flow_i2c.c.

References AGL_SONAR_PX4FLOW_ID, get_sys_time_float(), get_sys_time_usec(), FloatEulers::phi, px4flow, PX4FLOW_QUALITY_THRESHOLD, sonar_filter, stateGetNedToBodyEulers_f(), FloatEulers::theta, update_median_filter_i(), and VEL_PX4FLOW_ID.

Referenced by px4flow_i2c_periodic().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ px4flow_i2c_init()

void px4flow_i2c_init ( void )

Initialization function.

Definition at line 134 of file px4flow_i2c.c.

References I2CTransDone, init_median_filter_i(), px4flow, PX4FLOW_FRAME_REQ, PX4FLOW_INT_FRAME_REQ, and sonar_filter.

Here is the call graph for this function:

◆ px4flow_i2c_int_frame_cb()

void px4flow_i2c_int_frame_cb ( void )
inlinestatic

Propagate itegral frame.

Definition at line 125 of file px4flow_i2c.c.

Referenced by px4flow_i2c_periodic().

Here is the caller graph for this function:

◆ px4flow_i2c_periodic()

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 150Hz (faster rate won't bring any finer resolution).

Definition at line 155 of file px4flow_i2c.c.

References i2c_transceive(), i2c_transmit(), I2CTransSuccess, idx, px4flow, PX4FLOW_FRAME_REC, PX4FLOW_FRAME_REQ, PX4FLOW_I2C_FRAME, px4flow_i2c_frame_cb(), PX4FLOW_I2C_FRAME_LENGTH, px4flow_i2c_int_frame_cb(), PX4FLOW_I2C_INTEGRAL_FRAME, PX4FLOW_I2C_INTEGRAL_FRAME_LENGTH, PX4FLOW_INT_FRAME_REC, PX4FLOW_INT_FRAME_REC_OK, and PX4FLOW_INT_FRAME_REQ.

Here is the call graph for this function:

Variable Documentation

◆ px4flow

◆ sonar_filter

struct MedianFilterInt sonar_filter

Definition at line 54 of file px4flow_i2c.c.

Referenced by px4flow_i2c_frame_cb(), and px4flow_i2c_init().