mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-30 05:53:35 +08:00
SITL sihsim make airframes simulator specific
This commit is contained in:
-1
@@ -41,4 +41,3 @@ param set-default PWM_MAIN_FUNC3 103
|
|||||||
param set-default PWM_MAIN_FUNC4 104
|
param set-default PWM_MAIN_FUNC4 104
|
||||||
|
|
||||||
param set SIH_VEHICLE_TYPE 0
|
param set SIH_VEHICLE_TYPE 0
|
||||||
|
|
||||||
@@ -37,9 +37,6 @@ px4_add_romfs_files(
|
|||||||
10018_iris_foggy_lidar
|
10018_iris_foggy_lidar
|
||||||
10019_omnicopter
|
10019_omnicopter
|
||||||
10030_px4vision
|
10030_px4vision
|
||||||
10040_quadx
|
|
||||||
10041_airplane
|
|
||||||
10042_xvert
|
|
||||||
1010_iris_opt_flow
|
1010_iris_opt_flow
|
||||||
1010_iris_opt_flow.post
|
1010_iris_opt_flow.post
|
||||||
1011_iris_irlock
|
1011_iris_irlock
|
||||||
@@ -83,4 +80,8 @@ px4_add_romfs_files(
|
|||||||
|
|
||||||
6011_typhoon_h480
|
6011_typhoon_h480
|
||||||
6011_typhoon_h480.post
|
6011_typhoon_h480.post
|
||||||
|
|
||||||
|
10040_sihsim_quadx
|
||||||
|
10041_sihsim_airplane
|
||||||
|
10042_sihsim_xvert
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ param set-default IMU_INTEG_RATE 250
|
|||||||
|
|
||||||
if [ "$PX4_SIMULATOR" = "sihsim" ] || [ "$(param show -q SYS_AUTOSTART)" -eq "0" ]; then
|
if [ "$PX4_SIMULATOR" = "sihsim" ] || [ "$(param show -q SYS_AUTOSTART)" -eq "0" ]; then
|
||||||
|
|
||||||
|
echo "INFO [init] SIH simulator"
|
||||||
|
|
||||||
if simulator_sih start; then
|
if simulator_sih start; then
|
||||||
|
|
||||||
sensor_baro_sim start
|
sensor_baro_sim start
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "SITL (sihsim 10040_quadx)",
|
"name": "SITL (sihsim_quadx SYS_AUTOSTART=10040)",
|
||||||
"type": "cppdbg",
|
"type": "cppdbg",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"program": "${command:cmake.launchTargetPath}",
|
"program": "${command:cmake.launchTargetPath}",
|
||||||
@@ -57,15 +57,13 @@
|
|||||||
"cwd": "${command:cmake.buildDirectory}/rootfs",
|
"cwd": "${command:cmake.buildDirectory}/rootfs",
|
||||||
"environment": [
|
"environment": [
|
||||||
{
|
{
|
||||||
"name": "PX4_SIM_MODEL",
|
"name": "PX4_SYS_AUTOSTART",
|
||||||
"value": "quadx"
|
"value": "10040"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"externalConsole": false,
|
|
||||||
"postDebugTask": "px4_sitl_cleanup",
|
"postDebugTask": "px4_sitl_cleanup",
|
||||||
"linux": {
|
"linux": {
|
||||||
"MIMode": "gdb",
|
"MIMode": "gdb",
|
||||||
"externalConsole": false,
|
|
||||||
"setupCommands": [
|
"setupCommands": [
|
||||||
{
|
{
|
||||||
"description": "Enable pretty-printing for gdb",
|
"description": "Enable pretty-printing for gdb",
|
||||||
@@ -81,7 +79,6 @@
|
|||||||
},
|
},
|
||||||
"osx": {
|
"osx": {
|
||||||
"MIMode": "lldb",
|
"MIMode": "lldb",
|
||||||
"externalConsole": true,
|
|
||||||
"setupCommands": [
|
"setupCommands": [
|
||||||
{
|
{
|
||||||
"text": "pro hand -p true -s false -n false SIGCONT",
|
"text": "pro hand -p true -s false -n false SIGCONT",
|
||||||
|
|||||||
@@ -54,9 +54,45 @@ if(PX4_PLATFORM MATCHES "posix")
|
|||||||
xvert
|
xvert
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# find corresponding airframes
|
||||||
|
file(GLOB sihsim_airframes
|
||||||
|
RELATIVE ${PX4_SOURCE_DIR}/ROMFS/px4fmu_common/init.d-posix/airframes
|
||||||
|
${PX4_SOURCE_DIR}/ROMFS/px4fmu_common/init.d-posix/airframes/*_sihsim_*
|
||||||
|
)
|
||||||
|
|
||||||
|
# remove any .post files
|
||||||
|
foreach(sihsim_airframe IN LISTS sihsim_airframes)
|
||||||
|
if(sihsim_airframe MATCHES ".post")
|
||||||
|
list(REMOVE_ITEM sihsim_airframes ${sihsim_airframe})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
list(REMOVE_DUPLICATES sihsim_airframes)
|
||||||
|
|
||||||
foreach(model ${models})
|
foreach(model ${models})
|
||||||
|
|
||||||
|
# match model to airframe
|
||||||
|
set(airframe_model_only)
|
||||||
|
set(airframe_sys_autostart)
|
||||||
|
set(sihsim_airframe_found)
|
||||||
|
foreach(sihsim_airframe IN LISTS sihsim_airframes)
|
||||||
|
|
||||||
|
string(REGEX REPLACE ".*_sihsim_" "" airframe_model_only ${sihsim_airframe})
|
||||||
|
string(REGEX REPLACE "_sihsim_.*" "" airframe_sys_autostart ${sihsim_airframe})
|
||||||
|
|
||||||
|
if(model STREQUAL ${airframe_model_only})
|
||||||
|
set(sihsim_airframe_found ${sihsim_airframe})
|
||||||
|
break()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
if(sihsim_airframe_found)
|
||||||
|
#message(STATUS "sihsim model: ${model} (${airframe_model_only}), airframe: ${sihsim_airframe_found}, SYS_AUTOSTART: ${airframe_sys_autostart}")
|
||||||
|
else()
|
||||||
|
message(WARNING "sihsim missing model: ${model} (${airframe_model_only}), airframe: ${sihsim_airframe_found}, SYS_AUTOSTART: ${airframe_sys_autostart}")
|
||||||
|
endif()
|
||||||
|
|
||||||
add_custom_target(sihsim_${model}
|
add_custom_target(sihsim_${model}
|
||||||
COMMAND ${CMAKE_COMMAND} -E env PX4_SIM_MODEL=${model} PX4_SIMULATOR=sihsim $<TARGET_FILE:px4>
|
COMMAND ${CMAKE_COMMAND} -E env PX4_SIM_MODEL=sihsim_${model} PX4_SIMULATOR=sihsim $<TARGET_FILE:px4>
|
||||||
WORKING_DIRECTORY ${SITL_WORKING_DIR}
|
WORKING_DIRECTORY ${SITL_WORKING_DIR}
|
||||||
USES_TERMINAL
|
USES_TERMINAL
|
||||||
DEPENDS px4
|
DEPENDS px4
|
||||||
|
|||||||
Reference in New Issue
Block a user