From 89ff9f1fe39fefd406d71fbdcb3881206ff0a73a Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Sat, 25 Feb 2017 12:56:58 -0500 Subject: [PATCH] cmake fmu-v3 fix and enable more examples - sync posix_sitl_default and px4fmu-v4pro/v5 with fmu-v3 - fixes #6667 --- cmake/configs/nuttx_px4fmu-v3_default.cmake | 14 +- .../configs/nuttx_px4fmu-v4pro_default.cmake | 127 ++++++++-------- cmake/configs/nuttx_px4fmu-v5_default.cmake | 134 ++++++++++------- cmake/configs/posix_sitl_default.cmake | 141 +++++++++++++----- src/examples/px4_daemon_app/px4_daemon_app.c | 2 +- src/examples/rover_steering_control/main.cpp | 2 +- src/modules/bottle_drop/bottle_drop.cpp | 8 +- 7 files changed, 260 insertions(+), 168 deletions(-) diff --git a/cmake/configs/nuttx_px4fmu-v3_default.cmake b/cmake/configs/nuttx_px4fmu-v3_default.cmake index 0e85f11734..e9d10fcf26 100644 --- a/cmake/configs/nuttx_px4fmu-v3_default.cmake +++ b/cmake/configs/nuttx_px4fmu-v3_default.cmake @@ -152,10 +152,12 @@ set(config_module_list lib/tailsitter_recovery lib/terrain_estimation lib/version - platforms/nuttx - # had to add for cmake, not sure why wasn't in original config + # + # Platform + # platforms/common + platforms/nuttx platforms/nuttx/px4_layer # @@ -171,25 +173,25 @@ set(config_module_list # # Demo apps # - #examples/math_demo + # Tutorial code from # https://px4.io/dev/px4_simple_app examples/px4_simple_app # Tutorial code from # https://px4.io/dev/daemon - #examples/px4_daemon_app + examples/px4_daemon_app # Tutorial code from # https://px4.io/dev/debug_values - #examples/px4_mavlink_debug + examples/px4_mavlink_debug # Tutorial code from # https://px4.io/dev/example_fixedwing_control examples/fixedwing_control # Hardware test - #examples/hwtest + examples/hwtest # EKF examples/ekf_att_pos_estimator diff --git a/cmake/configs/nuttx_px4fmu-v4pro_default.cmake b/cmake/configs/nuttx_px4fmu-v4pro_default.cmake index 6cb7ffc226..417ee1b7c3 100644 --- a/cmake/configs/nuttx_px4fmu-v4pro_default.cmake +++ b/cmake/configs/nuttx_px4fmu-v4pro_default.cmake @@ -10,51 +10,52 @@ set(config_module_list # # Board support modules # + drivers/airspeed + drivers/blinkm + drivers/bma180 + drivers/bmi160 + drivers/bmp280 + drivers/boards/px4fmu-v4pro + drivers/bst + drivers/camera_trigger drivers/device + drivers/ets_airspeed + drivers/frsky_telemetry + drivers/gps + drivers/hmc5883 + drivers/hott + drivers/hott/hott_sensors + drivers/hott/hott_telemetry + drivers/iridiumsbd + drivers/l3gd20 + drivers/led + drivers/lis3mdl + drivers/ll40ls + drivers/lsm303d + drivers/mb12xx + drivers/meas_airspeed + drivers/mkblctrl + drivers/mpu6000 + drivers/mpu9250 + drivers/ms5611 + drivers/oreoled + drivers/pwm_input + drivers/pwm_out_sim + drivers/px4flow + drivers/px4fmu + drivers/px4io + drivers/rgbled + drivers/sf0x + drivers/sf1xx + drivers/snapdragon_rc_pwm + drivers/srf02 drivers/stm32 drivers/stm32/adc drivers/stm32/tone_alarm - drivers/led - drivers/px4fmu - drivers/px4io - drivers/boards/px4fmu-v4pro - drivers/rgbled - drivers/mpu6000 - drivers/mpu9250 - drivers/lsm303d - drivers/l3gd20 - drivers/hmc5883 - drivers/ms5611 - drivers/mb12xx - drivers/srf02 - drivers/sf0x - drivers/ll40ls - drivers/trone - drivers/gps - drivers/pwm_out_sim - drivers/hott - drivers/hott/hott_telemetry - drivers/hott/hott_sensors - drivers/blinkm - drivers/airspeed - drivers/ets_airspeed - drivers/meas_airspeed - drivers/frsky_telemetry - modules/sensors - drivers/mkblctrl - drivers/px4flow - drivers/oreoled - drivers/vmount - drivers/pwm_input - drivers/camera_trigger - drivers/bst - drivers/snapdragon_rc_pwm - drivers/lis3mdl - drivers/sf1xx - drivers/bmp280 - drivers/bma180 - drivers/bmi160 drivers/tap_esc + drivers/trone + drivers/vmount + modules/sensors # # System commands @@ -82,10 +83,11 @@ set(config_module_list # drivers/sf0x/sf0x_tests drivers/test_ppm + #lib/rc/rc_tests modules/commander/commander_tests - modules/mc_pos_control/mc_pos_control_tests modules/controllib_test modules/mavlink/mavlink_tests + modules/mc_pos_control/mc_pos_control_tests modules/unit_test modules/uORB/uORB_tests systemcmds/tests @@ -95,27 +97,26 @@ set(config_module_list # modules/commander modules/events - modules/load_mon - modules/navigator - modules/mavlink modules/gpio_led - modules/uavcan modules/land_detector + modules/load_mon + modules/mavlink + modules/navigator + modules/uavcan # - # Estimation modules (EKF/ SO3 / other filters) + # Estimation modules # modules/attitude_estimator_q - modules/position_estimator_inav - modules/local_position_estimator modules/ekf2 + modules/local_position_estimator + modules/position_estimator_inav # # Vehicle Control # - # modules/segway # XXX Needs GCC 4.7 fix - modules/fw_pos_control_l1 modules/fw_att_control + modules/fw_pos_control_l1 modules/mc_att_control modules/mc_pos_control modules/vtol_att_control @@ -123,39 +124,41 @@ set(config_module_list # # Logging # - modules/sdlog2 modules/logger + modules/sdlog2 # # Library modules # + modules/dataman modules/param modules/systemlib modules/systemlib/mixer modules/uORB - modules/dataman # # Libraries # lib/controllib - lib/mathlib - lib/mathlib/math/filter + lib/conversion + lib/DriverFramework/framework lib/ecl lib/external_lgpl lib/geo lib/geo_lookup - lib/conversion lib/launchdetection - lib/terrain_estimation + lib/mathlib + lib/mathlib/math/filter lib/runway_takeoff lib/tailsitter_recovery + lib/terrain_estimation lib/version - lib/DriverFramework/framework - platforms/nuttx - # had to add for cmake, not sure why wasn't in original config + # + # Platform + # platforms/common + platforms/nuttx platforms/nuttx/px4_layer # @@ -171,10 +174,10 @@ set(config_module_list # # Demo apps # - #examples/math_demo + # Tutorial code from # https://px4.io/dev/px4_simple_app - examples/px4_simple_app + #examples/px4_simple_app # Tutorial code from # https://px4.io/dev/daemon @@ -192,7 +195,7 @@ set(config_module_list #examples/hwtest # EKF - examples/ekf_att_pos_estimator + #examples/ekf_att_pos_estimator ) set(config_extra_builtin_cmds diff --git a/cmake/configs/nuttx_px4fmu-v5_default.cmake b/cmake/configs/nuttx_px4fmu-v5_default.cmake index 56504955d8..cb97e9be21 100644 --- a/cmake/configs/nuttx_px4fmu-v5_default.cmake +++ b/cmake/configs/nuttx_px4fmu-v5_default.cmake @@ -10,47 +10,49 @@ set(config_module_list # # Board support modules # + drivers/airspeed + drivers/blinkm + drivers/bma180 + drivers/bmi160 + drivers/bmp280 + drivers/boards/px4fmu-v5 + drivers/bst + drivers/camera_trigger drivers/device + drivers/ets_airspeed + drivers/frsky_telemetry + drivers/gps + drivers/hmc5883 + drivers/hott + drivers/hott/hott_sensors + drivers/hott/hott_telemetry + drivers/iridiumsbd + drivers/led + drivers/lis3mdl + drivers/ll40ls + drivers/mb12xx + drivers/meas_airspeed + drivers/mkblctrl + drivers/mpu6000 + drivers/mpu9250 + drivers/ms5611 + drivers/oreoled + drivers/pwm_input + drivers/pwm_out_sim + drivers/px4flow + drivers/px4fmu + drivers/rgbled_pwm + drivers/sf0x + drivers/sf1xx + drivers/snapdragon_rc_pwm + drivers/srf02 drivers/stm32 drivers/stm32/adc drivers/stm32/tone_alarm - drivers/led - drivers/px4fmu - drivers/boards/px4fmu-v5 - drivers/rgbled_pwm - drivers/mpu6000 - drivers/mpu9250 - drivers/hmc5883 - drivers/ms5611 - drivers/mb12xx - drivers/srf02 - drivers/sf0x - drivers/ll40ls - drivers/trone - drivers/gps - drivers/pwm_out_sim - drivers/hott - drivers/hott/hott_telemetry - drivers/hott/hott_sensors - drivers/blinkm - drivers/airspeed - drivers/ets_airspeed - drivers/meas_airspeed - drivers/frsky_telemetry - modules/sensors - drivers/mkblctrl - drivers/px4flow - drivers/oreoled - drivers/vmount - drivers/pwm_input - drivers/camera_trigger - drivers/bst - drivers/snapdragon_rc_pwm - drivers/lis3mdl - drivers/bmp280 - drivers/bma180 - drivers/bmi160 drivers/tap_esc + drivers/trone + drivers/vmount + modules/sensors # # System commands @@ -73,32 +75,45 @@ set(config_module_list systemcmds/topic_listener systemcmds/ver + # + # Testing + # + drivers/sf0x/sf0x_tests + drivers/test_ppm + #lib/rc/rc_tests + modules/commander/commander_tests + modules/controllib_test + modules/mavlink/mavlink_tests + modules/mc_pos_control/mc_pos_control_tests + modules/unit_test + modules/uORB/uORB_tests + systemcmds/tests + # # General system control # modules/commander modules/events - modules/load_mon - modules/navigator - modules/mavlink modules/gpio_led - modules/uavcan modules/land_detector + modules/load_mon + modules/mavlink + modules/navigator + modules/uavcan # # Estimation modules # modules/attitude_estimator_q - modules/position_estimator_inav - modules/local_position_estimator modules/ekf2 + modules/local_position_estimator + modules/position_estimator_inav # # Vehicle Control # - # modules/segway # XXX Needs GCC 4.7 fix - modules/fw_pos_control_l1 modules/fw_att_control + modules/fw_pos_control_l1 modules/mc_att_control modules/mc_pos_control modules/vtol_att_control @@ -112,53 +127,55 @@ set(config_module_list # # Library modules # + modules/dataman modules/param modules/systemlib modules/systemlib/mixer modules/uORB - modules/dataman # # Libraries # lib/controllib - lib/mathlib - lib/mathlib/math/filter - lib/rc + lib/conversion + lib/DriverFramework/framework lib/ecl lib/external_lgpl lib/geo lib/geo_lookup - lib/conversion lib/launchdetection - lib/terrain_estimation + lib/mathlib + lib/mathlib/math/filter + lib/rc lib/runway_takeoff lib/tailsitter_recovery + lib/terrain_estimation lib/version - lib/DriverFramework/framework - platforms/nuttx - # had to add for cmake, not sure why wasn't in original config + # + # Platform + # platforms/common + platforms/nuttx platforms/nuttx/px4_layer # # OBC challenge # - modules/bottle_drop + #modules/bottle_drop # # Rover apps # - examples/rover_steering_control + #examples/rover_steering_control # # Demo apps # - #examples/math_demo + # Tutorial code from # https://px4.io/dev/px4_simple_app - examples/px4_simple_app + #examples/px4_simple_app # Tutorial code from # https://px4.io/dev/daemon @@ -174,6 +191,9 @@ set(config_module_list # Hardware test #examples/hwtest + + # EKF + #examples/ekf_att_pos_estimator ) set(config_extra_builtin_cmds diff --git a/cmake/configs/posix_sitl_default.cmake b/cmake/configs/posix_sitl_default.cmake index aecbb8465b..095ca1fab1 100644 --- a/cmake/configs/posix_sitl_default.cmake +++ b/cmake/configs/posix_sitl_default.cmake @@ -9,8 +9,7 @@ set(config_module_list drivers/gps drivers/pwm_out_sim drivers/vmount - - platforms/common + modules/sensors platforms/posix/drivers/accelsim platforms/posix/drivers/adcsim platforms/posix/drivers/airspeedsim @@ -20,46 +19,92 @@ set(config_module_list platforms/posix/drivers/ledsim platforms/posix/drivers/rgbledsim platforms/posix/drivers/tonealrmsim - platforms/posix/px4_layer - platforms/posix/work_queue + # + # System commands + # + #systemcmds/bl_update + #systemcmds/config + #systemcmds/dumpfile systemcmds/esc_calib + #systemcmds/hardfault_log systemcmds/mixer + systemcmds/motor_ramp + #systemcmds/mtd + #systemcmds/nshterm systemcmds/param systemcmds/perf + #systemcmds/pwm systemcmds/reboot systemcmds/sd_bench + systemcmds/top systemcmds/topic_listener systemcmds/ver - systemcmds/top - systemcmds/motor_ramp - modules/attitude_estimator_q + # + # Testing + # + drivers/sf0x/sf0x_tests + #drivers/test_ppm + lib/rc/rc_tests + modules/commander/commander_tests + modules/controllib_test + modules/mavlink/mavlink_tests + modules/mc_pos_control/mc_pos_control_tests + modules/unit_test + modules/uORB/uORB_tests + systemcmds/tests + + # + # General system control + # modules/commander - modules/dataman + modules/events + #modules/gpio_led + modules/land_detector + modules/load_mon + modules/mavlink + modules/navigator + modules/replay + modules/simulator + #modules/uavcan + + # + # Estimation modules + # + modules/attitude_estimator_q modules/ekf2 modules/ekf2_replay - modules/events + modules/local_position_estimator + modules/position_estimator_inav + + # + # Vehicle Control + # modules/fw_att_control modules/fw_pos_control_l1 - modules/land_detector - modules/logger - modules/mavlink modules/mc_att_control modules/mc_pos_control - modules/navigator - modules/param - modules/position_estimator_inav - modules/local_position_estimator - modules/replay + modules/vtol_att_control + + # + # Logging + # + modules/logger modules/sdlog2 - modules/sensors - modules/simulator + + # + # Library modules + # + modules/dataman + modules/param modules/systemlib modules/systemlib/mixer modules/uORB - modules/vtol_att_control + # + # Libraries + # lib/controllib lib/conversion lib/DriverFramework/framework @@ -76,27 +121,49 @@ set(config_module_list lib/terrain_estimation lib/version + # + # Platform + # + platforms/common + platforms/posix/px4_layer + platforms/posix/work_queue + + # + # OBC challenge + # + modules/bottle_drop + + # + # Rover apps + # + examples/rover_steering_control + + # + # Demo apps + # + + # Tutorial code from + # https://px4.io/dev/px4_simple_app examples/px4_simple_app - examples/mc_att_control_multiplatform - examples/mc_pos_control_multiplatform - examples/ekf_att_pos_estimator - examples/attitude_estimator_ekf + + # Tutorial code from + # https://px4.io/dev/daemon + examples/px4_daemon_app + + # Tutorial code from + # https://px4.io/dev/debug_values + examples/px4_mavlink_debug + + # Tutorial code from + # https://px4.io/dev/example_fixedwing_control examples/fixedwing_control - # - # Testing - # - drivers/sf0x/sf0x_tests - lib/rc/rc_tests - modules/commander/commander_tests - modules/mc_pos_control/mc_pos_control_tests - modules/controllib_test - modules/mavlink/mavlink_tests - modules/unit_test - modules/uORB/uORB_tests - systemcmds/tests + # Hardware test + #examples/hwtest - ) + # EKF + examples/ekf_att_pos_estimator +) set(config_extra_builtin_cmds serdis diff --git a/src/examples/px4_daemon_app/px4_daemon_app.c b/src/examples/px4_daemon_app/px4_daemon_app.c index 1495b1122d..625975ceaf 100644 --- a/src/examples/px4_daemon_app/px4_daemon_app.c +++ b/src/examples/px4_daemon_app/px4_daemon_app.c @@ -44,7 +44,7 @@ #include #include -#include +#include #include #include diff --git a/src/examples/rover_steering_control/main.cpp b/src/examples/rover_steering_control/main.cpp index b293dac7b2..51e7bb0dfb 100644 --- a/src/examples/rover_steering_control/main.cpp +++ b/src/examples/rover_steering_control/main.cpp @@ -427,7 +427,7 @@ int rover_steering_control_main(int argc, char *argv[]) SCHED_PRIORITY_MAX - 20, 2048, rover_steering_control_thread_main, - (argv) ? (char *const *)&argv[2] : (char *const *)NULL); + (argv) ? (char *const *)&argv[2] : (char *const *)nullptr); thread_running = true; exit(0); } diff --git a/src/modules/bottle_drop/bottle_drop.cpp b/src/modules/bottle_drop/bottle_drop.cpp index 1a47b9f50f..6e3776c20b 100644 --- a/src/modules/bottle_drop/bottle_drop.cpp +++ b/src/modules/bottle_drop/bottle_drop.cpp @@ -206,7 +206,7 @@ BottleDrop::~BottleDrop() /* if we have given up, kill it */ if (++i > 50) { - task_delete(_main_task); + px4_task_delete(_main_task); break; } } while (_main_task != -1); @@ -225,7 +225,7 @@ BottleDrop::start() SCHED_DEFAULT, SCHED_PRIORITY_DEFAULT + 15, 1500, - (main_t)&BottleDrop::task_main_trampoline, + (px4_main_t)&BottleDrop::task_main_trampoline, nullptr); if (_main_task < 0) { @@ -653,7 +653,7 @@ BottleDrop::task_main() // We're close enough - open the bay distance_open_door = math::max(10.0f, 3.0f * fabsf(t_door * groundspeed_body)); - if (isfinite(distance_real) && distance_real < distance_open_door && + if (PX4_ISFINITE(distance_real) && distance_real < distance_open_door && fabsf(approach_error) < math::radians(20.0f)) { open_bay(); _drop_state = DROP_STATE_BAY_OPEN; @@ -671,7 +671,7 @@ BottleDrop::task_main() map_projection_reproject(&ref, x_f, y_f, &x_f_NED, &y_f_NED); future_distance = get_distance_to_next_waypoint(x_f_NED, y_f_NED, _drop_position.lat, _drop_position.lon); - if (isfinite(distance_real) && + if (PX4_ISFINITE(distance_real) && (distance_real < precision) && ((distance_real < future_distance))) { drop(); _drop_state = DROP_STATE_DROPPED;