Skip to content

Commit

Permalink
rename 'gazebo' simulation to 'gazebo-classic' (PX4#20936)
Browse files Browse the repository at this point in the history
 - 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)
  • Loading branch information
dagar authored Jan 15, 2023
1 parent 6605378 commit 6991ac0
Show file tree
Hide file tree
Showing 56 changed files with 169 additions and 153 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/mavros_mission_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/mavros_offboard_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/sitl_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 13 additions & 13 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
},
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -194,7 +194,7 @@
"dependsOn":["ign gazebo kill"]
},
{
"label": "gazebo kill",
"label": "gazebo-classic kill",
"type": "shell",
"command": "pkill -9 -f gzserver || true",
"presentation": {
Expand Down
17 changes: 7 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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/"
Expand Down
68 changes: 34 additions & 34 deletions ROMFS/px4fmu_common/init.d-posix/airframes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,54 +33,54 @@

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

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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}"

Expand Down Expand Up @@ -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 )"
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down
Loading

0 comments on commit 6991ac0

Please sign in to comment.