25 #ifndef STEREOCAM_GPS_ID
26 #define STEREOCAM_GPS_ID ABI_BROADCAST
32 #ifndef USE_DEROTATION_OPTICFLOW
33 #define USE_DEROTATION_OPTICFLOW FALSE
35 #ifndef STATE_MEASURE_OPTICFLOW
36 #define STATE_MEASURE_OPTICFLOW TRUE
47 uint32_t stamp __attribute__((unused)),
90 #if USE_DEROTATION_OPTICFLOW
94 float diff_flow_hor = dtheta * 128 / 1.04;
95 float diff_flow_ver = dphi * 96 / 0.785;
97 float diff_vel_hor = diff_flow_hor * agl_stereo * 12 * 1.04 / 128;
98 float diff_vel_ver = diff_flow_ver * agl_stereo * 12 * 0.785 / 96;
100 vel_x = - (vel_ver - diff_vel_ver);
101 vel_y = (vel_hor - diff_vel_hor);
109 #if STATE_MEASURE_OPTICFLOW
111 struct NedCoor_f coordinates_speed_state;
127 float vel_x_opti = -((float)(velocity_rot_gps.
y));
128 float vel_y_opti = ((float)(velocity_rot_gps.
x));
131 float vel_x_error = vel_x_opti - vel_x;
132 float vel_y_error = vel_y_opti - vel_y;
154 if (!(abs(vel_y) > 0.5 || abs(vel_x) > 0.5) || abs(dphi) > 0.05 || abs(dtheta) > 0.05) {
155 AbiSendMsgVELOCITY_ESTIMATE(
SENDER_ID, now_ts,
Event structure to store callbacks in a linked list.
static void stereocam_gps_cb(uint8_t sender_id, uint32_t stamp, struct GpsState *gps_s)
static struct FloatEulers * stateGetNedToBodyEulers_f(void)
Get vehicle body attitude euler angles (float).
Periodic telemetry system header (includes downlink utility and generated code).
Main include for ABI (AirBorneInterface).
void stereocam_to_state(float dphi, float dtheta)
void stereo_to_state_init(void)
#define STEREOCAM_GPS_ID
ABI binding for gps messages.
static uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
struct EcefCoor_i ecef_vel
static struct FloatRMat * stateGetNedToBodyRMat_f(void)
Get vehicle body attitude rotation matrix (float).
void float_rmat_vmult(struct FloatVect3 *vb, struct FloatRMat *m_a2b, struct FloatVect3 *va)
rotate 3D vector by rotation matrix.
vector in North East Down coordinates Units: meters
static struct NedCoor_f * stateGetSpeedNed_f(void)
Get ground speed in local NED coordinates (float).
data structure for GPS information
struct GpsStereoCam gps_stereocam
void stereo_to_state_periodic(void)
uint8array stereocam_data
#define DefaultChannel
SITL.
struct EcefCoor_i ecef_vel
speed ECEF in cm/s