mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 07:28:54 +08:00
feat(sim): add SIH SITL build target and multi-instance args
- Add boards/px4/sitl/sih.px4board disabling Gazebo bridge/msgs/plugins - Update sitl_multiple_run.sh to accept model and build target arguments - Add openjdk@17 to macOS setup script for jMAVSim display-only mode Signed-off-by: Ramon Roche <mrpollo@gmail.com>
This commit is contained in:
@@ -79,6 +79,13 @@ if [[ $INSTALL_SIM == "--sim-tools" ]]; then
|
|||||||
elif [[ $REINSTALL_FORMULAS == "--reinstall" ]]; then
|
elif [[ $REINSTALL_FORMULAS == "--reinstall" ]]; then
|
||||||
brew reinstall px4-sim
|
brew reinstall px4-sim
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# jMAVSim requires a JDK (Java 17 LTS recommended)
|
||||||
|
if ! brew ls --versions openjdk@17 > /dev/null; then
|
||||||
|
echo "[macos.sh] Installing OpenJDK 17 (required for jMAVSim)"
|
||||||
|
brew install openjdk@17
|
||||||
|
sudo ln -sfn $(brew --prefix openjdk@17)/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-17.jdk
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "[macos.sh] All set! The PX4 Autopilot toolchain was installed."
|
echo "[macos.sh] All set! The PX4 Autopilot toolchain was installed."
|
||||||
|
|||||||
@@ -1,25 +1,28 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# run multiple instances of the 'px4' binary, but w/o starting the simulator.
|
# Run multiple instances of the 'px4' binary, without starting an external simulator.
|
||||||
# It assumes px4 is already built, with 'make px4_sitl_default'
|
# It assumes px4 is already built with the specified build target.
|
||||||
|
#
|
||||||
|
# Usage: ./Tools/simulation/sitl_multiple_run.sh [num_instances] [model] [build_target]
|
||||||
|
# Examples:
|
||||||
|
# ./Tools/simulation/sitl_multiple_run.sh 3 sihsim_quadx px4_sitl_sih
|
||||||
|
# ./Tools/simulation/sitl_multiple_run.sh 2 gazebo-classic_iris px4_sitl_default
|
||||||
|
# ./Tools/simulation/sitl_multiple_run.sh # defaults: 2 instances, gazebo-classic_iris, px4_sitl_default
|
||||||
|
|
||||||
# The simulator is expected to send to TCP port 4560+i for i in [0, N-1]
|
sitl_num=${1:-2}
|
||||||
# For example jmavsim can be run like this:
|
sim_model=${2:-gazebo-classic_iris}
|
||||||
#./Tools/simulation/jmavsim/jmavsim_run.sh -p 4561 -l
|
build_target=${3:-px4_sitl_default}
|
||||||
|
|
||||||
sitl_num=2
|
|
||||||
[ -n "$1" ] && sitl_num="$1"
|
|
||||||
|
|
||||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
src_path="$SCRIPT_DIR/../../"
|
src_path="$SCRIPT_DIR/../../"
|
||||||
|
|
||||||
build_path=${src_path}/build/px4_sitl_default
|
build_path=${src_path}/build/${build_target}
|
||||||
|
|
||||||
echo "killing running instances"
|
echo "killing running instances"
|
||||||
pkill -x px4 || true
|
pkill -x px4 || true
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
export PX4_SIM_MODEL=gazebo-classic_iris
|
export PX4_SIM_MODEL=${sim_model}
|
||||||
|
|
||||||
n=0
|
n=0
|
||||||
while [ $n -lt $sitl_num ]; do
|
while [ $n -lt $sitl_num ]; do
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
CONFIG_MODULES_SIMULATION_GZ_BRIDGE=n
|
||||||
|
CONFIG_MODULES_SIMULATION_GZ_MSGS=n
|
||||||
|
CONFIG_MODULES_SIMULATION_GZ_PLUGINS=n
|
||||||
Reference in New Issue
Block a user