diff --git a/conf/abi.xml b/conf/abi.xml index e27227e45c..0afa505585 100644 --- a/conf/abi.xml +++ b/conf/abi.xml @@ -93,6 +93,11 @@ + + + + + diff --git a/conf/airframes/examples/ardrone2_gazebo.xml b/conf/airframes/examples/ardrone2_gazebo.xml index 6db02e1b3b..214f5763a4 100644 --- a/conf/airframes/examples/ardrone2_gazebo.xml +++ b/conf/airframes/examples/ardrone2_gazebo.xml @@ -36,6 +36,7 @@ + @@ -165,9 +166,9 @@
- - - + + +
@@ -177,9 +178,9 @@ - - - + + +
diff --git a/conf/conf_example.xml b/conf/conf_example.xml index 1cc7083575..95cf79c8e7 100644 --- a/conf/conf_example.xml +++ b/conf/conf_example.xml @@ -241,6 +241,17 @@ settings_modules="modules/video_rtp_stream.xml modules/geo_mag.xml modules/air_data.xml modules/gps_ubx_ucenter.xml modules/ins_extended.xml modules/ahrs_int_cmpl_quat.xml modules/stabilization_int_quat.xml modules/nav_basic_rotorcraft.xml modules/guidance_rotorcraft.xml modules/gps.xml modules/imu_common.xml" gui_color="red" /> + + + +
+ #include "autopilot_guided.h" + + // Useful Combination of the flags fir the autopilot_guided_update + #define GUIDED_FLAG_XY_VEL_BODY GUIDED_FLAG_XY_BODY|GUIDED_FLAG_XY_VEL + #define GUIDED_FLAG_XY_VEL_BODY_YAW_OFFSET GUIDED_FLAG_XY_BODY|GUIDED_FLAG_XY_VEL|GUIDED_FLAG_YAW_OFFSET + #define GUIDED_FLAG_XY_VEL_BODY_YAW_RATE GUIDED_FLAG_XY_BODY|GUIDED_FLAG_XY_VEL|GUIDED_FLAG_YAW_RATE + #define GUIDED_FLAG_XY_OFFSET_Z_VEL_YAW_OFFSET GUIDED_FLAG_XY_OFFSET|GUIDED_FLAG_Z_VEL|GUIDED_FLAG_YAW_OFFSET + #define GUIDED_FLAG_XY_OFFSET_YAW_OFFSET GUIDED_FLAG_XY_OFFSET|GUIDED_FLAG_YAW_OFFSET +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/sw/airborne/firmwares/rotorcraft/autopilot_guided.h b/sw/airborne/firmwares/rotorcraft/autopilot_guided.h index 6f7b5bd13c..0abf307648 100644 --- a/sw/airborne/firmwares/rotorcraft/autopilot_guided.h +++ b/sw/airborne/firmwares/rotorcraft/autopilot_guided.h @@ -96,9 +96,8 @@ extern void autopilot_guided_update(uint8_t flags, float x, float y, float z, fl #define GUIDED_FLAG_Z_OFFSET (1<<2) #define GUIDED_FLAG_YAW_OFFSET (1<<3) #define GUIDED_FLAG_XY_VEL (1<<5) -#define GUIDED_FLAG_2_VEL (1<<6) +#define GUIDED_FLAG_Z_VEL (1<<6) #define GUIDED_FLAG_YAW_RATE (1<<7) - #endif /* AUTOPILOT_GUIDED_H */ diff --git a/sw/airborne/modules/computer_vision/colorfilter.c b/sw/airborne/modules/computer_vision/colorfilter.c index 43bc02738b..fc496da74d 100644 --- a/sw/airborne/modules/computer_vision/colorfilter.c +++ b/sw/airborne/modules/computer_vision/colorfilter.c @@ -34,6 +34,12 @@ #endif PRINT_CONFIG_VAR(COLORFILTER_FPS) + +#ifndef COLORFILTER_SEND_OBSTACLE +#define COLORFILTER_SEND_OBSTACLE FALSE ///< Default sonar/agl to use in opticflow visual_estimator +#endif +PRINT_CONFIG_VAR(COLORFILTER_SEND_OBSTACLE) + struct video_listener *listener = NULL; // Filter Settings @@ -47,6 +53,10 @@ uint8_t color_cr_max = 255; // Result int color_count = 0; +#include "subsystems/abi.h" + + + // Function struct image_t *colorfilter_func(struct image_t *img); struct image_t *colorfilter_func(struct image_t *img) @@ -58,6 +68,17 @@ struct image_t *colorfilter_func(struct image_t *img) color_cr_min, color_cr_max ); + + if (COLORFILTER_SEND_OBSTACLE) { + if (color_count > 20) + AbiSendMsgOBSTACLE_DETECTION(CV_COLORDETECTION, 1, + 0); + else + AbiSendMsgOBSTACLE_DETECTION(CV_COLORDETECTION, 10, + 0); + + } + return img; // Colorfilter did not make a new image } diff --git a/sw/airborne/subsystems/abi_sender_ids.h b/sw/airborne/subsystems/abi_sender_ids.h index 3954a90435..8dc186fb2c 100644 --- a/sw/airborne/subsystems/abi_sender_ids.h +++ b/sw/airborne/subsystems/abi_sender_ids.h @@ -302,4 +302,14 @@ #define MAG_CALIB_UKF_ID 20 #endif + +/* + * IDs of Computer Vision Calculated variables + */ + +#ifndef CV_COLORDETECTION +#define CV_COLORDETECTION 1 +#endif + + #endif /* ABI_SENDER_IDS_H */ diff --git a/sw/tools/generators/gen_flight_plan.ml b/sw/tools/generators/gen_flight_plan.ml index d4064d188c..6143bf6cfb 100644 --- a/sw/tools/generators/gen_flight_plan.ml +++ b/sw/tools/generators/gen_flight_plan.ml @@ -1014,6 +1014,7 @@ let () = check_altitude (float_of_string alt) xml; check_altitude_srtm (float_of_string alt) xml !fp_wgs84; + Xml2h.define "NAV_DEFAULT_ALT" (sprintf "%.0f /* nominal altitude of the flight plan */" (float_of_string alt)); Xml2h.define "NAV_UTM_EAST0" (sprintf "%.0f" utm0.utm_x); Xml2h.define "NAV_UTM_NORTH0" (sprintf "%.0f" utm0.utm_y); Xml2h.define "NAV_UTM_ZONE0" (sprintf "%d" utm0.utm_zone);