rename 'gazebo' simulation to 'gazebo-classic' (#20936)

- use `gazebo-classic` everywhere consistently referring to the original Gazebo (eg version 9,10,11)
   - additional `gazebo_*` helper targets added for compatibility, but warn about deprecation and tell you the new target naming
 - use `gz` everywhere when referring to Gazebo (aka Ignition Gazebo or new Gazebo)
This commit is contained in:
Daniel Agar 2023-01-15 11:36:12 -05:00 committed by GitHub
parent 6605378d0d
commit 6991ac014c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
56 changed files with 169 additions and 153 deletions

View File

@ -59,13 +59,13 @@ jobs:
run: |
export
ulimit -a
- name: Build PX4 and sitl_gazebo
- name: Build PX4 and sitl_gazebo-classic
env:
PX4_CMAKE_BUILD_TYPE: ${{matrix.config.build_type}}
run: |
ccache -z
make px4_sitl_default
make px4_sitl_default sitl_gazebo
make px4_sitl_default sitl_gazebo-classic
ccache -s
- name: Core dump settings

View File

@ -54,13 +54,13 @@ jobs:
run: |
export
ulimit -a
- name: Build PX4 and sitl_gazebo
- name: Build PX4 and sitl_gazebo-classic
env:
PX4_CMAKE_BUILD_TYPE: ${{matrix.config.build_type}}
run: |
ccache -z
make px4_sitl_default
make px4_sitl_default sitl_gazebo
make px4_sitl_default sitl_gazebo-classic
ccache -s
- name: Core dump settings

View File

@ -74,14 +74,14 @@ jobs:
- name: Build SITL Gazebo
env:
PX4_CMAKE_BUILD_TYPE: ${{matrix.config.build_type}}
run: make px4_sitl_default sitl_gazebo
- name: ccache post-run sitl_gazebo
run: make px4_sitl_default sitl_gazebo-classic
- name: ccache post-run sitl_gazebo-classic
run: ccache -s
- name: Build MAVSDK tests
env:
PX4_CMAKE_BUILD_TYPE: ${{matrix.config.build_type}}
DONT_RUN: 1
run: make px4_sitl_default sitl_gazebo mavsdk_tests
run: make px4_sitl_default sitl_gazebo-classic mavsdk_tests
- name: ccache post-run mavsdk_tests
run: ccache -s

6
.gitmodules vendored
View File

@ -10,9 +10,9 @@
path = Tools/simulation/jmavsim/jMAVSim
url = https://github.com/PX4/jMAVSim.git
branch = main
[submodule "Tools/simulation/gazebo/sitl_gazebo"]
path = Tools/simulation/gazebo/sitl_gazebo
url = https://github.com/PX4/PX4-SITL_gazebo.git
[submodule "Tools/simulation/gazebo-classic/sitl_gazebo-classic"]
path = Tools/simulation/gazebo-classic/sitl_gazebo-classic
url = https://github.com/PX4/PX4-SITL_gazebo-classic.git
branch = main
[submodule "src/drivers/gps/devices"]
path = src/drivers/gps/devices

26
.vscode/tasks.json vendored
View File

@ -67,9 +67,9 @@
"dependsOn":["px4_sitl_cleanup"]
},
{
"label": "gazebo build",
"label": "gazebo-classic build",
"type": "shell",
"command": "make px4_sitl_default sitl_gazebo",
"command": "make px4_sitl_default sitl_gazebo-classic",
"options": {
"cwd": "${workspaceFolder}"
},
@ -86,18 +86,18 @@
"problemMatcher": [],
},
{
"label": "gazebo start",
"label": "gazebo-classic start",
"type": "shell",
"dependsOn": "gazebo build",
"dependsOn": "gazebo-classic build",
"options": {
"cwd": "${workspaceFolder}",
"env": {
"GAZEBO_PLUGIN_PATH": "${workspaceFolder}/build/px4_sitl_default/build_gazebo",
"GAZEBO_MODEL_PATH": "${workspaceFolder}/Tools/simulation/gazebo/sitl_gazebo/models",
"GAZEBO_PLUGIN_PATH": "${workspaceFolder}/build/px4_sitl_default/build_gazebo-classic",
"GAZEBO_MODEL_PATH": "${workspaceFolder}/Tools/simulation/gazebo-classic/sitl_gazebo-classic/models",
"PX4_SIM_SPEED_FACTOR": "1"
}
},
"command": "gzserver --verbose ${workspaceFolder}/Tools/simulation/gazebo/sitl_gazebo/worlds/empty.world",
"command": "gzserver --verbose ${workspaceFolder}/Tools/simulation/gazebo-classic/sitl_gazebo-classic/worlds/empty.world",
"isBackground": true,
"presentation": {
"echo": true,
@ -128,18 +128,18 @@
]
},
{
"label": "gazebo",
"label": "gazebo-classic",
"type": "shell",
"dependsOn": "gazebo start",
"dependsOn": "gazebo-classic start",
"options": {
"cwd": "${workspaceFolder}",
"env": {
"GAZEBO_PLUGIN_PATH": "${workspaceFolder}/build/px4_sitl_default/build_gazebo",
"GAZEBO_MODEL_PATH": "${workspaceFolder}/Tools/simulation/gazebo/sitl_gazebo/models",
"GAZEBO_PLUGIN_PATH": "${workspaceFolder}/build/px4_sitl_default/build_gazebo-classic",
"GAZEBO_MODEL_PATH": "${workspaceFolder}/Tools/simulation/gazebo-classic/sitl_gazebo-classic/models",
"PX4_SIM_SPEED_FACTOR": "1"
}
},
"command": "gz model --verbose --spawn-file=${workspaceFolder}/Tools/simulation/gazebo/sitl_gazebo/models/iris/iris.sdf --model-name=iris -x 1.01 -y 0.98 -z 0.83",
"command": "gz model --verbose --spawn-file=${workspaceFolder}/Tools/simulation/gazebo-classic/sitl_gazebo-classic/models/iris/iris.sdf --model-name=iris -x 1.01 -y 0.98 -z 0.83",
"isBackground": false,
"presentation": {
"echo": true,
@ -194,7 +194,7 @@
"dependsOn":["ign gazebo kill"]
},
{
"label": "gazebo kill",
"label": "gazebo-classic kill",
"type": "shell",
"command": "pkill -9 -f gzserver || true",
"presentation": {

View File

@ -388,17 +388,17 @@ tests_coverage:
rostest: px4_sitl_default
@$(MAKE) --no-print-directory px4_sitl_default sitl_gazebo
@$(MAKE) --no-print-directory px4_sitl_default sitl_gazebo-classic
tests_integration: px4_sitl_default
@$(MAKE) --no-print-directory px4_sitl_default sitl_gazebo
@$(MAKE) --no-print-directory px4_sitl_default sitl_gazebo-classic
@$(MAKE) --no-print-directory px4_sitl_default mavsdk_tests
@"$(SRC_DIR)"/test/mavsdk_tests/mavsdk_test_runner.py --speed-factor 20 test/mavsdk_tests/configs/sitl.json
tests_integration_coverage:
@$(MAKE) clean
@$(MAKE) --no-print-directory px4_sitl_default PX4_CMAKE_BUILD_TYPE=Coverage
@$(MAKE) --no-print-directory px4_sitl_default sitl_gazebo
@$(MAKE) --no-print-directory px4_sitl_default sitl_gazebo-classic
@$(MAKE) --no-print-directory px4_sitl_default mavsdk_tests
@"$(SRC_DIR)"/test/mavsdk_tests/mavsdk_test_runner.py --speed-factor 20 test/mavsdk_tests/configs/sitl.json
@mkdir -p coverage
@ -408,13 +408,13 @@ tests_mission: rostest
@"$(SRC_DIR)"/test/rostest_px4_run.sh mavros_posix_tests_missions.test
rostest_run: px4_sitl_default
@$(MAKE) --no-print-directory px4_sitl_default sitl_gazebo
@$(MAKE) --no-print-directory px4_sitl_default sitl_gazebo-classic
@"$(SRC_DIR)"/test/rostest_px4_run.sh $(TEST_FILE) mission:=$(TEST_MISSION) vehicle:=$(TEST_VEHICLE)
tests_mission_coverage:
@$(MAKE) clean
@$(MAKE) --no-print-directory px4_sitl_default PX4_CMAKE_BUILD_TYPE=Coverage
@$(MAKE) --no-print-directory px4_sitl_default sitl_gazebo PX4_CMAKE_BUILD_TYPE=Coverage
@$(MAKE) --no-print-directory px4_sitl_default sitl_gazebo-classic PX4_CMAKE_BUILD_TYPE=Coverage
@"$(SRC_DIR)"/test/rostest_px4_run.sh mavros_posix_test_mission.test mission:=VTOL_mission_1 vehicle:=standard_vtol
@$(MAKE) --no-print-directory px4_sitl_default generate_coverage
@ -489,7 +489,7 @@ validate_module_configs:
# Cleanup
# --------------------------------------------------------------------
.PHONY: clean submodulesclean submodulesupdate gazeboclean distclean
.PHONY: clean submodulesclean submodulesupdate distclean
clean:
@[ ! -d "$(SRC_DIR)/build" ] || find "$(SRC_DIR)/build" -mindepth 1 -maxdepth 1 -type d -exec sh -c "echo {}; cmake --build {} -- clean || rm -rf {}" \; # use generated build system to clean, wipe build directory if it fails
@ -507,10 +507,7 @@ submodulesupdate:
@git submodule update --init --recursive --jobs 4
@git fetch --all --tags --recurse-submodules=yes --jobs=4
gazeboclean:
@rm -rf ~/.gazebo/*
distclean: gazeboclean
distclean:
@git submodule deinit --force $(SRC_DIR)
@rm -rf "$(SRC_DIR)/build"
@git clean --force -X "$(SRC_DIR)/msg/" "$(SRC_DIR)/platforms/" "$(SRC_DIR)/posix-configs/" "$(SRC_DIR)/ROMFS/" "$(SRC_DIR)/src/" "$(SRC_DIR)/test/" "$(SRC_DIR)/Tools/"

View File

@ -33,39 +33,39 @@
px4_add_romfs_files(
1010_gazebo_iris_opt_flow
1010_gazebo_iris_opt_flow.post
1011_gazebo_iris_irlock
1012_gazebo_iris_rplidar
1013_gazebo_iris_vision
1013_gazebo_iris_vision.post
1015_gazebo_iris_obs_avoid
1015_gazebo_iris_obs_avoid.post
1017_gazebo_iris_opt_flow_mockup
1019_gazebo_iris_dual_gps
1021_gazebo_uuv_hippocampus
1022_gazebo_uuv_bluerov2_heavy
1030_gazebo_plane
1031_gazebo_plane_cam
1032_gazebo_plane_catapult
1010_gazebo-classic_iris_opt_flow
1010_gazebo-classic_iris_opt_flow.post
1011_gazebo-classic_iris_irlock
1012_gazebo-classic_iris_rplidar
1013_gazebo-classic_iris_vision
1013_gazebo-classic_iris_vision.post
1015_gazebo-classic_iris_obs_avoid
1015_gazebo-classic_iris_obs_avoid.post
1017_gazebo-classic_iris_opt_flow_mockup
1019_gazebo-classic_iris_dual_gps
1021_gazebo-classic_uuv_hippocampus
1022_gazebo-classic_uuv_bluerov2_heavy
1030_gazebo-classic_plane
1031_gazebo-classic_plane_cam
1032_gazebo-classic_plane_catapult
1033_jsbsim_rascal
1034_flightgear_rascal-electric
1035_gazebo_techpod
1035_gazebo-classic_techpod
1036_jsbsim_malolo
1037_gazebo_believer
1038_gazebo_glider
1039_gazebo_advanced_plane
1040_gazebo_standard_vtol
1041_gazebo_tailsitter
1042_gazebo_tiltrotor
1043_gazebo_standard_vtol_drop
1044_gazebo_plane_lidar
1060_gazebo_rover
1061_gazebo_r1_rover
1037_gazebo-classic_believer
1038_gazebo-classic_glider
1039_gazebo-classic_advanced_plane
1040_gazebo-classic_standard_vtol
1041_gazebo-classic_tailsitter
1042_gazebo-classic_tiltrotor
1043_gazebo-classic_standard_vtol_drop
1044_gazebo-classic_plane_lidar
1060_gazebo-classic_rover
1061_gazebo-classic_r1_rover
1062_flightgear_tf-r1
1070_gazebo_boat
1070_gazebo-classic_boat
2507_gazebo_cloudship
2507_gazebo-classic_cloudship
3010_jsbsim_quadrotor_x
3011_jsbsim_hexarotor_x
@ -73,14 +73,14 @@ px4_add_romfs_files(
4001_gz_x500
4002_gz_x500_depth
6011_gazebo_typhoon_h480
6011_gazebo_typhoon_h480.post
6011_gazebo-classic_typhoon_h480
6011_gazebo-classic_typhoon_h480.post
10016_gazebo_iris
10016_gazebo-classic_iris
10017_jmavsim_iris
10018_gazebo_iris_foggy_lidar
10019_gazebo_omnicopter
10030_gazebo_px4vision
10018_gazebo-classic_iris_foggy_lidar
10019_gazebo-classic_omnicopter
10030_gazebo-classic_px4vision
10040_sihsim_quadx
10041_sihsim_airplane

View File

@ -16,9 +16,9 @@ SRC_DIR=$1
BUILD_DIR=$2
# setup Gazebo env and update package path
export GAZEBO_PLUGIN_PATH=$GAZEBO_PLUGIN_PATH:${BUILD_DIR}/build_gazebo
export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:${SRC_DIR}/Tools/simulation/gazebo/sitl_gazebo/models
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${BUILD_DIR}/build_gazebo
export GAZEBO_PLUGIN_PATH=$GAZEBO_PLUGIN_PATH:${BUILD_DIR}/build_gazebo-classic
export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:${SRC_DIR}/Tools/simulation/gazebo-classic/sitl_gazebo-classic/models
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${BUILD_DIR}/build_gazebo-classic
echo -e "GAZEBO_PLUGIN_PATH $GAZEBO_PLUGIN_PATH"
echo -e "GAZEBO_MODEL_PATH $GAZEBO_MODEL_PATH"

View File

@ -1,10 +1,10 @@
#!/bin/bash
# run multiple instances of the 'px4' binary, with the gazebo SITL simulation
# It assumes px4 is already built, with 'make px4_sitl_default sitl_gazebo'
# It assumes px4 is already built, with 'make px4_sitl_default sitl_gazebo-classic'
# The simulator is expected to send to TCP port 4560+i for i in [0, N-1]
# For example gazebo can be run like this:
#./Tools/simulation/gazebo/sitl_multiple_run.sh -n 10 -m iris
#./Tools/simulation/gazebo-classic/sitl_multiple_run.sh -n 10 -m iris
function cleanup() {
pkill -x px4
@ -35,7 +35,7 @@ function spawn_model() {
pushd "$working_dir" &>/dev/null
echo "starting instance $N in $(pwd)"
$build_path/bin/px4 -i $N -d "$build_path/etc" >out.log 2>err.log &
python3 ${src_path}/Tools/simulation/gazebo/sitl_gazebo/scripts/jinja_gen.py ${src_path}/Tools/simulation/gazebo/sitl_gazebo/models/${MODEL}/${MODEL}.sdf.jinja ${src_path}/Tools/simulation/gazebo/sitl_gazebo --mavlink_tcp_port $((4560+${N})) --mavlink_udp_port $((14560+${N})) --mavlink_id $((1+${N})) --gst_udp_port $((5600+${N})) --video_uri $((5600+${N})) --mavlink_cam_udp_port $((14530+${N})) --output-file /tmp/${MODEL}_${N}.sdf
python3 ${src_path}/Tools/simulation/gazebo-classic/sitl_gazebo-classic/scripts/jinja_gen.py ${src_path}/Tools/simulation/gazebo-classic/sitl_gazebo-classic/models/${MODEL}/${MODEL}.sdf.jinja ${src_path}/Tools/simulation/gazebo-classic/sitl_gazebo-classic --mavlink_tcp_port $((4560+${N})) --mavlink_udp_port $((14560+${N})) --mavlink_id $((1+${N})) --gst_udp_port $((5600+${N})) --video_uri $((5600+${N})) --mavlink_cam_udp_port $((14530+${N})) --output-file /tmp/${MODEL}_${N}.sdf
echo "Spawning ${MODEL}_${N} at ${X} ${Y}"
@ -69,7 +69,7 @@ num_vehicles=${NUM_VEHICLES:=3}
world=${WORLD:=empty}
target=${TARGET:=px4_sitl_default}
vehicle_model=${VEHICLE_MODEL:="iris"}
export PX4_SIM_MODEL=gazebo_${vehicle_model}
export PX4_SIM_MODEL=gazebo-classic_${vehicle_model}
echo ${SCRIPT}
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
@ -84,7 +84,7 @@ pkill -x px4 || true
sleep 1
source ${src_path}/Tools/simulation/gazebo/setup_gazebo.bash ${src_path} ${src_path}/build/${target}
source ${src_path}/Tools/simulation/gazebo-classic/setup_gazebo.bash ${src_path} ${src_path}/build/${target}
# To use gazebo_ros ROS2 plugins
if [[ -n "$ROS_VERSION" ]] && [ "$ROS_VERSION" == "2" ]; then
@ -94,7 +94,7 @@ else
fi
echo "Starting gazebo"
gzserver ${src_path}/Tools/simulation/gazebo/sitl_gazebo/worlds/${world}.world --verbose $ros_args &
gzserver ${src_path}/Tools/simulation/gazebo-classic/sitl_gazebo-classic/worlds/${world}.world --verbose $ros_args &
sleep 5
n=0
@ -126,7 +126,7 @@ else
m=0
while [ $m -lt ${target_number} ]; do
export PX4_SIM_MODEL=gazebo_${target_vehicle}
export PX4_SIM_MODEL=gazebo-classic_${target_vehicle}
spawn_model ${target_vehicle}${LABEL} $n $target_x $target_y
m=$(($m + 1))
n=$(($n + 1))

View File

@ -67,7 +67,7 @@ fi
# be running from last time
pkill -x gazebo || true
export PX4_SIM_MODEL=gazebo_${model}
export PX4_SIM_MODEL=gazebo-classic_${model}
export PX4_SIM_WORLD=${world}
SIM_PID=0
@ -77,25 +77,25 @@ if [ -x "$(command -v gazebo)" ]; then
model_name="${model}"
# Set the plugin path so Gazebo finds our model and sim
source "$src_path/Tools/simulation/gazebo/setup_gazebo.bash" "${src_path}" "${build_path}"
source "$src_path/Tools/simulation/gazebo-classic/setup_gazebo.bash" "${src_path}" "${build_path}"
if [ -z $PX4_SITL_WORLD ]; then
#Spawn predefined world
if [ "$world" == "none" ]; then
if [ -f ${src_path}/Tools/simulation/gazebo/sitl_gazebo/worlds/${model}.world ]; then
if [ -f ${src_path}/Tools/simulation/gazebo-classic/sitl_gazebo-classic/worlds/${model}.world ]; then
echo "empty world, default world ${model}.world for model found"
world_path="${src_path}/Tools/simulation/gazebo/sitl_gazebo/worlds/${model}.world"
world_path="${src_path}/Tools/simulation/gazebo-classic/sitl_gazebo-classic/worlds/${model}.world"
else
echo "empty world, setting empty.world as default"
world_path="${src_path}/Tools/simulation/gazebo/sitl_gazebo/worlds/empty.world"
world_path="${src_path}/Tools/simulation/gazebo-classic/sitl_gazebo-classic/worlds/empty.world"
fi
else
#Spawn empty world if world with model name doesn't exist
world_path="${src_path}/Tools/simulation/gazebo/sitl_gazebo/worlds/${world}.world"
world_path="${src_path}/Tools/simulation/gazebo-classic/sitl_gazebo-classic/worlds/${world}.world"
fi
else
if [ -f ${src_path}/Tools/simulation/gazebo/sitl_gazebo/worlds/${PX4_SITL_WORLD}.world ]; then
if [ -f ${src_path}/Tools/simulation/gazebo-classic/sitl_gazebo-classic/worlds/${PX4_SITL_WORLD}.world ]; then
# Spawn world by name if exists in the worlds directory from environment variable
world_path="${src_path}/Tools/simulation/gazebo/sitl_gazebo/worlds/${PX4_SITL_WORLD}.world"
world_path="${src_path}/Tools/simulation/gazebo-classic/sitl_gazebo-classic/worlds/${PX4_SITL_WORLD}.world"
else
# Spawn world from environment variable with absolute path
world_path="$PX4_SITL_WORLD"

View File

@ -19,7 +19,7 @@ pkill -x px4 || true
sleep 1
export PX4_SIM_MODEL=gazebo_iris
export PX4_SIM_MODEL=gazebo-classic_iris
n=0
while [ $n -lt $sitl_num ]; do

View File

@ -14,7 +14,7 @@
<arg name="vehicle" default="iris"/>
<arg name="world" default="$(find mavlink_sitl_gazebo)/worlds/empty.world"/>
<arg name="sdf" default="$(find mavlink_sitl_gazebo)/models/$(arg vehicle)/$(arg vehicle).sdf"/>
<env name="PX4_SIM_MODEL" value="gazebo_$(arg vehicle)" />
<env name="PX4_SIM_MODEL" value="gazebo-classic_$(arg vehicle)" />
<!-- gazebo configs -->
<arg name="gui" default="true"/>

View File

@ -9,7 +9,7 @@
<arg name="ID" default="0"/>
<arg name="interactive" default="true"/>
<env name="PX4_SIM_MODEL" value="gazebo_$(arg vehicle)" />
<env name="PX4_SIM_MODEL" value="gazebo-classic_$(arg vehicle)" />
<arg unless="$(arg interactive)" name="px4_command_arg1" value="-d"/>
<arg if="$(arg interactive)" name="px4_command_arg1" value=""/>
<node name="sitl_$(arg ID)" pkg="px4" type="px4" output="screen" args="$(find px4)/build/px4_sitl_default/etc -s etc/init.d-posix/rcS -i $(arg ID) $(arg px4_command_arg1)">

View File

@ -13,7 +13,7 @@
<arg name="est" default="ekf2"/>
<arg name="vehicle" default="iris"/>
<arg name="ID" default="1"/>
<env name="PX4_SIM_MODEL" value="gazebo_$(arg vehicle)" />
<env name="PX4_SIM_MODEL" value="gazebo-classic_$(arg vehicle)" />
<arg name="mavlink_udp_port" default="14560"/>
<arg name="mavlink_tcp_port" default="4560"/>
<arg name="gst_udp_port" default="5600"/>

View File

@ -13,13 +13,13 @@
<arg name="est" default="ekf2"/>
<arg name="vehicle" default="plane"/>
<arg name="ID" default="1"/>
<env name="PX4_SIM_MODEL" value="gazebo_$(arg vehicle)" />
<env name="PX4_SIM_MODEL" value="gazebo-classic_$(arg vehicle)" />
<arg name="mavlink_udp_port" default="14560"/>
<arg name="mavlink_tcp_port" default="4560"/>
<!-- PX4 configs -->
<arg name="interactive" default="true"/>
<!-- generate sdf vehicle model -->
<arg name="cmd" default="xmlstarlet ed -d '//plugin[@name=&quot;mavlink_interface&quot;]/mavlink_tcp_port' -s '//plugin[@name=&quot;mavlink_interface&quot;]' -t elem -n mavlink_tcp_port -v $(arg mavlink_tcp_port) $(find px4)/Tools/simulation/gazebo/sitl_gazebo/models/$(arg vehicle)/$(arg vehicle).sdf"/>
<arg name="cmd" default="xmlstarlet ed -d '//plugin[@name=&quot;mavlink_interface&quot;]/mavlink_tcp_port' -s '//plugin[@name=&quot;mavlink_interface&quot;]' -t elem -n mavlink_tcp_port -v $(arg mavlink_tcp_port) $(find px4)/Tools/simulation/gazebo-classic/sitl_gazebo-classic/models/$(arg vehicle)/$(arg vehicle).sdf"/>
<param command="$(arg cmd)" name="model_description"/>
<!-- PX4 SITL -->
<arg unless="$(arg interactive)" name="px4_command_arg1" value=""/>

View File

@ -168,7 +168,7 @@ elseif("${PX4_BOARD}" MATCHES "sitl")
# px4 Tools files
install(
PROGRAMS
${PROJECT_SOURCE_DIR}/Tools/simulation/gazebo/setup_gazebo.bash
${PROJECT_SOURCE_DIR}/Tools/simulation/gazebo-classic/setup_gazebo.bash
${PROJECT_SOURCE_DIR}/Tools/upload_log.py
DESTINATION
${PROJECT_NAME}/Tools
@ -182,10 +182,10 @@ elseif("${PX4_BOARD}" MATCHES "sitl")
${PROJECT_NAME}/build/px4_sitl_default
)
# sitl_gazebo built plugins
# sitl_gazebo-classic built plugins
install(
DIRECTORY
${PX4_BINARY_DIR}/build_gazebo
${PX4_BINARY_DIR}/build_gazebo-classic
DESTINATION
${PROJECT_NAME}/build/px4_sitl_default
FILES_MATCHING
@ -193,22 +193,22 @@ elseif("${PX4_BOARD}" MATCHES "sitl")
PATTERN "*.so"
)
# sitl_gazebo dirs
# sitl_gazebo-classic dirs
install(
DIRECTORY
${PROJECT_SOURCE_DIR}/Tools/simulation/gazebo/sitl_gazebo/models
${PROJECT_SOURCE_DIR}/Tools/simulation/gazebo/sitl_gazebo/worlds
${PROJECT_SOURCE_DIR}/Tools/simulation/gazebo-classic/sitl_gazebo-classic/models
${PROJECT_SOURCE_DIR}/Tools/simulation/gazebo-classic/sitl_gazebo-classic/worlds
DESTINATION
${PROJECT_NAME}/Tools/simulation/gazebo/sitl_gazebo
${PROJECT_NAME}/Tools/simulation/gazebo-classic/sitl_gazebo-classic
)
# sitl_gazebo files
# sitl_gazebo-classic files
install(
FILES
${PROJECT_SOURCE_DIR}/Tools/simulation/gazebo/sitl_gazebo/CMakeLists.txt
${PROJECT_SOURCE_DIR}/Tools/simulation/gazebo/sitl_gazebo/package.xml
${PROJECT_SOURCE_DIR}/Tools/simulation/gazebo-classic/sitl_gazebo-classic/CMakeLists.txt
${PROJECT_SOURCE_DIR}/Tools/simulation/gazebo-classic/sitl_gazebo-classic/package.xml
DESTINATION
${PROJECT_NAME}/Tools/simulation/gazebo/sitl_gazebo
${PROJECT_NAME}/Tools/simulation/gazebo-classic/sitl_gazebo-classic
)
endif()

View File

@ -99,12 +99,12 @@
"environment": [
{
"name": "PX4_SIM_MODEL",
"value": "gazebo_iris"
"value": "gazebo-classic_iris"
}
],
"externalConsole": false,
"preLaunchTask": "gazebo",
"postDebugTask": "gazebo kill",
"preLaunchTask": "gazebo-classic",
"postDebugTask": "gazebo-classic kill",
"linux": {
"MIMode": "gdb",
"externalConsole": false,

View File

@ -56,6 +56,6 @@ px4_add_module(
)
include(sitl_targets_flightgear.cmake)
include(sitl_targets_gazebo.cmake)
include(sitl_targets_gazebo-classic.cmake)
include(sitl_targets_jmavsim.cmake)
include(sitl_targets_jsbsim.cmake)

View File

@ -3,7 +3,7 @@ find_package(gazebo)
if(gazebo_FOUND)
message(STATUS "Found gazebo-classic ${gazebo_VERSION}, including sitl_gazebo-classic simulator and targets")
message(STATUS "Found gazebo-classic ${gazebo_VERSION}, including sitl_gazebo-classic simulator and gazebo-classic targets")
# Estimate an appropriate number of parallel jobs
cmake_host_system_information(RESULT AVAILABLE_PHYSICAL_MEMORY QUERY AVAILABLE_PHYSICAL_MEMORY)
@ -40,17 +40,17 @@ if(gazebo_FOUND)
# Limiting sitl_gazebo concurrent jobs to ${parallel_jobs}")
# project to build sitl_gazebo if necessary
px4_add_git_submodule(TARGET git_gazebo PATH "${PX4_SOURCE_DIR}/Tools/simulation/gazebo/sitl_gazebo")
px4_add_git_submodule(TARGET git_sitl_gazebo-classic PATH "${PX4_SOURCE_DIR}/Tools/simulation/gazebo-classic/sitl_gazebo-classic")
include(ExternalProject)
ExternalProject_Add(sitl_gazebo
SOURCE_DIR ${PX4_SOURCE_DIR}/Tools/simulation/gazebo/sitl_gazebo
ExternalProject_Add(sitl_gazebo-classic
SOURCE_DIR ${PX4_SOURCE_DIR}/Tools/simulation/gazebo-classic/sitl_gazebo-classic
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
-DSEND_ODOMETRY_DATA=ON
-DGENERATE_ROS_MODELS=ON
BINARY_DIR ${PX4_BINARY_DIR}/build_gazebo
BINARY_DIR ${PX4_BINARY_DIR}/build_gazebo-classic
INSTALL_COMMAND ""
DEPENDS git_gazebo
DEPENDS git_sitl_gazebo-classic
USES_TERMINAL_CONFIGURE true
USES_TERMINAL_BUILD true
EXCLUDE_FROM_ALL true
@ -114,34 +114,34 @@ if(gazebo_FOUND)
)
# find corresponding airframes
file(GLOB gazebo_airframes
RELATIVE ${PX4_SOURCE_DIR}/ROMFS/px4fmu_common/init.d-posix/airframes
${PX4_SOURCE_DIR}/ROMFS/px4fmu_common/init.d-posix/airframes/*_gazebo_*
file(GLOB gazebo-classic_airframes
RELATIVE ${PX4_SOURCE_DIR}/ROMFS/px4fmu_common/init.d-posix/airframes
${PX4_SOURCE_DIR}/ROMFS/px4fmu_common/init.d-posix/airframes/*_gazebo-classic_*
)
# remove any .post files
foreach(gazebo_airframe IN LISTS gazebo_airframes)
if(gazebo_airframe MATCHES ".post")
list(REMOVE_ITEM gazebo_airframes ${gazebo_airframe})
foreach(gazebo-classic_airframe IN LISTS gazebo-classic_airframes)
if(gazebo-classic_airframe MATCHES ".post")
list(REMOVE_ITEM gazebo-classic_airframes ${gazebo-classic_airframe})
endif()
endforeach()
list(REMOVE_DUPLICATES gazebo_airframes)
list(REMOVE_DUPLICATES gazebo-classic_airframes)
foreach(gazebo_airframe IN LISTS gazebo_airframes)
foreach(gazebo-classic_airframe IN LISTS gazebo-classic_airframes)
set(model_only)
string(REGEX REPLACE ".*_gazebo_" "" model_only ${gazebo_airframe})
string(REGEX REPLACE ".*_gazebo-classic_" "" model_only ${gazebo-classic_airframe})
if(EXISTS "${PX4_SOURCE_DIR}/Tools/simulation/gazebo/sitl_gazebo/models/${model_only}")
if(EXISTS "${PX4_SOURCE_DIR}/Tools/simulation/gazebo-classic/sitl_gazebo-classic/models/${model_only}")
if((EXISTS "${PX4_SOURCE_DIR}/Tools/simulation/gazebo/sitl_gazebo/models/${model_only}/${model_only}.sdf")
OR (EXISTS "${PX4_SOURCE_DIR}/Tools/simulation/gazebo/sitl_gazebo/models/${model_only}/${model_only}.sdf.jinja"))
if((EXISTS "${PX4_SOURCE_DIR}/Tools/simulation/gazebo-classic/sitl_gazebo-classic/models/${model_only}/${model_only}.sdf")
OR (EXISTS "${PX4_SOURCE_DIR}/Tools/simulation/gazebo-classic/sitl_gazebo-classic/models/${model_only}/${model_only}.sdf.jinja"))
#message(STATUS "SDF file found for ${model_only}")
else()
message(WARNING "No SDF file found for ${model_only}")
endif()
else()
message(WARNING "model directory ${PX4_SOURCE_DIR}/Tools/simulation/gazebo/sitl_gazebo/models/${model_only} not found")
message(WARNING "model directory ${PX4_SOURCE_DIR}/Tools/simulation/gazebo-classic/sitl_gazebo-classic/models/${model_only} not found")
endif()
endforeach()
@ -151,73 +151,90 @@ if(gazebo_FOUND)
# match model to airframe
set(airframe_model_only)
set(airframe_sys_autostart)
set(gazebo_airframe_found)
foreach(gazebo_airframe IN LISTS gazebo_airframes)
set(gazebo-classic_airframe_found)
foreach(gazebo-classic_airframe IN LISTS gazebo-classic_airframes)
string(REGEX REPLACE ".*_gazebo_" "" airframe_model_only ${gazebo_airframe})
string(REGEX REPLACE "_gazebo_.*" "" airframe_sys_autostart ${gazebo_airframe})
string(REGEX REPLACE ".*_gazebo-classic_" "" airframe_model_only ${gazebo-classic_airframe})
string(REGEX REPLACE "_gazebo-classic_.*" "" airframe_sys_autostart ${gazebo-classic_airframe})
if(model STREQUAL ${airframe_model_only})
set(gazebo_airframe_found ${gazebo_airframe})
set(gazebo-classic_airframe_found ${gazebo-classic_airframe})
break()
endif()
endforeach()
if(gazebo_airframe_found)
#message(STATUS "gazebo model: ${model} (${airframe_model_only}), airframe: ${gazebo_airframe_found}, SYS_AUTOSTART: ${airframe_sys_autostart}")
if(gazebo-classic_airframe_found)
#message(STATUS "gazebo-classic model: ${model} (${airframe_model_only}), airframe: ${gazebo-classic_airframe_found}, SYS_AUTOSTART: ${airframe_sys_autostart}")
else()
message(WARNING "gazebo missing model: ${model} (${airframe_model_only}), airframe: ${gazebo_airframe_found}, SYS_AUTOSTART: ${airframe_sys_autostart}")
message(WARNING "gazebo-classic missing model: ${model} (${airframe_model_only}), airframe: ${gazebo-classic_airframe_found}, SYS_AUTOSTART: ${airframe_sys_autostart}")
endif()
foreach(world ${worlds})
if(world STREQUAL "none")
if(debugger STREQUAL "none")
if(model STREQUAL "none")
set(_targ_name "gazebo")
set(_targ_name "gazebo-classic")
else()
set(_targ_name "gazebo_${model}")
set(_targ_name "gazebo-classic_${model}")
endif()
else()
if(model STREQUAL "none")
set(_targ_name "gazebo___${debugger}")
set(_targ_name "gazebo-classic___${debugger}")
else()
set(_targ_name "gazebo_${model}_${debugger}")
set(_targ_name "gazebo-classic_${model}_${debugger}")
endif()
endif()
add_custom_target(${_targ_name}
COMMAND ${PX4_SOURCE_DIR}/Tools/simulation/gazebo/sitl_run.sh $<TARGET_FILE:px4> ${debugger} ${model} ${world} ${PX4_SOURCE_DIR} ${PX4_BINARY_DIR}
COMMAND ${PX4_SOURCE_DIR}/Tools/simulation/gazebo-classic/sitl_run.sh $<TARGET_FILE:px4> ${debugger} ${model} ${world} ${PX4_SOURCE_DIR} ${PX4_BINARY_DIR}
WORKING_DIRECTORY ${SITL_WORKING_DIR}
USES_TERMINAL
DEPENDS px4 sitl_gazebo
DEPENDS px4 sitl_gazebo-classic
)
string(REPLACE "gazebo-classic" "gazebo" _targ_name_compat ${_targ_name})
add_custom_target(${_targ_name_compat}
COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --red "WARNING ${_targ_name_compat} target DEPRECATED, please use ${_targ_name}"
COMMAND ${CMAKE_COMMAND} --build ${PX4_BINARY_DIR} -- ${_targ_name}
USES_TERMINAL
VERBATIM
)
else()
if(debugger STREQUAL "none")
if(model STREQUAL "none")
set(_targ_name "gazebo___${world}")
set(_targ_name "gazebo-classic___${world}")
else()
set(_targ_name "gazebo_${model}__${world}")
set(_targ_name "gazebo-classic_${model}__${world}")
endif()
else()
if(model STREQUAL "none")
set(_targ_name "gazebo__${debugger}_${world}")
set(_targ_name "gazebo-classic__${debugger}_${world}")
else()
set(_targ_name "gazebo_${model}_${debugger}_${world}")
set(_targ_name "gazebo-classic_${model}_${debugger}_${world}")
endif()
endif()
add_custom_target(${_targ_name}
COMMAND ${PX4_SOURCE_DIR}/Tools/simulation/gazebo/sitl_run.sh $<TARGET_FILE:px4> ${debugger} ${model} ${world} ${PX4_SOURCE_DIR} ${PX4_BINARY_DIR}
COMMAND ${PX4_SOURCE_DIR}/Tools/simulation/gazebo-classic/sitl_run.sh $<TARGET_FILE:px4> ${debugger} ${model} ${world} ${PX4_SOURCE_DIR} ${PX4_BINARY_DIR}
WORKING_DIRECTORY ${SITL_WORKING_DIR}
USES_TERMINAL
DEPENDS px4 sitl_gazebo
DEPENDS px4 sitl_gazebo-classic
)
string(REPLACE "gazebo-classic" "gazebo" _targ_name_compat ${_targ_name})
add_custom_target(${_targ_name_compat}
COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --red "WARNING ${_targ_name_compat} target DEPRECATED, please use ${_targ_name}"
COMMAND ${CMAKE_COMMAND} --build ${PX4_BINARY_DIR} -- ${_targ_name}
USES_TERMINAL
VERBATIM
)
endif()
endforeach()
endforeach()
endforeach()
add_custom_target(gazebo DEPENDS gazebo_iris) # alias
add_custom_target(gazebo-classic DEPENDS gazebo-classic_iris) # alias
add_custom_target(gazebo DEPENDS gazebo-classic_iris) # alias
# mavsdk tests currently depend on sitl_gazebo
ExternalProject_Add(mavsdk_tests

View File

@ -10,8 +10,10 @@ import threading
import errno
from typing import Any, Dict, List, TextIO, Optional
PX4_GAZEBO_MODELS = "Tools/simulation/gazebo/sitl_gazebo/models"
PX4_GAZEBO_WORLDS = "Tools/simulation/gazebo/sitl_gazebo/worlds"
PX4_SITL_GAZEBO_PATH = "Tools/simulation/gazebo-classic/sitl_gazebo-classic"
PX4_GAZEBO_MODELS = PX4_SITL_GAZEBO_PATH + "/models"
PX4_GAZEBO_WORLDS = PX4_SITL_GAZEBO_PATH + "/worlds"
class Runner:
@ -164,7 +166,7 @@ class Px4Runner(Runner):
os.path.join(workspace_dir, "test_data"),
"-d"
]
self.env["PX4_SIM_MODEL"] = "gazebo_" + self.model
self.env["PX4_SIM_MODEL"] = "gazebo-classic_" + self.model
self.env["PX4_SIM_SPEED_FACTOR"] = str(speed_factor)
self.debugger = debugger
self.clear_rootfs()
@ -224,7 +226,7 @@ class GzserverRunner(Runner):
self.name = "gzserver"
self.cwd = workspace_dir
self.env["GAZEBO_PLUGIN_PATH"] = \
os.path.join(workspace_dir, build_dir, "build_gazebo")
os.path.join(workspace_dir, build_dir, "build_gazebo-classic")
self.env["GAZEBO_MODEL_PATH"] = \
os.path.join(workspace_dir, PX4_GAZEBO_MODELS)
self.env["PX4_SIM_SPEED_FACTOR"] = str(speed_factor)
@ -262,7 +264,7 @@ class GzmodelspawnRunner(Runner):
self.name = "gzmodelspawn"
self.cwd = workspace_dir
self.env["GAZEBO_PLUGIN_PATH"] = \
os.path.join(workspace_dir, build_dir, "build_gazebo")
os.path.join(workspace_dir, build_dir, "build_gazebo-classic")
self.env["GAZEBO_MODEL_PATH"] = \
os.path.join(workspace_dir, PX4_GAZEBO_MODELS)
self.cmd = "gz"

View File

@ -4,9 +4,9 @@ DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
PX4_SRC_DIR=${DIR}/..
source /opt/ros/${ROS_DISTRO:-kinetic}/setup.bash
source ${PX4_SRC_DIR}/Tools/simulation/gazebo/setup_gazebo.bash ${PX4_SRC_DIR} ${PX4_SRC_DIR}/build/px4_sitl_default
source ${PX4_SRC_DIR}/Tools/simulation/gazebo-classic/setup_gazebo.bash ${PX4_SRC_DIR} ${PX4_SRC_DIR}/build/px4_sitl_default
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:${PX4_SRC_DIR}:${PX4_SRC_DIR}/Tools/simulation/gazebo/sitl_gazebo
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:${PX4_SRC_DIR}:${PX4_SRC_DIR}/Tools/simulation/gazebo-classic/sitl_gazebo-classic
export ROS_LOG_DIR="$HOME/.ros/ros_logs"
mkdir -p "$ROS_LOG_DIR"