mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-10 02:11:35 +08:00
init.d-posix: make all simulation airframes simulator specific
This commit is contained in:
@@ -22,7 +22,7 @@ echo build_path: $build_path
|
||||
rootfs="$build_path/rootfs" # this is the working directory
|
||||
mkdir -p "$rootfs"
|
||||
|
||||
export PX4_SIM_MODEL=${model}
|
||||
export PX4_SIM_MODEL=flightgear_${model}
|
||||
|
||||
echo "FG setup"
|
||||
cd "${src_path}/Tools/simulation/flightgear/flightgear_bridge/"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/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 gazebo'
|
||||
# It assumes px4 is already built, with 'make px4_sitl_default sitl_gazebo'
|
||||
|
||||
# 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:
|
||||
@@ -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=${vehicle_model}
|
||||
export PX4_SIM_MODEL=gazebo_${vehicle_model}
|
||||
|
||||
echo ${SCRIPT}
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
@@ -126,7 +126,7 @@ else
|
||||
|
||||
m=0
|
||||
while [ $m -lt ${target_number} ]; do
|
||||
export PX4_SIM_MODEL=${target_vehicle}
|
||||
export PX4_SIM_MODEL=gazebo_${target_vehicle}
|
||||
spawn_model ${target_vehicle}${LABEL} $n $target_x $target_y
|
||||
m=$(($m + 1))
|
||||
n=$(($n + 1))
|
||||
|
||||
@@ -67,7 +67,7 @@ fi
|
||||
# be running from last time
|
||||
pkill -x gazebo || true
|
||||
|
||||
export PX4_SIM_MODEL=${model}
|
||||
export PX4_SIM_MODEL=gazebo_${model}
|
||||
export PX4_SIM_WORLD=${world}
|
||||
|
||||
SIM_PID=0
|
||||
@@ -75,10 +75,6 @@ SIM_PID=0
|
||||
if [ -x "$(command -v gazebo)" ]; then
|
||||
# Get the model name
|
||||
model_name="${model}"
|
||||
# Check if a 'modelname-gen.sdf' file exist for the models using jinja and generating the SDF files
|
||||
if [ -f "${src_path}/Tools/simulation/gazebo/sitl_gazebo/models/${model}/${model}-gen.sdf" ]; then
|
||||
model_name="${model}-gen"
|
||||
fi
|
||||
|
||||
# Set the plugin path so Gazebo finds our model and sim
|
||||
source "$src_path/Tools/simulation/gazebo/setup_gazebo.bash" "${src_path}" "${build_path}"
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
SCRIPT_DIR=$(dirname $(readlink -f "$BASH_SOURCE"))
|
||||
|
||||
cd "$SCRIPT_DIR/jMAVSim"
|
||||
|
||||
port=4560
|
||||
@@ -73,4 +74,4 @@ fi
|
||||
ant create_run_jar copy_res
|
||||
cd out/production
|
||||
|
||||
java -XX:GCTimeRatio=20 -Djava.ext.dirs= -jar jmavsim_run.jar $device $extra_args
|
||||
java -XX:GCTimeRatio=20 --illegal-access=permit -Djava.ext.dirs= -jar jmavsim_run.jar $device $extra_args
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
if [ "$#" -lt 3 ]; then
|
||||
echo usage: sitl_run.sh sitl_bin debugger src_path build_path
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sitl_bin="$1"
|
||||
debugger="$2"
|
||||
src_path="$3"
|
||||
build_path="$4"
|
||||
|
||||
echo SITL ARGS
|
||||
|
||||
echo sitl_bin: $sitl_bin
|
||||
echo debugger: $debugger
|
||||
echo src_path: $src_path
|
||||
echo build_path: $build_path
|
||||
|
||||
rootfs="$build_path/rootfs" # this is the working directory
|
||||
mkdir -p "$rootfs"
|
||||
|
||||
# To disable user input
|
||||
if [[ -n "$NO_PXH" ]]; then
|
||||
no_pxh=-d
|
||||
else
|
||||
no_pxh=""
|
||||
fi
|
||||
|
||||
jmavsim_pid=`ps aux | grep java | grep "\-jar jmavsim_run.jar" | awk '{ print $2 }'`
|
||||
if [ -n "$jmavsim_pid" ]; then
|
||||
kill $jmavsim_pid
|
||||
fi
|
||||
|
||||
export PX4_SIM_MODEL="iris"
|
||||
|
||||
# Start Java simulator
|
||||
"$src_path"/Tools/simulation/jmavsim/jmavsim_run.sh -r 250 -l &
|
||||
SIM_PID=$!
|
||||
|
||||
pushd "$rootfs" >/dev/null
|
||||
|
||||
# Do not exit on failure now from here on because we want the complete cleanup
|
||||
set +e
|
||||
|
||||
sitl_command="\"$sitl_bin\" $no_pxh \"$build_path\"/etc"
|
||||
|
||||
echo SITL COMMAND: $sitl_command
|
||||
|
||||
if [ "$debugger" == "lldb" ]; then
|
||||
eval lldb -- $sitl_command
|
||||
elif [ "$debugger" == "gdb" ]; then
|
||||
eval gdb --args $sitl_command
|
||||
elif [ "$debugger" == "valgrind" ]; then
|
||||
eval valgrind --track-origins=yes --leak-check=full -v $sitl_command
|
||||
elif [ "$debugger" == "callgrind" ]; then
|
||||
eval valgrind --tool=callgrind -v $sitl_command
|
||||
else
|
||||
eval $sitl_command
|
||||
fi
|
||||
|
||||
popd >/dev/null
|
||||
|
||||
pkill -9 -P $SIM_PID
|
||||
kill -9 $SIM_PID
|
||||
@@ -37,7 +37,7 @@ else
|
||||
no_pxh=""
|
||||
fi
|
||||
|
||||
export PX4_SIM_MODEL=${model}
|
||||
export PX4_SIM_MODEL=jsbsim_${model}
|
||||
export PX4_SIM_WORLD=${world}
|
||||
|
||||
# This is needed for aircraft namespace mapping
|
||||
|
||||
@@ -19,7 +19,7 @@ pkill -x px4 || true
|
||||
|
||||
sleep 1
|
||||
|
||||
export PX4_SIM_MODEL=iris
|
||||
export PX4_SIM_MODEL=gazebo_iris
|
||||
|
||||
n=0
|
||||
while [ $n -lt $sitl_num ]; do
|
||||
|
||||
Reference in New Issue
Block a user