39 #include "pprzlink/messages.h"
47 #define MAVLINK_OPTICAL_HEARTBEAT_MSG_ID 0
48 #define MAVLINK_OPTICAL_FLOW_MSG_ID 100
49 #define MAVLINK_OPTICAL_FLOW_RAD_MSG_ID 106
58 #ifndef PX4FLOW_QUALITY_THRESHOLD
59 #define PX4FLOW_QUALITY_THRESHOLD 0.1
80 static float quality = 0;
81 static float noise = 0;
85 noise = noise * noise;
104 float gain = (float)fabs( (
double) (cosf(phi) * cosf(theta)));
164 static float timestamp = 0;
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
static struct FloatEulers * stateGetNedToBodyEulers_f(void)
Get vehicle body attitude euler angles (float).
struct mavlink_optical_flow optical_flow
static void decode_optical_flow_msg(struct mavlink_message *msg)
Mavlink v1.0 message structure.
void px4flow_downlink(void)
Downlink message for debug.
#define AGL_SONAR_PX4FLOW_ID
static void decode_heartbeat_msg(struct mavlink_message *msg)
driver for the optical flow sensor PX4FLOW
Main include for ABI (AirBorneInterface).
int16_t flow_x
Flow in pixels in x-sensor direction.
#define MAVLINK_OPTICAL_FLOW_MSG_ID
struct mavlink_optical_flow_rad optical_flow_rad
float flow_comp_m_x
Flow in meters in x-sensor direction, angular-speed compensated [meters/sec].
float ground_distance
Ground distance in meters. Positive value: distance known. Negative value: Unknown distance...
static void decode_optical_flow_rad_msg(struct mavlink_message *msg)
According to https://pixhawk.org/modules/px4flow the PX4flow module outputs OPTICAL_FLOW_RAD message ...
static void mavlink_register_msg(struct mavlink_transport *t, struct mavlink_msg_req *req)
Register a callback for a mavlink message.
#define PX4FLOW_QUALITY_THRESHOLD
uint8_t sensor_id
Sensor ID.
struct mavlink_message msg
Mavlink message.
struct mavlink_msg_req req_heartbeat
void(* callback)(struct mavlink_message *msg)
Callback function.
uint8_t quality
Optical flow quality / confidence. 0: bad, 255: maximum quality.
bool px4flow_compensate_rotation
#define MAVLINK_OPTICAL_FLOW_RAD_MSG_ID
float flow_comp_m_y
Flow in meters in y-sensor direction, angular-speed compensated [meters/sec].
struct mavlink_transport mavlink_tp
Structure to submit a callback.
API to get/set the generic vehicle states.
struct mavlink_msg_req req_flow
uint8_t msg_id
Requested message ID.
Common code for AP and FBW telemetry.
uint64_t time_usec
Timestamp (UNIX)
struct mavlink_heartbeat heartbeat
uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
Mavlink optical flow structure.
uint8_t msg[10]
Buffer used for general comunication over SPI (out buffer)
struct mavlink_msg_req req_flow_rad
int16_t flow_y
Flow in pixels in y-sensor direction.
Mavlink optical flow rad structure.
simple decoder of mavlink message
#define MAVLINK_OPTICAL_HEARTBEAT_MSG_ID
void px4flow_init(void)
Initialization function.