diff --git a/conf/airframes/TUDelft/airframes/ardrone2_optitrack.xml b/conf/airframes/TUDelft/airframes/ardrone2_optitrack.xml index 86d311c5a5..98eca2c027 100644 --- a/conf/airframes/TUDelft/airframes/ardrone2_optitrack.xml +++ b/conf/airframes/TUDelft/airframes/ardrone2_optitrack.xml @@ -29,6 +29,7 @@ + diff --git a/conf/modules/stereocam_droplet.xml b/conf/modules/stereocam_droplet.xml index 8fc2c3353d..91e12b933c 100644 --- a/conf/modules/stereocam_droplet.xml +++ b/conf/modules/stereocam_droplet.xml @@ -5,12 +5,12 @@
- +
- - - - + + + + STEREO_UART ?= UART1 STEREO_BAUD ?= B9600 diff --git a/sw/airborne/modules/stereocam/droplet/stereocam_droplet.c b/sw/airborne/modules/stereocam/droplet/stereocam_droplet.c index 48a2367625..a9c18486a8 100644 --- a/sw/airborne/modules/stereocam/droplet/stereocam_droplet.c +++ b/sw/airborne/modules/stereocam/droplet/stereocam_droplet.c @@ -18,17 +18,17 @@ * . */ /** - * @file "modules/nav/constant_forward_flight.c" + * @file "modules/stereocam/droplet/stereocam_droplet.c" * @author C. DW * */ -#include "modules/nav/constant_forward_flight.h" +#include "modules/stereocam/droplet/stereocam_droplet.h" // Know waypoint numbers and blocks #include "generated/flight_plan.h" -#include "navigation.h" +#include "firmwares/rotorcraft/navigation.h" @@ -69,6 +69,7 @@ struct link_device *xdev = STEREO_PORT; struct AvoidNavigationStruct { uint8_t mode; ///< 0 = straight, 1 = right, 2 = left, ... uint8_t stereo_bin[8]; + uint8_t timeout; }; struct AvoidNavigationStruct avoid_navigation_data; @@ -84,16 +85,17 @@ static void stereo_parse(uint8_t c) { // Protocol is one byte only: store last instance avoid_navigation_data.stereo_bin[0] = c; + avoid_navigation_data.timeout = 20; } -void forward_flight_init(void) +void stereocam_droplet_init(void) { // Do nothing avoid_navigation_data.mode = 0; - + avoid_navigation_data.timeout = 0; } -void forward_flight_periodic(void) +void stereocam_droplet_periodic(void) { static float heading = 0; @@ -103,6 +105,11 @@ void forward_flight_periodic(void) stereo_parse(StereoGetch()); } + if (avoid_navigation_data.timeout <= 0) + return; + + avoid_navigation_data.timeout --; + // Results DOWNLINK_SEND_PAYLOAD(DefaultChannel, DefaultDevice, 1, avoid_navigation_data.stereo_bin); diff --git a/sw/airborne/modules/stereocam/droplet/stereocam_droplet.h b/sw/airborne/modules/stereocam/droplet/stereocam_droplet.h index 4a431a3920..8450d53c2c 100644 --- a/sw/airborne/modules/stereocam/droplet/stereocam_droplet.h +++ b/sw/airborne/modules/stereocam/droplet/stereocam_droplet.h @@ -18,18 +18,18 @@ * . */ /** - * @file "modules/nav/constant_forward_flight.h" + * @file "modules/stereocam/droplet/stereocam_droplet.h" * @author C. DW * */ -#ifndef CONSTANT_FORWARD_FLIGHT_H -#define CONSTANT_FORWARD_FLIGHT_H +#ifndef STEREOCAM_DROPLET_H +#define STEREOCAM_DROPLET_H -extern void forward_flight_init(void); -extern void forward_flight_periodic(void); +extern void stereocam_droplet_init(void); +extern void stereocam_droplet_periodic(void); #endif