From c493ad0818e31701eac312d1e3e33f4697549742 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Sun, 15 Dec 2019 10:47:13 -0500 Subject: [PATCH] vscode debug and ekf2 replay improvements - create new px4_sitl_replay config specifically for replay - ekf2 replay don't launch gazebo - add px4_sitl_test cmake variant - px4_sitl_test bring into sync with px4_sitl_default - vscode replace hard coded build path with cmake setting --- .vscode/cmake-variants.yaml | 20 ++++-- .vscode/settings.json | 2 +- boards/px4/sitl/replay.cmake | 25 +++++++ boards/px4/sitl/test.cmake | 18 +++-- platforms/posix/Debug/launch_replay.json.in | 63 ++++++++++++++++ .../{launch.json.in => launch_sim.json.in} | 72 ++----------------- platforms/posix/cmake/sitl_target.cmake | 6 +- 7 files changed, 123 insertions(+), 83 deletions(-) create mode 100644 boards/px4/sitl/replay.cmake create mode 100644 platforms/posix/Debug/launch_replay.json.in rename platforms/posix/Debug/{launch.json.in => launch_sim.json.in} (80%) diff --git a/.vscode/cmake-variants.yaml b/.vscode/cmake-variants.yaml index 9fc391393b52..228b6860c6e8 100644 --- a/.vscode/cmake-variants.yaml +++ b/.vscode/cmake-variants.yaml @@ -6,6 +6,16 @@ CONFIG: buildType: RelWithDebInfo settings: CONFIG: px4_sitl_default + px4_sitl_replay: + short: px4_sitl_replay + buildType: RelWithDebInfo + settings: + CONFIG: px4_sitl_replay + px4_sitl_test: + short: px4_sitl_test + buildType: RelWithDebInfo + settings: + CONFIG: px4_sitl_test px4_fmu-v2_default: short: px4_fmu-v2_default buildType: MinSizeRel @@ -46,6 +56,11 @@ CONFIG: buildType: MinSizeRel settings: CONFIG: av_x-v1_default + holybro_durandal-v1_default: + short: holybro_durandal-v1 + buildType: MinSizeRel + settings: + CONFIG: holybro_durandal-v1_default intel_aerofc-v1_default: short: intel_aerofc-v1_default buildType: MinSizeRel @@ -66,8 +81,3 @@ CONFIG: buildType: MinSizeRel settings: CONFIG: nxp_fmuk66-v3_default - holybro_durandal-v1_default: - short: holybro_durandal-v1 - buildType: MinSizeRel - settings: - CONFIG: holybro_durandal-v1_default diff --git a/.vscode/settings.json b/.vscode/settings.json index 7503ae2fe32d..b03adc73fcdb 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -21,7 +21,7 @@ "${workspaceFolder}/test_data" ], "stopAtEntry": false, - "cwd": "${workspaceFolder}/build/px4_sitl_default/tmp", + "cwd": "${command:cmake.buildDirectory}/tmp", "environment": [ { "name": "PX4_SIM_MODEL", diff --git a/boards/px4/sitl/replay.cmake b/boards/px4/sitl/replay.cmake new file mode 100644 index 000000000000..3f0361d0d3a7 --- /dev/null +++ b/boards/px4/sitl/replay.cmake @@ -0,0 +1,25 @@ + +px4_add_board( + PLATFORM posix + VENDOR px4 + MODEL sitl + LABEL replay + MODULES + ekf2 + logger + replay + SYSTEMCMDS + param + perf + reboot + shutdown + topic_listener + ver + work_queue + ) + +message(STATUS "Building with uorb publisher rules support") +add_definitions(-DORB_USE_PUBLISHER_RULES) + +message(STATUS "Building without lockstep for replay") +set(ENABLE_LOCKSTEP_SCHEDULER no) diff --git a/boards/px4/sitl/test.cmake b/boards/px4/sitl/test.cmake index d2ad12e8a93b..614719234484 100644 --- a/boards/px4/sitl/test.cmake +++ b/boards/px4/sitl/test.cmake @@ -5,7 +5,6 @@ px4_add_board( MODEL sitl LABEL test TESTING - DRIVERS #barometer # all available barometer drivers #batt_smbus @@ -20,8 +19,8 @@ px4_add_board( #telemetry # all available telemetry drivers tone_alarm #uavcan - MODULES + airspeed_selector attitude_estimator_q camera_feedback commander @@ -30,7 +29,6 @@ px4_add_board( events fw_att_control fw_pos_control_l1 - rover_pos_control land_detector landing_target_estimator load_mon @@ -38,27 +36,26 @@ px4_add_board( logger mavlink mc_att_control - mc_rate_control mc_pos_control + mc_rate_control navigator - replay rc_update + replay + rover_pos_control sensors + #sih simulator vmount vtol_att_control - airspeed_selector - SYSTEMCMDS - #bl_update #config #dumpfile dyn esc_calib - #hardfault_log led_control mixer motor_ramp + motor_test #mtd #nshterm param @@ -73,16 +70,17 @@ px4_add_board( tune_control ver work_queue - EXAMPLES bottle_drop # OBC challenge dyn_hello # dynamically loading modules example fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello #hwtest # Hardware test + #matlab_csv_serial px4_mavlink_debug # Tutorial code from http://dev.px4.io/en/debug/debug_values.html px4_simple_app # Tutorial code from http://dev.px4.io/en/apps/hello_sky.html rover_steering_control # Rover example app + uuv_example_app ) set(config_sitl_viewer jmavsim CACHE STRING "viewer for sitl") diff --git a/platforms/posix/Debug/launch_replay.json.in b/platforms/posix/Debug/launch_replay.json.in new file mode 100644 index 000000000000..c72a654600eb --- /dev/null +++ b/platforms/posix/Debug/launch_replay.json.in @@ -0,0 +1,63 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "EKF2 replay", + "type": "cppdbg", + "request": "launch", + "program": "${command:cmake.launchTargetPath}", + "args": [ + "${workspaceFolder}/ROMFS/px4fmu_common", + "-s", + "etc/init.d-posix/rcS", + "-t", + "${workspaceFolder}/test_data" + ], + "stopAtEntry": false, + "cwd": "${command:cmake.buildDirectory}/tmp", + "environment": [ + { + "name": "replay", + "value": "${input:setReplayLog}" + }, + { + "name": "replay_mode", + "value": "ekf2" + } + ], + "externalConsole": false, + "linux": { + "MIMode": "gdb", + "externalConsole": false, + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + }, + { + "description": "PX4 ignore wq signals", + "text": "handle SIGCONT nostop noprint nopass", + "ignoreFailures": true + } + ] + }, + "osx": { + "MIMode": "lldb", + "externalConsole": true, + "setupCommands": [ + { + "text": "pro hand -p true -s false -n false SIGCONT", + } + ] + } + }, + ], + "inputs": [ + { + "type": "promptString", + "id": "setReplayLog", + "description": "Input the path to ulog file", + } + ] +} diff --git a/platforms/posix/Debug/launch.json.in b/platforms/posix/Debug/launch_sim.json.in similarity index 80% rename from platforms/posix/Debug/launch.json.in rename to platforms/posix/Debug/launch_sim.json.in index 6bb983cd355c..762be4e3f7f2 100644 --- a/platforms/posix/Debug/launch.json.in +++ b/platforms/posix/Debug/launch_sim.json.in @@ -14,7 +14,7 @@ "${workspaceFolder}/test_data" ], "stopAtEntry": false, - "cwd": "${workspaceFolder}/build/px4_sitl_default/tmp", + "cwd": "${command:cmake.buildDirectory}/tmp", "environment": [ { "name": "PX4_SIM_MODEL", @@ -63,7 +63,7 @@ "${workspaceFolder}/test_data" ], "stopAtEntry": false, - "cwd": "${workspaceFolder}/build/px4_sitl_default/tmp", + "cwd": "${command:cmake.buildDirectory}/tmp", "environment": [ { "name": "PX4_SIM_MODEL", @@ -112,7 +112,7 @@ "${workspaceFolder}/test_data" ], "stopAtEntry": false, - "cwd": "${workspaceFolder}/build/px4_sitl_default/tmp", + "cwd": "${command:cmake.buildDirectory}/tmp", "environment": [ { "name": "PX4_SIM_MODEL", @@ -161,7 +161,7 @@ "${workspaceFolder}/test_data" ], "stopAtEntry": false, - "cwd": "${workspaceFolder}/build/px4_sitl_default/tmp", + "cwd": "${command:cmake.buildDirectory}/tmp", "environment": [ { "name": "PX4_SIM_MODEL", @@ -210,7 +210,7 @@ "${workspaceFolder}/test_data" ], "stopAtEntry": false, - "cwd": "${workspaceFolder}/build/px4_sitl_default/tmp", + "cwd": "${command:cmake.buildDirectory}/tmp", "environment": [ { "name": "PX4_SIM_MODEL", @@ -258,7 +258,7 @@ "${workspaceFolder}/test_data" ], "stopAtEntry": false, - "cwd": "${workspaceFolder}/build/px4_sitl_default/tmp", + "cwd": "${command:cmake.buildDirectory}/tmp", "environment": [ { "name": "PX4_SIM_MODEL", @@ -290,66 +290,6 @@ } ] } - }, - { - "name": "EKF replay", - "type": "cppdbg", - "request": "launch", - "program": "${command:cmake.launchTargetPath}", - "args": [ - "${workspaceFolder}/ROMFS/px4fmu_common", - "-s", - "etc/init.d-posix/rcS", - "-t", - "${workspaceFolder}/test_data" - ], - "stopAtEntry": false, - "cwd": "${workspaceFolder}/build/px4_sitl_default/tmp", - "environment": [ - { - "name": "replay", - "value": "${input:setReplayLog}" - }, - { - "name": "replay_mode", - "value": "ekf2" - } - ], - "externalConsole": false, - "preLaunchTask": "gazebo iris", - "postDebugTask": "gazebo kill", - "linux": { - "MIMode": "gdb", - "externalConsole": false, - "setupCommands": [ - { - "description": "Enable pretty-printing for gdb", - "text": "-enable-pretty-printing", - "ignoreFailures": true - }, - { - "description": "PX4 ignore wq signals", - "text": "handle SIGCONT nostop noprint nopass", - "ignoreFailures": true - } - ] - }, - "osx": { - "MIMode": "lldb", - "externalConsole": true, - "setupCommands": [ - { - "text": "pro hand -p true -s false -n false SIGCONT", - } - ] - } - }, - ], - "inputs": [ - { - "type": "promptString", - "id": "setReplayLog", - "description": "Input the path to ulog file", } ] } diff --git a/platforms/posix/cmake/sitl_target.cmake b/platforms/posix/cmake/sitl_target.cmake index b5ad19a96b50..00d1fa0a30c8 100644 --- a/platforms/posix/cmake/sitl_target.cmake +++ b/platforms/posix/cmake/sitl_target.cmake @@ -103,4 +103,8 @@ add_custom_target(list_vmd_make_targets ) # vscode launch.json -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Debug/launch.json.in ${PX4_SOURCE_DIR}/.vscode/launch.json COPYONLY) +if(${PX4_BOARD_LABEL} MATCHES "replay") + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Debug/launch_replay.json.in ${PX4_SOURCE_DIR}/.vscode/launch.json COPYONLY) +else() + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Debug/launch_sim.json.in ${PX4_SOURCE_DIR}/.vscode/launch.json COPYONLY) +endif()