From d595b8e4d70bb487b6d75622693d54ef754ca8f0 Mon Sep 17 00:00:00 2001 From: Freek van Tienen Date: Thu, 9 Apr 2015 20:46:19 +0200 Subject: [PATCH] [doc] Correct some doxygen comments --- sw/airborne/arch/stm32/mcu_periph/adc_arch.c | 18 ++++---- sw/airborne/boards/ardrone/navdata.h | 16 +++---- sw/airborne/mcu_periph/udp.c | 24 +++++------ .../modules/computer_vision/lib/v4l/v4l2.h | 26 ++++++------ .../computer_vision/lib/vision/image.h | 32 +++++++------- .../opticflow/inter_thread_data.h | 24 +++++------ .../opticflow/opticflow_calculator.c | 24 +++++------ .../opticflow/opticflow_calculator.h | 28 ++++++------- .../opticflow/stabilization_opticflow.c | 12 +++--- .../opticflow/stabilization_opticflow.h | 18 ++++---- .../computer_vision/opticflow_module.c | 42 +++++++++---------- .../modules/computer_vision/viewvideo.c | 30 ++++++------- .../modules/computer_vision/viewvideo.h | 16 +++---- sw/airborne/subsystems/datalink/superbitrf.c | 18 ++++---- 14 files changed, 164 insertions(+), 164 deletions(-) diff --git a/sw/airborne/arch/stm32/mcu_periph/adc_arch.c b/sw/airborne/arch/stm32/mcu_periph/adc_arch.c index 7613f4d841..839dfdbfbe 100644 --- a/sw/airborne/arch/stm32/mcu_periph/adc_arch.c +++ b/sw/airborne/arch/stm32/mcu_periph/adc_arch.c @@ -231,39 +231,39 @@ void adc_init(void) /* Init GPIO ports for ADC operation */ #if USE_ADC_1 - PRINT_CONFIG_MSG("Info: Using ADC_1"); + PRINT_CONFIG_MSG("Info: Using ADC_1") gpio_setup_pin_analog(ADC_1_GPIO_PORT, ADC_1_GPIO_PIN); #endif #if USE_ADC_2 - PRINT_CONFIG_MSG("Info: Using ADC_2"); + PRINT_CONFIG_MSG("Info: Using ADC_2") gpio_setup_pin_analog(ADC_2_GPIO_PORT, ADC_2_GPIO_PIN); #endif #if USE_ADC_3 - PRINT_CONFIG_MSG("Info: Using ADC_3"); + PRINT_CONFIG_MSG("Info: Using ADC_3") gpio_setup_pin_analog(ADC_3_GPIO_PORT, ADC_3_GPIO_PIN); #endif #if USE_ADC_4 - PRINT_CONFIG_MSG("Info: Using ADC_4"); + PRINT_CONFIG_MSG("Info: Using ADC_4") gpio_setup_pin_analog(ADC_4_GPIO_PORT, ADC_4_GPIO_PIN); #endif #if USE_ADC_5 - PRINT_CONFIG_MSG("Info: Using ADC_5"); + PRINT_CONFIG_MSG("Info: Using ADC_5") gpio_setup_pin_analog(ADC_5_GPIO_PORT, ADC_5_GPIO_PIN); #endif #if USE_ADC_6 - PRINT_CONFIG_MSG("Info: Using ADC_6"); + PRINT_CONFIG_MSG("Info: Using ADC_6") gpio_setup_pin_analog(ADC_6_GPIO_PORT, ADC_6_GPIO_PIN); #endif #if USE_ADC_7 - PRINT_CONFIG_MSG("Info: Using ADC_7"); + PRINT_CONFIG_MSG("Info: Using ADC_7") gpio_setup_pin_analog(ADC_7_GPIO_PORT, ADC_7_GPIO_PIN); #endif #if USE_ADC_8 - PRINT_CONFIG_MSG("Info: Using ADC_8"); + PRINT_CONFIG_MSG("Info: Using ADC_8") gpio_setup_pin_analog(ADC_8_GPIO_PORT, ADC_8_GPIO_PIN); #endif #if USE_ADC_9 - PRINT_CONFIG_MSG("Info: Using ADC_9"); + PRINT_CONFIG_MSG("Info: Using ADC_9") gpio_setup_pin_analog(ADC_9_GPIO_PORT, ADC_9_GPIO_PIN); #endif diff --git a/sw/airborne/boards/ardrone/navdata.h b/sw/airborne/boards/ardrone/navdata.h index 9550c8d5fd..3017c4d131 100644 --- a/sw/airborne/boards/ardrone/navdata.h +++ b/sw/airborne/boards/ardrone/navdata.h @@ -109,8 +109,8 @@ struct bmp180_calib_t { /* Main navdata structure */ struct navdata_t { - bool_t is_initialized; //< Check if the navdata board is initialized - int fd; //< The navdata file pointer + bool_t is_initialized; ///< Check if the navdata board is initialized + int fd; ///< The navdata file pointer uint32_t totalBytesRead; uint32_t packetsRead; @@ -118,13 +118,13 @@ struct navdata_t { uint32_t lost_imu_frames; uint16_t last_packet_number; - struct navdata_measure_t measure; //< Main navdata packet receieved from navboard - struct bmp180_calib_t bmp180_calib; //< BMP180 calibration receieved from navboard + struct navdata_measure_t measure; ///< Main navdata packet receieved from navboard + struct bmp180_calib_t bmp180_calib; ///< BMP180 calibration receieved from navboard - bool_t baro_calibrated; //< Whenever the baro is calibrated - bool_t imu_available; //< Whenever the imu is available - bool_t baro_available; //< Whenever the baro is available - bool_t imu_lost; //< Whenever the imu is lost + bool_t baro_calibrated; ///< Whenever the baro is calibrated + bool_t imu_available; ///< Whenever the imu is available + bool_t baro_available; ///< Whenever the baro is available + bool_t imu_lost; ///< Whenever the imu is lost }; extern struct navdata_t navdata; diff --git a/sw/airborne/mcu_periph/udp.c b/sw/airborne/mcu_periph/udp.c index d953a7de11..1375174d94 100644 --- a/sw/airborne/mcu_periph/udp.c +++ b/sw/airborne/mcu_periph/udp.c @@ -30,26 +30,26 @@ /* Print the configurations */ #if USE_UDP0 struct udp_periph udp0; -PRINT_CONFIG_VAR(UDP0_HOST); -PRINT_CONFIG_VAR(UDP0_PORT_OUT); -PRINT_CONFIG_VAR(UDP0_PORT_IN); -PRINT_CONFIG_VAR(UDP0_BROADCAST); +PRINT_CONFIG_VAR(UDP0_HOST) +PRINT_CONFIG_VAR(UDP0_PORT_OUT) +PRINT_CONFIG_VAR(UDP0_PORT_IN) +PRINT_CONFIG_VAR(UDP0_BROADCAST) #endif // USE_UDP0 #if USE_UDP1 struct udp_periph udp1; -PRINT_CONFIG_VAR(UDP1_HOST); -PRINT_CONFIG_VAR(UDP1_PORT_OUT); -PRINT_CONFIG_VAR(UDP1_PORT_IN); -PRINT_CONFIG_VAR(UDP1_BROADCAST); +PRINT_CONFIG_VAR(UDP1_HOST) +PRINT_CONFIG_VAR(UDP1_PORT_OUT) +PRINT_CONFIG_VAR(UDP1_PORT_IN) +PRINT_CONFIG_VAR(UDP1_BROADCAST) #endif // USE_UDP1 #if USE_UDP2 struct udp_periph udp2; -PRINT_CONFIG_VAR(UDP2_HOST); -PRINT_CONFIG_VAR(UDP2_PORT_OUT); -PRINT_CONFIG_VAR(UDP2_PORT_IN); -PRINT_CONFIG_VAR(UDP2_BROADCAST); +PRINT_CONFIG_VAR(UDP2_HOST) +PRINT_CONFIG_VAR(UDP2_PORT_OUT) +PRINT_CONFIG_VAR(UDP2_PORT_IN) +PRINT_CONFIG_VAR(UDP2_BROADCAST) #endif // USE_UDP2 /** diff --git a/sw/airborne/modules/computer_vision/lib/v4l/v4l2.h b/sw/airborne/modules/computer_vision/lib/v4l/v4l2.h index 4b900056c3..a428ed9070 100644 --- a/sw/airborne/modules/computer_vision/lib/v4l/v4l2.h +++ b/sw/airborne/modules/computer_vision/lib/v4l/v4l2.h @@ -35,26 +35,26 @@ #include "std.h" #include "lib/vision/image.h" -#define V4L2_IMG_NONE 255 //< There currently no image available +#define V4L2_IMG_NONE 255 ///< There currently no image available /* V4L2 memory mapped image buffer */ struct v4l2_img_buf { - size_t length; //< The size of the buffer - struct timeval timestamp; //< The time value of the image - void *buf; //< Pointer to the memory mapped buffer + size_t length; ///< The size of the buffer + struct timeval timestamp; ///< The time value of the image + void *buf; ///< Pointer to the memory mapped buffer }; /* V4L2 device */ struct v4l2_device { - char *name; //< The name of the device - int fd; //< The file pointer to the device - pthread_t thread; //< The thread that handles the images - uint16_t w; //< The width of the image - uint16_t h; //< The height of the image - uint8_t buffers_cnt; //< The number of image buffers - volatile uint8_t buffers_deq_idx; //< The current dequeued index - pthread_mutex_t mutex; //< Mutex lock for enqueue/dequeue of buffers (change the deq_idx) - struct v4l2_img_buf *buffers; //< The memory mapped image buffers + char *name; ///< The name of the device + int fd; ///< The file pointer to the device + pthread_t thread; ///< The thread that handles the images + uint16_t w; ///< The width of the image + uint16_t h; ///< The height of the image + uint8_t buffers_cnt; ///< The number of image buffers + volatile uint8_t buffers_deq_idx; ///< The current dequeued index + pthread_mutex_t mutex; ///< Mutex lock for enqueue/dequeue of buffers (change the deq_idx) + struct v4l2_img_buf *buffers; ///< The memory mapped image buffers }; /* External functions */ diff --git a/sw/airborne/modules/computer_vision/lib/vision/image.h b/sw/airborne/modules/computer_vision/lib/vision/image.h index 270ea0a3f9..ea5ca5009b 100644 --- a/sw/airborne/modules/computer_vision/lib/vision/image.h +++ b/sw/airborne/modules/computer_vision/lib/vision/image.h @@ -32,35 +32,35 @@ /* The different type of images we currently support */ enum image_type { - IMAGE_YUV422, //< UYVY format (uint16 per pixel) - IMAGE_GRAYSCALE, //< Grayscale image with only the Y part (uint8 per pixel) - IMAGE_JPEG, //< An JPEG encoded image (not per pixel encoded) - IMAGE_GRADIENT //< An image gradient (int16 per pixel) + IMAGE_YUV422, ///< UYVY format (uint16 per pixel) + IMAGE_GRAYSCALE, ///< Grayscale image with only the Y part (uint8 per pixel) + IMAGE_JPEG, ///< An JPEG encoded image (not per pixel encoded) + IMAGE_GRADIENT ///< An image gradient (int16 per pixel) }; /* Main image structure */ struct image_t { - enum image_type type; //< The image type - uint16_t w; //< Image width - uint16_t h; //< Image height - struct timeval ts; //< The timestamp of creation + enum image_type type; ///< The image type + uint16_t w; ///< Image width + uint16_t h; ///< Image height + struct timeval ts; ///< The timestamp of creation - uint8_t buf_idx; //< Buffer index for V4L2 freeing - uint32_t buf_size; //< The buffer size - void *buf; //< Image buffer (depending on the image_type) + uint8_t buf_idx; ///< Buffer index for V4L2 freeing + uint32_t buf_size; ///< The buffer size + void *buf; ///< Image buffer (depending on the image_type) }; /* Image point structure */ struct point_t { - uint16_t x; //< The x coordinate of the point - uint16_t y; //< The y coordinate of the point + uint16_t x; ///< The x coordinate of the point + uint16_t y; ///< The y coordinate of the point }; /* Vector structure for point differences */ struct flow_t { - struct point_t pos; //< The original position the flow comes from - int16_t flow_x; //< The x direction flow in subpixels - int16_t flow_y; //< The y direction flow in subpixels + struct point_t pos; ///< The original position the flow comes from + int16_t flow_x; ///< The x direction flow in subpixels + int16_t flow_y; ///< The y direction flow in subpixels }; /* Usefull image functions */ diff --git a/sw/airborne/modules/computer_vision/opticflow/inter_thread_data.h b/sw/airborne/modules/computer_vision/opticflow/inter_thread_data.h index f1195d24ec..50330a70b3 100644 --- a/sw/airborne/modules/computer_vision/opticflow/inter_thread_data.h +++ b/sw/airborne/modules/computer_vision/opticflow/inter_thread_data.h @@ -31,24 +31,24 @@ /* The result calculated from the opticflow */ struct opticflow_result_t { - float fps; //< Frames per second of the optical flow calculation - uint16_t corner_cnt; //< The amount of coners found by FAST9 - uint16_t tracked_cnt; //< The amount of tracked corners + float fps; ///< Frames per second of the optical flow calculation + uint16_t corner_cnt; ///< The amount of coners found by FAST9 + uint16_t tracked_cnt; ///< The amount of tracked corners - int16_t flow_x; //< Flow in x direction from the camera (in subpixels) - int16_t flow_y; //< Flow in y direction from the camera (in subpixels) - int16_t flow_der_x; //< The derotated flow calculation in the x direction (in subpixels) - int16_t flow_der_y; //< The derotated flow calculation in the y direction (in subpixels) + int16_t flow_x; ///< Flow in x direction from the camera (in subpixels) + int16_t flow_y; ///< Flow in y direction from the camera (in subpixels) + int16_t flow_der_x; ///< The derotated flow calculation in the x direction (in subpixels) + int16_t flow_der_y; ///< The derotated flow calculation in the y direction (in subpixels) - float vel_x; //< The velocity in the x direction - float vel_y; //< The velocity in the y direction + float vel_x; ///< The velocity in the x direction + float vel_y; ///< The velocity in the y direction }; /* The state of the drone when it took an image */ struct opticflow_state_t { - float phi; //< roll [rad] - float theta; //< pitch [rad] - float agl; //< height above ground [m] + float phi; ///< roll [rad] + float theta; ///< pitch [rad] + float agl; ///< height above ground [m] }; #endif diff --git a/sw/airborne/modules/computer_vision/opticflow/opticflow_calculator.c b/sw/airborne/modules/computer_vision/opticflow/opticflow_calculator.c index bbe556c124..653a79fccf 100644 --- a/sw/airborne/modules/computer_vision/opticflow/opticflow_calculator.c +++ b/sw/airborne/modules/computer_vision/opticflow/opticflow_calculator.c @@ -44,63 +44,63 @@ #ifndef OPTICFLOW_FOV_W #define OPTICFLOW_FOV_W 0.89360857702 #endif -PRINT_CONFIG_VAR(OPTICFLOW_FOV_W); +PRINT_CONFIG_VAR(OPTICFLOW_FOV_W) #ifndef OPTICFLOW_FOV_H #define OPTICFLOW_FOV_H 0.67020643276 #endif -PRINT_CONFIG_VAR(OPTICFLOW_FOV_H); +PRINT_CONFIG_VAR(OPTICFLOW_FOV_H) #ifndef OPTICFLOW_FX #define OPTICFLOW_FX 343.1211 #endif -PRINT_CONFIG_VAR(OPTICFLOW_FX); +PRINT_CONFIG_VAR(OPTICFLOW_FX) #ifndef OPTICFLOW_FY #define OPTICFLOW_FY 348.5053 #endif -PRINT_CONFIG_VAR(OPTICFLOW_FY); +PRINT_CONFIG_VAR(OPTICFLOW_FY) /* Set the default values */ #ifndef OPTICFLOW_MAX_TRACK_CORNERS #define OPTICFLOW_MAX_TRACK_CORNERS 25 #endif -PRINT_CONFIG_VAR(OPTICFLOW_MAX_TRACK_CORNERS); +PRINT_CONFIG_VAR(OPTICFLOW_MAX_TRACK_CORNERS) #ifndef OPTICFLOW_WINDOW_SIZE #define OPTICFLOW_WINDOW_SIZE 10 #endif -PRINT_CONFIG_VAR(OPTICFLOW_WINDOW_SIZE); +PRINT_CONFIG_VAR(OPTICFLOW_WINDOW_SIZE) #ifndef OPTICFLOW_SUBPIXEL_FACTOR #define OPTICFLOW_SUBPIXEL_FACTOR 10 #endif -PRINT_CONFIG_VAR(OPTICFLOW_SUBPIXEL_FACTOR); +PRINT_CONFIG_VAR(OPTICFLOW_SUBPIXEL_FACTOR) #ifndef OPTICFLOW_MAX_ITERATIONS #define OPTICFLOW_MAX_ITERATIONS 10 #endif -PRINT_CONFIG_VAR(OPTICFLOW_MAX_ITERATIONS); +PRINT_CONFIG_VAR(OPTICFLOW_MAX_ITERATIONS) #ifndef OPTICFLOW_THRESHOLD_VEC #define OPTICFLOW_THRESHOLD_VEC 2 #endif -PRINT_CONFIG_VAR(OPTICFLOW_THRESHOLD_VEC); +PRINT_CONFIG_VAR(OPTICFLOW_THRESHOLD_VEC) #ifndef OPTICFLOW_FAST9_ADAPTIVE #define OPTICFLOW_FAST9_ADAPTIVE TRUE #endif -PRINT_CONFIG_VAR(OPTICFLOW_FAST9_ADAPTIVE); +PRINT_CONFIG_VAR(OPTICFLOW_FAST9_ADAPTIVE) #ifndef OPTICFLOW_FAST9_THRESHOLD #define OPTICFLOW_FAST9_THRESHOLD 20 #endif -PRINT_CONFIG_VAR(OPTICFLOW_FAST9_THRESHOLD); +PRINT_CONFIG_VAR(OPTICFLOW_FAST9_THRESHOLD) #ifndef OPTICFLOW_FAST9_MIN_DISTANCE #define OPTICFLOW_FAST9_MIN_DISTANCE 10 #endif -PRINT_CONFIG_VAR(OPTICFLOW_FAST9_MIN_DISTANCE); +PRINT_CONFIG_VAR(OPTICFLOW_FAST9_MIN_DISTANCE) /* Functions only used here */ static uint32_t timeval_diff(struct timeval *starttime, struct timeval *finishtime); diff --git a/sw/airborne/modules/computer_vision/opticflow/opticflow_calculator.h b/sw/airborne/modules/computer_vision/opticflow/opticflow_calculator.h index a1ce65b570..bca8bb973e 100644 --- a/sw/airborne/modules/computer_vision/opticflow/opticflow_calculator.h +++ b/sw/airborne/modules/computer_vision/opticflow/opticflow_calculator.h @@ -35,22 +35,22 @@ #include "lib/v4l/v4l2.h" struct opticflow_t { - bool_t got_first_img; //< If we got a image to work with - float prev_phi; //< Phi from the previous image frame - float prev_theta; //< Theta from the previous image frame - struct image_t img_gray; //< Current gray image frame - struct image_t prev_img_gray; //< Previous gray image frame - struct timeval prev_timestamp; //< Timestamp of the previous frame, used for FPS calculation + bool_t got_first_img; ///< If we got a image to work with + float prev_phi; ///< Phi from the previous image frame + float prev_theta; ///< Theta from the previous image frame + struct image_t img_gray; ///< Current gray image frame + struct image_t prev_img_gray; ///< Previous gray image frame + struct timeval prev_timestamp; ///< Timestamp of the previous frame, used for FPS calculation - uint8_t max_track_corners; //< Maximum amount of corners Lucas Kanade should track - uint16_t window_size; //< Window size of the Lucas Kanade calculation (needs to be even) - uint8_t subpixel_factor; //< The amount of subpixels per pixel - uint8_t max_iterations; //< The maximum amount of iterations the Lucas Kanade algorithm should do - uint8_t threshold_vec; //< The threshold in x, y subpixels which the algorithm should stop + uint8_t max_track_corners; ///< Maximum amount of corners Lucas Kanade should track + uint16_t window_size; ///< Window size of the Lucas Kanade calculation (needs to be even) + uint8_t subpixel_factor; ///< The amount of subpixels per pixel + uint8_t max_iterations; ///< The maximum amount of iterations the Lucas Kanade algorithm should do + uint8_t threshold_vec; ///< The threshold in x, y subpixels which the algorithm should stop - bool_t fast9_adaptive; //< Whether the FAST9 threshold should be adaptive - uint8_t fast9_threshold; //< FAST9 corner detection threshold - uint16_t fast9_min_distance; //< Minimum distance in pixels between corners + bool_t fast9_adaptive; ///< Whether the FAST9 threshold should be adaptive + uint8_t fast9_threshold; ///< FAST9 corner detection threshold + uint16_t fast9_min_distance; ///< Minimum distance in pixels between corners }; diff --git a/sw/airborne/modules/computer_vision/opticflow/stabilization_opticflow.c b/sw/airborne/modules/computer_vision/opticflow/stabilization_opticflow.c index 16c53e8cd3..d25f36d850 100644 --- a/sw/airborne/modules/computer_vision/opticflow/stabilization_opticflow.c +++ b/sw/airborne/modules/computer_vision/opticflow/stabilization_opticflow.c @@ -41,32 +41,32 @@ #ifndef VISION_PHI_PGAIN #define VISION_PHI_PGAIN 400 #endif -PRINT_CONFIG_VAR(VISION_PHI_PGAIN); +PRINT_CONFIG_VAR(VISION_PHI_PGAIN) #ifndef VISION_PHI_IGAIN #define VISION_PHI_IGAIN 20 #endif -PRINT_CONFIG_VAR(VISION_PHI_IGAIN); +PRINT_CONFIG_VAR(VISION_PHI_IGAIN) #ifndef VISION_THETA_PGAIN #define VISION_THETA_PGAIN 400 #endif -PRINT_CONFIG_VAR(VISION_THETA_PGAIN); +PRINT_CONFIG_VAR(VISION_THETA_PGAIN) #ifndef VISION_THETA_IGAIN #define VISION_THETA_IGAIN 20 #endif -PRINT_CONFIG_VAR(VISION_THETA_IGAIN); +PRINT_CONFIG_VAR(VISION_THETA_IGAIN) #ifndef VISION_DESIRED_VX #define VISION_DESIRED_VX 0 #endif -PRINT_CONFIG_VAR(VISION_DESIRED_VX); +PRINT_CONFIG_VAR(VISION_DESIRED_VX) #ifndef VISION_DESIRED_VY #define VISION_DESIRED_VY 0 #endif -PRINT_CONFIG_VAR(VISION_DESIRED_VY); +PRINT_CONFIG_VAR(VISION_DESIRED_VY) /* Check the control gains */ #if (VISION_PHI_PGAIN < 0) || \ diff --git a/sw/airborne/modules/computer_vision/opticflow/stabilization_opticflow.h b/sw/airborne/modules/computer_vision/opticflow/stabilization_opticflow.h index 13eee91316..c897c6f5af 100644 --- a/sw/airborne/modules/computer_vision/opticflow/stabilization_opticflow.h +++ b/sw/airborne/modules/computer_vision/opticflow/stabilization_opticflow.h @@ -37,16 +37,16 @@ /* The opticflow stabilization */ struct opticflow_stab_t { - int32_t phi_pgain; //< The roll P gain on the err_vx - int32_t phi_igain; //< The roll I gain on the err_vx_int - int32_t theta_pgain; //< The pitch P gain on the err_vy - int32_t theta_igain; //< The pitch I gain on the err_vy_int - float desired_vx; //< The desired velocity in the x direction (cm/s) - float desired_vy; //< The desired velocity in the y direction (cm/s) + int32_t phi_pgain; ///< The roll P gain on the err_vx + int32_t phi_igain; ///< The roll I gain on the err_vx_int + int32_t theta_pgain; ///< The pitch P gain on the err_vy + int32_t theta_igain; ///< The pitch I gain on the err_vy_int + float desired_vx; ///< The desired velocity in the x direction (cm/s) + float desired_vy; ///< The desired velocity in the y direction (cm/s) - float err_vx_int; //< The integrated velocity error in x direction (m/s) - float err_vy_int; //< The integrated velocity error in y direction (m/s) - struct Int32Eulers cmd; //< The commands that are send to the hover loop + float err_vx_int; ///< The integrated velocity error in x direction (m/s) + float err_vy_int; ///< The integrated velocity error in y direction (m/s) + struct Int32Eulers cmd; ///< The commands that are send to the hover loop }; extern struct opticflow_stab_t opticflow_stab; diff --git a/sw/airborne/modules/computer_vision/opticflow_module.c b/sw/airborne/modules/computer_vision/opticflow_module.c index 1ad3e45640..ec41f246c7 100644 --- a/sw/airborne/modules/computer_vision/opticflow_module.c +++ b/sw/airborne/modules/computer_vision/opticflow_module.c @@ -37,45 +37,45 @@ #include "lib/encoding/jpeg.h" #include "lib/encoding/rtp.h" -/* default sonar/agl to use in opticflow visual_estimator */ +/* Default sonar/agl to use in opticflow visual_estimator */ #ifndef OPTICFLOW_AGL_ID -#define OPTICFLOW_AGL_ID ABI_BROADCAST +#define OPTICFLOW_AGL_ID ABI_BROADCAST ///< Default sonar/agl to use in opticflow visual_estimator #endif -PRINT_CONFIG_VAR(OPTICFLOW_AGL_ID); +PRINT_CONFIG_VAR(OPTICFLOW_AGL_ID) /* The video device */ #ifndef OPTICFLOW_DEVICE -#define OPTICFLOW_DEVICE /dev/video2 +#define OPTICFLOW_DEVICE /dev/video2 ///< The video device #endif -PRINT_CONFIG_VAR(OPTICFLOW_DEVICE); +PRINT_CONFIG_VAR(OPTICFLOW_DEVICE) /* The video device size (width, height) */ #ifndef OPTICFLOW_DEVICE_SIZE -#define OPTICFLOW_DEVICE_SIZE 320,240 +#define OPTICFLOW_DEVICE_SIZE 320,240 ///< The video device size (width, height) #endif #define __SIZE_HELPER(x, y) #x", "#y #define _SIZE_HELPER(x) __SIZE_HELPER(x) -PRINT_CONFIG_MSG("OPTICFLOW_DEVICE_SIZE = " _SIZE_HELPER(OPTICFLOW_DEVICE_SIZE)); +PRINT_CONFIG_MSG("OPTICFLOW_DEVICE_SIZE = " _SIZE_HELPER(OPTICFLOW_DEVICE_SIZE)) /* The video device buffers (the amount of V4L2 buffers) */ #ifndef OPTICFLOW_DEVICE_BUFFERS -#define OPTICFLOW_DEVICE_BUFFERS 15 +#define OPTICFLOW_DEVICE_BUFFERS 15 ///< The video device buffers (the amount of V4L2 buffers) #endif -PRINT_CONFIG_VAR(VIEWVIDEO_DEVICE_BUFFERS); +PRINT_CONFIG_VAR(VIEWVIDEO_DEVICE_BUFFERS) /* The main opticflow variables */ -struct opticflow_t opticflow; //< Opticflow calculations -static struct opticflow_result_t opticflow_result; //< The opticflow result -static struct opticflow_state_t opticflow_state; //< State of the drone to communicate with the opticflow -static struct v4l2_device *opticflow_dev; //< The opticflow camera V4L2 device -static abi_event opticflow_agl_ev; //< The altitude ABI event -static pthread_t opticflow_calc_thread; //< The optical flow calculation thread -static bool_t opticflow_got_result; //< When we have an optical flow calculation -static pthread_mutex_t opticflow_mutex; //< Mutex lock fo thread safety +struct opticflow_t opticflow; ///< Opticflow calculations +static struct opticflow_result_t opticflow_result; ///< The opticflow result +static struct opticflow_state_t opticflow_state; ///< State of the drone to communicate with the opticflow +static struct v4l2_device *opticflow_dev; ///< The opticflow camera V4L2 device +static abi_event opticflow_agl_ev; ///< The altitude ABI event +static pthread_t opticflow_calc_thread; ///< The optical flow calculation thread +static bool_t opticflow_got_result; ///< When we have an optical flow calculation +static pthread_mutex_t opticflow_mutex; ///< Mutex lock fo thread safety /* Static functions */ -static void *opticflow_module_calc(void *data); //< The main optical flow calculation thread -static void opticflow_agl_cb(uint8_t sender_id, float distance); //< Callback function of the ground altitude +static void *opticflow_module_calc(void *data); ///< The main optical flow calculation thread +static void opticflow_agl_cb(uint8_t sender_id, float distance); ///< Callback function of the ground altitude #if PERIODIC_TELEMETRY #include "subsystems/datalink/telemetry.h" @@ -116,8 +116,8 @@ void opticflow_module_init(void) opticflow_got_result = FALSE; #ifdef OPTICFLOW_SUBDEV - PRINT_CONFIG_MSG("[opticflow_module] Configuring a subdevice!"); - PRINT_CONFIG_VAR(OPTICFLOW_SUBDEV); + PRINT_CONFIG_MSG("[opticflow_module] Configuring a subdevice!") + PRINT_CONFIG_VAR(OPTICFLOW_SUBDEV) /* Initialize the V4L2 subdevice (TODO: fix hardcoded path, which and code) */ if (!v4l2_init_subdev(STRINGIFY(OPTICFLOW_SUBDEV), 0, 1, V4L2_MBUS_FMT_UYVY8_2X8, OPTICFLOW_DEVICE_SIZE)) { diff --git a/sw/airborne/modules/computer_vision/viewvideo.c b/sw/airborne/modules/computer_vision/viewvideo.c index 880ff8dba0..7ce32339a9 100644 --- a/sw/airborne/modules/computer_vision/viewvideo.c +++ b/sw/airborne/modules/computer_vision/viewvideo.c @@ -53,7 +53,7 @@ #ifndef VIEWVIDEO_DEVICE #define VIEWVIDEO_DEVICE /dev/video1 #endif -PRINT_CONFIG_VAR(VIEWVIDEO_DEVICE); +PRINT_CONFIG_VAR(VIEWVIDEO_DEVICE) // The video device size (width, height) #ifndef VIEWVIDEO_DEVICE_SIZE @@ -61,58 +61,58 @@ PRINT_CONFIG_VAR(VIEWVIDEO_DEVICE); #endif #define __SIZE_HELPER(x, y) #x", "#y #define _SIZE_HELPER(x) __SIZE_HELPER(x) -PRINT_CONFIG_MSG("VIEWVIDEO_DEVICE_SIZE = " _SIZE_HELPER(VIEWVIDEO_DEVICE_SIZE)); +PRINT_CONFIG_MSG("VIEWVIDEO_DEVICE_SIZE = " _SIZE_HELPER(VIEWVIDEO_DEVICE_SIZE)) // The video device buffers (the amount of V4L2 buffers) #ifndef VIEWVIDEO_DEVICE_BUFFERS #define VIEWVIDEO_DEVICE_BUFFERS 10 #endif -PRINT_CONFIG_VAR(VIEWVIDEO_DEVICE_BUFFERS); +PRINT_CONFIG_VAR(VIEWVIDEO_DEVICE_BUFFERS) // Downsize factor for video stream #ifndef VIEWVIDEO_DOWNSIZE_FACTOR #define VIEWVIDEO_DOWNSIZE_FACTOR 4 #endif -PRINT_CONFIG_VAR(VIEWVIDEO_DOWNSIZE_FACTOR); +PRINT_CONFIG_VAR(VIEWVIDEO_DOWNSIZE_FACTOR) // From 0 to 99 (99=high) #ifndef VIEWVIDEO_QUALITY_FACTOR #define VIEWVIDEO_QUALITY_FACTOR 50 #endif -PRINT_CONFIG_VAR(VIEWVIDEO_QUALITY_FACTOR); +PRINT_CONFIG_VAR(VIEWVIDEO_QUALITY_FACTOR) // RTP time increment at 90kHz (default: 0 for automatic) #ifndef VIEWVIDEO_RTP_TIME_INC #define VIEWVIDEO_RTP_TIME_INC 0 #endif -PRINT_CONFIG_VAR(VIEWVIDEO_RTP_TIME_INC); +PRINT_CONFIG_VAR(VIEWVIDEO_RTP_TIME_INC) // Frames Per Seconds #ifndef VIEWVIDEO_FPS #define VIEWVIDEO_FPS 4 #endif -PRINT_CONFIG_VAR(VIEWVIDEO_FPS); +PRINT_CONFIG_VAR(VIEWVIDEO_FPS) // The place where the shots are saved (without slash on the end) #ifndef VIEWVIDEO_SHOT_PATH #define VIEWVIDEO_SHOT_PATH "/data/video/images" #endif -PRINT_CONFIG_VAR(VIEWVIDEO_SHOT_PATH); +PRINT_CONFIG_VAR(VIEWVIDEO_SHOT_PATH) // Check if we are using netcat instead of RTP/UDP #ifndef VIEWVIDEO_USE_NETCAT #define VIEWVIDEO_USE_NETCAT FALSE #endif #if VIEWVIDEO_USE_NETCAT -PRINT_CONFIG_MSG("[viewvideo] Using netcat."); +PRINT_CONFIG_MSG("[viewvideo] Using netcat.") #else -PRINT_CONFIG_MSG("[viewvideo] Using RTP/UDP stream."); -PRINT_CONFIG_VAR(VIEWVIDEO_DEV); +PRINT_CONFIG_MSG("[viewvideo] Using RTP/UDP stream.") +PRINT_CONFIG_VAR(VIEWVIDEO_DEV) #endif /* These are defined with configure */ -PRINT_CONFIG_VAR(VIEWVIDEO_HOST); -PRINT_CONFIG_VAR(VIEWVIDEO_PORT_OUT); +PRINT_CONFIG_VAR(VIEWVIDEO_HOST) +PRINT_CONFIG_VAR(VIEWVIDEO_PORT_OUT) // Main thread static void *viewvideo_thread(void *data); @@ -274,8 +274,8 @@ static void *viewvideo_thread(void *data __attribute__((unused))) void viewvideo_init(void) { #ifdef VIEWVIDEO_SUBDEV - PRINT_CONFIG_MSG("[viewvideo] Configuring a subdevice!"); - PRINT_CONFIG_VAR(VIEWVIDEO_SUBDEV); + PRINT_CONFIG_MSG("[viewvideo] Configuring a subdevice!") + PRINT_CONFIG_VAR(VIEWVIDEO_SUBDEV) // Initialize the V4L2 subdevice (TODO: fix hardcoded path, which and code) if (!v4l2_init_subdev(STRINGIFY(VIEWVIDEO_SUBDEV), 0, 1, V4L2_MBUS_FMT_UYVY8_2X8, VIEWVIDEO_DEVICE_SIZE)) { diff --git a/sw/airborne/modules/computer_vision/viewvideo.h b/sw/airborne/modules/computer_vision/viewvideo.h index 8d24ebdf77..bd27310919 100644 --- a/sw/airborne/modules/computer_vision/viewvideo.h +++ b/sw/airborne/modules/computer_vision/viewvideo.h @@ -36,20 +36,20 @@ // Main viewvideo structure struct viewvideo_t { - volatile bool_t is_streaming; //< When the device is streaming - struct v4l2_device *dev; //< The V4L2 device that is used for the video stream - uint8_t downsize_factor; //< Downsize factor during the stream - uint8_t quality_factor; //< Quality factor during the stream - uint8_t fps; //< The amount of frames per second + volatile bool_t is_streaming; ///< When the device is streaming + struct v4l2_device *dev; ///< The V4L2 device that is used for the video stream + uint8_t downsize_factor; ///< Downsize factor during the stream + uint8_t quality_factor; ///< Quality factor during the stream + uint8_t fps; ///< The amount of frames per second - volatile bool_t take_shot; //< Wether to take an image - uint16_t shot_number; //< The last shot number + volatile bool_t take_shot; ///< Wether to take an image + uint16_t shot_number; ///< The last shot number }; extern struct viewvideo_t viewvideo; // Module functions extern void viewvideo_init(void); -extern void viewvideo_periodic(void); //< A dummy for now +extern void viewvideo_periodic(void); ///< A dummy for now extern void viewvideo_start(void); extern void viewvideo_stop(void); extern void viewvideo_take_shot(bool_t take); diff --git a/sw/airborne/subsystems/datalink/superbitrf.c b/sw/airborne/subsystems/datalink/superbitrf.c index eecdbfd177..c1ecb1e210 100644 --- a/sw/airborne/subsystems/datalink/superbitrf.c +++ b/sw/airborne/subsystems/datalink/superbitrf.c @@ -38,33 +38,33 @@ #ifndef SUPERBITRF_SPI_DEV #define SUPERBITRF_SPI_DEV spi1 #endif -PRINT_CONFIG_VAR(SUPERBITRF_SPI_DEV); +PRINT_CONFIG_VAR(SUPERBITRF_SPI_DEV) /* Default SuperbitRF RST PORT and PIN */ #ifndef SUPERBITRF_RST_PORT #define SUPERBITRF_RST_PORT GPIOC #endif -PRINT_CONFIG_VAR(SUPERBITRF_RST_PORT); +PRINT_CONFIG_VAR(SUPERBITRF_RST_PORT) #ifndef SUPERBITRF_RST_PIN #define SUPERBITRF_RST_PIN GPIO12 #endif -PRINT_CONFIG_VAR(SUPERBITRF_RST_PIN); +PRINT_CONFIG_VAR(SUPERBITRF_RST_PIN) /* Default SuperbitRF DRDY(IRQ) PORT and PIN */ #ifndef SUPERBITRF_DRDY_PORT #define SUPERBITRF_DRDY_PORT GPIOB #endif -PRINT_CONFIG_VAR(SUPERBITRF_DRDY_PORT); +PRINT_CONFIG_VAR(SUPERBITRF_DRDY_PORT) #ifndef SUPERBITRF_DRDY_PIN #define SUPERBITRF_DRDY_PIN GPIO1 #endif -PRINT_CONFIG_VAR(SUPERBITRF_DRDY_PIN); +PRINT_CONFIG_VAR(SUPERBITRF_DRDY_PIN) /* Default forcing in DSM2 mode is false */ #ifndef SUPERBITRF_FORCE_DSM2 #define SUPERBITRF_FORCE_DSM2 TRUE #endif -PRINT_CONFIG_VAR(SUPERBITRF_FORCE_DSM2); +PRINT_CONFIG_VAR(SUPERBITRF_FORCE_DSM2) /* The superbitRF structure */ struct SuperbitRF superbitrf; @@ -442,12 +442,12 @@ void superbitrf_event(void) #ifdef RADIO_TRANSMITTER_ID // otherwise load airframe file value else { - PRINT_CONFIG_VAR(RADIO_TRANSMITTER_ID); + PRINT_CONFIG_VAR(RADIO_TRANSMITTER_ID) superbitrf_set_mfg_id(RADIO_TRANSMITTER_ID); } #endif #ifdef RADIO_TRANSMITTER_CHAN - PRINT_CONFIG_VAR(RADIO_TRANSMITTER_CHAN); + PRINT_CONFIG_VAR(RADIO_TRANSMITTER_CHAN) if (superbitrf.num_channels == 0) { superbitrf.num_channels = RADIO_TRANSMITTER_CHAN; } @@ -457,7 +457,7 @@ void superbitrf_event(void) } #ifdef RADIO_TRANSMITTER_PROTOCOL else { - PRINT_CONFIG_VAR(RADIO_TRANSMITTER_PROTOCOL); + PRINT_CONFIG_VAR(RADIO_TRANSMITTER_PROTOCOL) superbitrf_set_protocol(RADIO_TRANSMITTER_PROTOCOL); } #endif