simulation organization and cleanup

- new modules/simulation directory to collect all simulators and related modules
 - new Tools/simulation directory to collect and organize scattered simulation submodules, scripts, etc
 - simulation module renamed to simulator_mavlink
 - sih renamed to simulator_sih (not a great name, but I wanted to be clear it was a simulator)
 - ignition_simulator renamed to simulator_ignition_bridge
 - large sitl_target.cmake split by simulation option and in some cases pushed to appropriate modules
 - sitl targets broken down to what's actually available (eg jmavsim only has 1 model and 1 world)
 - new Gazebo consistently referred to as Ignition for now (probably the least confusing thing until we fully drop Gazebo classic support someday)
This commit is contained in:
Daniel Agar 2022-08-22 11:00:03 -04:00
parent 6b2509cbba
commit 4040e4cdf2
200 changed files with 1778 additions and 2806 deletions

14
.gitmodules vendored
View File

@ -6,12 +6,12 @@
path = src/drivers/uavcan/libuavcan
url = https://github.com/dronecan/libuavcan.git
branch = main
[submodule "Tools/jMAVSim"]
path = Tools/jMAVSim
[submodule "Tools/simulation/jmavsim/jMAVSim"]
path = Tools/simulation/jmavsim/jMAVSim
url = https://github.com/PX4/jMAVSim.git
branch = master
[submodule "Tools/sitl_gazebo"]
path = Tools/sitl_gazebo
[submodule "Tools/simulation/gazebo/sitl_gazebo"]
path = Tools/simulation/gazebo/sitl_gazebo
url = https://github.com/PX4/PX4-SITL_gazebo.git
branch = master
[submodule "src/drivers/gps/devices"]
@ -31,10 +31,10 @@
url = https://github.com/PX4/NuttX-apps.git
branch = px4_firmware_nuttx-10.1.0+
[submodule "Tools/flightgear_bridge"]
path = Tools/flightgear_bridge
path = Tools/simulation/flightgear/flightgear_bridge
url = https://github.com/PX4/PX4-FlightGear-Bridge.git
[submodule "Tools/jsbsim_bridge"]
path = Tools/jsbsim_bridge
[submodule "Tools/simulation/jsbsim/jsbsim_bridge"]
path = Tools/simulation/jsbsim/jsbsim_bridge
url = https://github.com/PX4/px4-jsbsim-bridge.git
[submodule "src/drivers/cyphal/libcanard"]
path = src/drivers/cyphal/libcanard

View File

@ -2,7 +2,7 @@ CONFIG:
default: px4_sitl_default
choices:
px4_sitl_default:
short: px4_sitl
short: px4_sitl_default
buildType: RelWithDebInfo
settings:
CONFIG: px4_sitl_default

155
.vscode/tasks.json vendored
View File

@ -54,7 +54,7 @@
"type": "shell",
"command": "ant create_run_jar copy_res",
"options": {
"cwd": "${workspaceFolder}/Tools/jMAVSim"
"cwd": "${workspaceFolder}/Tools/simulation/jmavsim/jMAVSim"
},
"problemMatcher": [],
"presentation":{
@ -72,7 +72,7 @@
"dependsOn": "jmavsim build",
"command": "java -Djava.ext.dirs= -jar jmavsim_run.jar -r 250 -lockstep -tcp localhost:4560 -qgc",
"options": {
"cwd": "${workspaceFolder}/Tools/jMAVSim/out/production",
"cwd": "${workspaceFolder}/Tools/simulation/jmavsim/jMAVSim/out/production",
"env": {
"PX4_SIM_SPEED_FACTOR": "1"
}
@ -86,6 +86,62 @@
"showReuseMessage": false,
"clear": false
},
"problemMatcher": []
},
{
"label": "jmavsim kill",
"type": "shell",
"command": "kill $(ps aux | grep jmavsim | grep -v 'grep' | awk '{print $2}')",
"presentation": {
"echo": false,
"reveal": "never",
"focus": false,
"panel": "shared",
"showReuseMessage": false,
"clear": false
},
"problemMatcher": [],
"dependsOn":["px4_sitl_cleanup"]
},
{
"label": "gazebo build",
"type": "shell",
"command": "make px4_sitl_default sitl_gazebo",
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [],
"presentation":{
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared",
"showReuseMessage": false,
"clear": false,
}
},
{
"label": "gazebo start",
"type": "shell",
"dependsOn": "gazebo 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",
"PX4_SIM_SPEED_FACTOR": "1"
}
},
"command": "gzserver --verbose ${workspaceFolder}/Tools/simulation/gazebo/sitl_gazebo/worlds/${input:gazeboWorld}.world",
"isBackground": true,
"presentation": {
"echo": true,
"reveal": "never",
"focus": false,
"panel": "shared",
"showReuseMessage": false,
"clear": false
},
"problemMatcher": [
{
"pattern": [
@ -105,31 +161,56 @@
]
},
{
"label": "jmavsim kill",
"label": "gazebo",
"type": "shell",
"command": "kill $(ps aux | grep jmavsim | grep -v 'grep' | awk '{print $2}')",
"dependsOn": "gazebo 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",
"PX4_SIM_SPEED_FACTOR": "1"
}
},
"command": "gz model --verbose --spawn-file=${workspaceFolder}/Tools/simulation/gazebo/sitl_gazebo/models/${input:gazeboModel}/${input:gazeboModel}.sdf --model-name=${input:gazeboModel} -x 1.01 -y 0.98 -z 0.83",
"isBackground": false,
"presentation": {
"echo": false,
"echo": true,
"reveal": "never",
"focus": false,
"panel": "shared",
"showReuseMessage": false,
"clear": false
},
"problemMatcher": []
"problemMatcher": [
{
"pattern": [
{
"regexp": ".",
"file": 1,
"location": 2,
"message": 3
}
],
"background": {
"activeOnStart": true,
"beginsPattern": ".",
"endsPattern": ".",
}
}
]
},
{
"label": "gazebo",
"label": "ign gazebo",
"type": "shell",
"options": {
"cwd": "${workspaceFolder}",
"env": {
"IGN_GAZEBO_RESOURCE_PATH": "${workspaceFolder}/Tools/simulation/gazebo/models",
"IGN_GAZEBO_RESOURCE_PATH": "${workspaceFolder}/Tools/simulation/ignition/models",
"PX4_SIM_SPEED_FACTOR": "1"
}
},
"command": "ign gazebo -v 4 -r ${workspaceFolder}/Tools/simulation/gazebo/worlds/${input:gazeboWorld}.sdf",
"command": "ign gazebo -v 4 -r ${workspaceFolder}/Tools/simulation/ignition/worlds/${input:ignWorld}.sdf",
"isBackground": true,
"presentation": {
"echo": true,
@ -159,10 +240,26 @@
}
]
},
{
"label": "gazebo kill",
"type": "shell",
"command": "pkill -9 -f gzserver || true",
"presentation": {
"echo": true,
"reveal": "never",
"revealProblems": "onProblem",
"focus": false,
"panel": "dedicated",
"showReuseMessage": false,
"clear": false,
"close": true
},
"problemMatcher": [],
"dependsOn":["px4_sitl_cleanup"]
},
{
"label": "ign gazebo kill",
"type": "shell",
"command": "pkill -9 -f ign || true",
"presentation": {
"echo": true,
@ -247,12 +344,46 @@
}
],
"inputs": [
{
"type": "pickString",
"id": "ignWorld",
"description": "Ignition world",
"options": [
"default"
],
"default": "default"
},
{
"type": "pickString",
"id": "gazeboModel",
"description": "gazebo model",
"options": [
"iris",
"typhoon_h480",
"plane",
"plane_catapult",
"plane_lidar",
"standard_vtol",
"tailsitter",
"tiltrotor",
"r1_rover",
"boat"
],
"default": "iris"
},
{
"type": "pickString",
"id": "gazeboWorld",
"description": "gazebo world",
"options": [
"empty"
"baylands",
"empty",
"ksql_airport",
"mcmillan_airfield",
"sonoma_raceway",
"warehouse",
"windy",
"yosemite"
],
"default": "empty"
}

8
Jenkinsfile vendored
View File

@ -26,15 +26,15 @@ pipeline {
// echo $0;
// mkdir -p catkin_ws/src;
// cd catkin_ws;
// git -C ${WORKSPACE}/catkin_ws/src/Firmware submodule update --init --recursive --force Tools/sitl_gazebo
// git clone --recursive ${WORKSPACE}/catkin_ws/src/Firmware/Tools/sitl_gazebo src/mavlink_sitl_gazebo;
// git -C ${WORKSPACE}/catkin_ws/src/Firmware submodule update --init --recursive --force Tools/simulation/gazebo/sitl_gazebo
// git clone --recursive ${WORKSPACE}/catkin_ws/src/Firmware/Tools/simulation/gazebo/sitl_gazebo src/mavlink_sitl_gazebo;
// git -C ${WORKSPACE}/catkin_ws/src/Firmware fetch --tags;
// source /opt/ros/melodic/setup.bash;
// export PYTHONPATH=/opt/ros/$ROS_DISTRO/lib/python2.7/dist-packages:/usr/lib/python2.7/dist-packages:/usr/local/lib/python2.7/dist-packages;
// catkin init;
// catkin build -j$(nproc) -l$(nproc);
// '''
// // test if the binary was correctly installed and runs using 'mavros_posix_silt.launch'
// // test if the binary was correctly installed and runs using 'mavros_posix_sitl.launch'
// sh '''#!/bin/bash -l
// echo $0;
// source catkin_ws/devel/setup.bash;
@ -68,7 +68,7 @@ pipeline {
unset ROS_DISTRO;
mkdir -p colcon_ws/src;
cd colcon_ws;
git -C ${WORKSPACE}/colcon_ws/src/Firmware submodule update --init --recursive --force Tools/sitl_gazebo;
git -C ${WORKSPACE}/colcon_ws/src/Firmware submodule update --init --recursive --force Tools/simulation/gazebo/sitl_gazebo;
git -C ${WORKSPACE}/colcon_ws/src/Firmware fetch --tags;
source /opt/ros/foxy/setup.sh;
colcon build --event-handlers console_direct+ --symlink-install;

View File

@ -9,6 +9,8 @@
. ${R}etc/init.d/rc.mc_defaults
PX4_SIMULATOR=${PX4_SIMULATOR:=sihsim}
PX4_SIM_MODEL=${PX4_SIM_MODEL:=quadx}
# disable some checks to allow to fly:
# - with usb

View File

@ -8,6 +8,8 @@
. ${R}etc/init.d/rc.fw_defaults
PX4_SIMULATOR=${PX4_SIMULATOR:=sihsim}
PX4_SIM_MODEL=${PX4_SIM_MODEL:=airplane}
# disable some checks to allow to fly:
# - with usb

View File

@ -8,6 +8,9 @@
. ${R}etc/init.d/rc.vtol_defaults
PX4_SIMULATOR=${PX4_SIMULATOR:=sihsim}
PX4_SIM_MODEL=${PX4_SIM_MODEL:=xvert}
param set-default VT_ELEV_MC_LOCK 0
param set-default VT_TYPE 0
param set-default VT_FW_DIFTHR_EN 1

View File

@ -7,6 +7,10 @@
. ${R}etc/init.d/rc.mc_defaults
PX4_SIMULATOR=${PX4_SIMULATOR:=ignition}
PX4_SIM_MODEL=${PX4_SIM_MODEL:=x3}
PX4_SIM_WORLD=${PX4_SIM_WORLD:=default}
param set-default SYS_CTRL_ALLOC 1
param set-default CA_AIRFRAME 0
@ -28,19 +32,19 @@ param set-default CA_ROTOR3_PX -0.13
param set-default CA_ROTOR3_PY 0.20
param set-default CA_ROTOR3_KM -0.05
param set-default SIM_GZ_FUNC1 101
param set-default SIM_GZ_FUNC2 102
param set-default SIM_GZ_FUNC3 103
param set-default SIM_GZ_FUNC4 104
param set-default SIM_IGN_FUNC1 101
param set-default SIM_IGN_FUNC2 102
param set-default SIM_IGN_FUNC3 103
param set-default SIM_IGN_FUNC4 104
param set-default SIM_GZ_MIN1 150
param set-default SIM_GZ_MIN2 150
param set-default SIM_GZ_MIN3 150
param set-default SIM_GZ_MIN4 150
param set-default SIM_IGN_MIN1 150
param set-default SIM_IGN_MIN2 150
param set-default SIM_IGN_MIN3 150
param set-default SIM_IGN_MIN4 150
param set-default SIM_GZ_MAX1 1000
param set-default SIM_GZ_MAX2 1000
param set-default SIM_GZ_MAX3 1000
param set-default SIM_GZ_MAX4 1000
param set-default SIM_IGN_MAX1 1000
param set-default SIM_IGN_MAX2 1000
param set-default SIM_IGN_MAX3 1000
param set-default SIM_IGN_MAX4 1000
param set-default MPC_THR_HOVER 0.60

View File

@ -7,6 +7,10 @@
. ${R}etc/init.d/rc.mc_defaults
PX4_SIMULATOR=${PX4_SIMULATOR:=ignition}
PX4_SIM_MODEL=${PX4_SIM_MODEL:=x4}
PX4_SIM_WORLD=${PX4_SIM_WORLD:=default}
param set-default SYS_CTRL_ALLOC 1
param set-default CA_AIRFRAME 0
@ -36,26 +40,26 @@ param set-default CA_ROTOR5_PX 0.25
param set-default CA_ROTOR5_PY 0.15
param set-default CA_ROTOR5_KM -0.05
param set-default SIM_GZ_FUNC1 101
param set-default SIM_GZ_FUNC2 102
param set-default SIM_GZ_FUNC3 103
param set-default SIM_GZ_FUNC4 104
param set-default SIM_GZ_FUNC5 105
param set-default SIM_GZ_FUNC6 106
param set-default SIM_IGN_FUNC1 101
param set-default SIM_IGN_FUNC2 102
param set-default SIM_IGN_FUNC3 103
param set-default SIM_IGN_FUNC4 104
param set-default SIM_IGN_FUNC5 105
param set-default SIM_IGN_FUNC6 106
param set-default SIM_GZ_MIN1 150
param set-default SIM_GZ_MIN2 150
param set-default SIM_GZ_MIN3 150
param set-default SIM_GZ_MIN4 150
param set-default SIM_GZ_MIN5 150
param set-default SIM_GZ_MIN6 150
param set-default SIM_IGN_MIN1 150
param set-default SIM_IGN_MIN2 150
param set-default SIM_IGN_MIN3 150
param set-default SIM_IGN_MIN4 150
param set-default SIM_IGN_MIN5 150
param set-default SIM_IGN_MIN6 150
param set-default SIM_GZ_MAX1 1000
param set-default SIM_GZ_MAX2 1000
param set-default SIM_GZ_MAX3 1000
param set-default SIM_GZ_MAX4 1000
param set-default SIM_GZ_MAX5 1000
param set-default SIM_GZ_MAX6 1000
param set-default SIM_IGN_MAX1 1000
param set-default SIM_IGN_MAX2 1000
param set-default SIM_IGN_MAX3 1000
param set-default SIM_IGN_MAX4 1000
param set-default SIM_IGN_MAX5 1000
param set-default SIM_IGN_MAX6 1000
param set-default MC_PITCHRATE_D 0.0016

View File

@ -32,7 +32,7 @@ mavlink start -x -u $udp_onboard_payload_port_local -r 4000 -f -m onboard -o $ud
mavlink start -x -u $udp_onboard_gimbal_port_local -r 400000 -m gimbal -o $udp_onboard_gimbal_port_remote
# To display for SIH sitl
if [ "$SIM_MODE" = "sihsim" ]; then
if [ "$PX4_SIMULATOR" = "sihsim" ]; then
udp_sihsim_port_local=$((19450+px4_instance))
udp_sihsim_port_remote=$((19410+px4_instance))
mavlink start -x -u $udp_sihsim_port_local -r 400000 -m custom -o $udp_sihsim_port_remote

View File

@ -1,25 +1,50 @@
#!/bin/sh
# shellcheck disable=SC2154
PX4_SIM_WORLD="${PX4_SIM_WORLD:="empty"}" # default to empty world?
# Simulator IMU data provided at 250 Hz
param set-default IMU_INTEG_RATE 250
echo "PX4_SIM_MODEL: ${PX4_SIM_MODEL}"
echo "PX4_SIM_WORLD: ${PX4_SIM_WORLD}"
if [ "$PX4_SIMULATOR" = "sihsim" ] || [ "$(param show -q SYS_AUTOSTART)" -eq "0" ]; then
# TODO: verify if world exists
ign service --info --service /world/${PX4_SIM_WORLD}/create
echo $?
if ! simulator_sih start; then
echo "ERROR [init] simulator_sih failed to start"
exit 1
fi
ign service -s /world/${PX4_SIM_WORLD}/create --reqtype ignition.msgs.EntityFactory --reptype ignition.msgs.Boolean --timeout 1000 --req "sdf_filename: \"${PX4_SIM_MODEL}/model.sdf\""
elif [ "$PX4_SIMULATOR" = "ignition" ]; then
if ignition_simulator start -m "${PX4_SIM_MODEL}" -w "${PX4_SIM_WORLD}"
then
# source generated gazebo_env.sh for IGN_GAZEBO_RESOURCE_PATH
if [ -f gazebo_env.sh ]; then
. ./gazebo_env.sh
elif [ -f ../gazebo_env.sh ]; then
. ../gazebo_env.sh
fi
sensor_baro_sim start
sensor_gps_sim start
sensor_mag_sim start
if ! ign service --info --service /world/${PX4_SIM_WORLD}/create | grep "ignition.msgs.EntityFactory"; then
# starting ign gazebo with ${PX4_SIM_WORLD} world
echo "INFO [init] starting ign gazebo"
if [ -z $HEADLESS ]; then
ign gazebo --verbose=1 -r "${PX4_IGN_GAZEBO_WORLDS}/${PX4_SIM_WORLD}.sdf" &
else
# starting ign gazebo headless
ign gazebo --verbose=1 -r -s "${PX4_IGN_GAZEBO_WORLDS}/${PX4_SIM_WORLD}.sdf" &
fi
else
echo "INFO [init] ign gazebo already running"
fi
if simulator_ignition_bridge start -m "${PX4_SIM_MODEL}" -w "${PX4_SIM_WORLD}"; then
sensor_baro_sim start
sensor_gps_sim start
sensor_mag_sim start
else
echo "ERROR [init] ign gazebo failed to start"
exit 1
fi
else
# otherwise start simulator (mavlink) module
simulator_tcp_port=$((4560+px4_instance))
# Check if PX4_SIM_HOSTNAME environment variable is empty
@ -29,15 +54,15 @@ else
if [ -z "${PX4_SIM_HOST_ADDR}" ]; then
echo "PX4 SIM HOST: localhost"
simulator start -c $simulator_tcp_port
simulator_mavlink start -c $simulator_tcp_port
else
echo "PX4 SIM HOST: $PX4_SIM_HOST_ADDR"
simulator start -t $PX4_SIM_HOST_ADDR $simulator_tcp_port
simulator_mavlink start -t $PX4_SIM_HOST_ADDR $simulator_tcp_port
fi
else
echo "PX4 SIM HOST: $PX4_SIM_HOSTNAME"
simulator start -h $PX4_SIM_HOSTNAME $simulator_tcp_port
simulator_mavlink start -h $PX4_SIM_HOSTNAME $simulator_tcp_port
fi
fi

View File

@ -38,10 +38,24 @@ set LOGGER_BUF 1000
set RUN_MINIMAL_SHELL no
# Use the variable set by sitl_run.sh to choose the model settings.
if [ "$PX4_SIM_MODEL" = "shell" ]; then
set SYS_AUTOSTART=0
if [ "$PX4_SIM_MODEL" = "shell" ]
then
set RUN_MINIMAL_SHELL yes
else
elif [ -n "$PX4_SYS_AUTOSTART" ]
then
echo "env SYS_AUTOSTART: ${PX4_SYS_AUTOSTART}"
SYS_AUTOSTART=${PX4_SYS_AUTOSTART}
elif [ "$PX4_SIM_MODEL" = "none" ] || [ -z $PX4_SIM_MODEL ]
then
# no airframe selected
SYS_AUTOSTART=0
elif [ -n "$PX4_SIM_MODEL" ]
then
# Find the matching Autostart ID (file name has the form: [0-9]+_${PX4_SIM_MODEL})
# TODO: unify with rc.autostart generation
# shellcheck disable=SC2012
@ -50,12 +64,13 @@ else
echo "ERROR [init] Unknown model $PX4_SIM_MODEL (not found by name on ${R}etc/init.d-posix/airframes)"
exit 1
else
SYS_AUTOSTART=$REQUESTED_AUTOSTART
echo "INFO [init] found model autostart file as SYS_AUTOSTART=$REQUESTED_AUTOSTART"
fi
fi
# Load parameters
set PARAM_FILE eeprom/parameters_"$REQUESTED_AUTOSTART"
set PARAM_FILE parameters.bson
param select $PARAM_FILE
if [ -f $PARAM_FILE ]
@ -66,26 +81,16 @@ then
else
echo "[param] FAILED loading $PARAM_FILE"
fi
else
echo "[param] parameter file not found, creating $PARAM_FILE"
fi
# exit early when the minimal shell is requested
[ $RUN_MINIMAL_SHELL = yes ] && exit 0
if param compare SYS_AUTOSTART $SYS_AUTOSTART
then
set AUTOCNF no
# Use environment variable PX4_ESTIMATOR to choose estimator.
if [ "$PX4_ESTIMATOR" = "q" ]; then
param set SYS_MC_EST_GROUP 3
elif [ "$PX4_ESTIMATOR" = "ekf2" ]; then
param set SYS_MC_EST_GROUP 2
elif [ "$PX4_ESTIMATOR" = "lpe" ]; then
param set SYS_MC_EST_GROUP 1
elif [ "$PX4_ESTIMATOR" = "inav" ]; then
param set SYS_MC_EST_GROUP 0
fi
if param compare SYS_AUTOSTART $REQUESTED_AUTOSTART
elif [ "$SYS_AUTOSTART" -eq 0 ]
then
set AUTOCNF no
else
@ -106,7 +111,7 @@ param set MAV_SYS_ID $((px4_instance+1))
if [ $AUTOCNF = yes ]
then
param set SYS_AUTOSTART $REQUESTED_AUTOSTART
param set SYS_AUTOSTART $SYS_AUTOSTART
param set CAL_ACC0_ID 1310988 # 1310988: DRV_IMU_DEVTYPE_SIM, BUS: 1, ADDR: 1, TYPE: SIMULATION
param set CAL_GYRO0_ID 1310988 # 1310988: DRV_IMU_DEVTYPE_SIM, BUS: 1, ADDR: 1, TYPE: SIMULATION
@ -190,27 +195,26 @@ do
;;
esac
done
if [ ! -e "$autostart_file" ]; then
if [ -e "$autostart_file" ]
then
. "$autostart_file"
elif [ ! -e "$autostart_file" ] && [ "$SYS_AUTOSTART" -ne "0" ]
then
echo "Error: no autostart file found ($autostart_file)"
exit 1
fi
. "$autostart_file"
# Simulator IMU data provided at 250 Hz
param set IMU_INTEG_RATE 250
#user defined params for instances can be in PATH
. px4-rc.params
dataman start
# start sih in sih_sim mode, otherwise simulator module
if [ "$SIM_MODE" = "sihsim" ]; then
sih start
# only start the simulator if not in replay mode, as both control the lockstep time
elif ! replay tryapplyparams
if ! replay tryapplyparams
then
. px4-rc.simulator
. px4-rc.simulator
fi
load_mon start

View File

@ -368,7 +368,7 @@ else
# start the simulator in hardware if needed
if param compare SYS_HITL 2
then
sih start
simulator_sih start
fi
else

0
Tools/fetch_file.py Normal file → Executable file
View File

View File

@ -1,901 +0,0 @@
#! /bin/bash
# Written by Carlo Wood, September/October 2016.
function fatal
{
echo "$0: ERROR: $*"
exit 1
}
# Make sure we're not having a broken gawk.
AWK_VERSION=$(awk -V | head -n 1)
if [[ $AWK_VERSION =~ ^GNU\ Awk\ 4\.[0-9]+\.[0-9]+ ]]; then
AWK_VERSION=$(echo $AWK_VERSION | sed -e 's/GNU Awk \(4\.[0-9]*\.[0-9]*\).*/\1/')
if [[ $AWK_VERSION =~ ^4\.0*([2-9]+|1\.0*[2-9]+) ]]; then
fatal "Your version of awk ($AWK_VERSION) is broken. Please use version 4.1.1 or lower."
fi
fi
echo "AWK_VERSION=$AWK_VERSION"
# Find out what the base directory is.
BASEDIR="$(dirname $(dirname $(readlink -en "$0")))"
echo "BASEDIR=\"$BASEDIR\""
striplen=$((${#BASEDIR} + 2))
# BASEDIR may not contain a space, that's just too hard to get to work.
expr index "$BASEDIR" " " >/dev/null && fatal "it is not supported that BASEDIR contains a space."
# Make sure that worked.
test -f $BASEDIR/cmake/posix/px4_impl_posix.cmake || fatal "Failed to determine BASEDIR: '\$BASEDIR/cmake/posix/px4_impl_posix.cmake' is not a regular file."
# Parse command line parameters.
debug=0 # Set to non-zero to enable debugging.
force=0 # Set to 1 to force running of script even when there are uncommitted changes.
merge=0 # Set to 1 when merging a branch that didn't run this script into master that did already run this script.
while [[ $# -gt 0 ]]
do
case $1 in
--debug)
debug=1
;;
--force)
force=1
;;
--merge)
force=1
merge=1
fatal "--merge is not implemented yet."
;;
-*)
fatal "Unknown option $1"
;;
--|*)
break
;;
esac
shift
done
non_option_arguments=$#
if [ $non_option_arguments -eq 0 -a $debug -ne 0 ]; then
fatal "--debug screws up the source files with debug output! You must provide a single filename to run on."
fi
# Better not run this script with changes that still need to be committed.
cd "$BASEDIR" || fatal "Could not change directory to \"$BASEDIR\""
if ! git diff-index --quiet HEAD --; then
if [ $non_option_arguments -ne 0 -o $force -eq 1 ]; then
if [ $force -eq 1 ]; then
echo "Uncommitted changes, but running anyway because --force is used."
else
echo -n "WARNING: You have uncommitted changes (use --force to remove this warning). Run anyway? [y/N] "
read answer
if [ "x$answer" != "xy" -a "x$answer" != "xY" ]; then exit 0; fi
fi
else
fatal "Your working directory has uncommitted changes (see 'git status')! Bailing out."
fi
fi
# Find a reasonable tmp directory.
# First make a list of all build directories by looking for a CMakeCache.txt in them. Sort them so the most recent one is first.
CMAKECACHE_FILES=$(find "$BASEDIR" -mindepth 2 -maxdepth 2 -type f -name CMakeCache.txt -wholename "$BASEDIR/build/*/CMakeCache.txt" | xargs /bin/ls -td)
# Make a list of all candidate tmp directories.
TMPDIRS=
for f in $CMAKECACHE_FILES; do
if [ -d $(dirname $f)/tmp ]; then
TMPDIRS+=" $(dirname $f)/tmp"
fi
done
# Put BASEDIR first in case there are no build directories because /tmp is probably on a different file system.
TMPDIRS+=" $BASEDIR /tmp ."
# Pick the first one that is actually writable.
for tmp in $TMPDIRS; do
TMPDIR="$tmp"
if [ -w "$TMPDIR" ]; then
break;
fi
done
test -n "$TMPDIR" || fatal "Can not find a writable tmp directory."
echo "TMPDIR=\"$TMPDIR\""
# Make a list of all source and header files that we need to fix.
# List of directories that we don't want to touch.
EXCLUDE_FOLDERS=".git Tools"
EXCLUDE_PATTERNS="examples matlab/scripts tests test unit_test *_test *_tests test_* apps/test_* UnitTests"
# A regular expression for the exclude patterns.
EXCLUDE_PATTERNS_RE="($(echo $EXCLUDE_PATTERNS | sed -e 's/\*/[^\/]*/g;s/ /|/g'))"
# Extensions of files that we do want to change (leaving out .y and .py for now).
C_EXTENSIONS=".c .c_in .c_shipped"
H_EXTENSIONS=".h .h.in .h_template"
CXX_EXTENSIONS=".cc .cpp .cpp.in .cxx .cpp_template"
HXX_EXTENSIONS=".hh .hpp .hxx"
# The regular expression that we consider to be an #include.
INCLUDE_RE='^[[:space:]]*#[[:space:]]*include[[:space:]]*[<"]'
# Regular expression for empty lines.
EMPTY_LINE_RE='^[[:space:]]*$'
# Regular expression for one-line comments.
COMMENT_LINE_RE='^[[:space:]]*(\/\/.*|\/\*([^*]|\*+[^\/*])*\*+\/[[:space:]]*)$'
# Regular expression for a #define (on one line).
DEFINE_RE='^[[:space:]]*#[[:space:]]*define[[:space:]].*[^\\]$'
# Regular expression for an #if[[n]def].
IF_RE='^[[:space:]]*#[[:space:]]*if(n?def)?[[:space:]]'
# Regular expression for an #endif.
ENDIF_RE='^[[:space:]]*#[[:space:]]*endif($|[^[:alnum:]])'
# Regular expression for header file extension.
HEADER_RE="($(echo $H_EXTENSIONS $HXX_EXTENSIONS | sed -e 's/\./\\./g;s/ /|/g'))"
# Regular expression for C++ source and header files.
CXXSRC_RE="($(echo $CXX_EXTENSIONS $HXX_EXTENSIONS | sed -e 's/\./\\./g;s/ /|/g'))"
# List of standard C header files. Note that cfcntl, cshed and cunistd are NOT standard header files, even though they are in NuttX/nuttx/include/cxx.
REAL_STDC_HEADERS_RE='(cassert|ccomplex|cctype|cerrno|cfenv|cfloat|cinttypes|ciso646|climits|clocale|cmath|csetjmp|csignal|cstdalign|cstdarg|cstdbool|cstddef|cstdint|cstdio|cstdlib|cstring|ctgmath|ctime|cuchar|cwchar|cwctype)'
STDC_HEADERS=$(find "$BASEDIR/NuttX/nuttx/include/cxx" -mindepth 1 -maxdepth 1 -type f | xargs basename -a | grep -E "$REAL_STDC_HEADERS_RE" | xargs echo)
# Regular expression of standard C header files, but with the leading 'c' stripped.
STDC_HEADERS_RE="($(echo $STDC_HEADERS | sed -e 's/^c//;s/ c/|/g'))"
# Actual list of standard C header files.
# List of standard C++ header files.
REAL_STDCXX_HEADERS_RE='(algorithm|any|array|atomic|bitset|cassert|ccomplex|cctype|cerrno|cfenv|cfloat|chrono|cinttypes|ciso646|climits|clocale|cmath|codecvt|complex|condition_variable|csetjmp|csignal|cstdalign|cstdarg|cstdbool|cstddef|cstdint|cstdio|cstdlib|cstring|ctgmath|ctime|cuchar|cwchar|cwctype|deque|exception|execution|filesystem|forward_list|fstream|functional|future|initializer_list|iomanip|ios|iosfwd|iostream|istream|iterator|limits|list|locale|map|memory|memory_resource|mutex|new|numeric|optional|ostream|queue|random|ratio|regex|scoped_allocator|set|shared_mutex|sstream|stack|stdexcept|streambuf|string|string_view|strstream|system_error|thread|tuple|typeindex|typeinfo|type_traits|unordered_map|unordered_set|utility|valarray|variant|vector)'
STDCXX_HEADERS=$(find "$BASEDIR/NuttX/misc/uClibc++/include/uClibc++" -mindepth 1 -maxdepth 1 -type f | xargs basename -a | grep -E "$REAL_STDCXX_HEADERS_RE" | grep -E -v "$REAL_STDC_HEADERS_RE" | xargs echo)
# Regular expression of C++ header files.
STDCXX_HEADERS_RE="($(echo $STDCXX_HEADERS | sed -e 's/ /|/g'))"
# Regular expression for #pragma once.
PRAGMA_ONCE_RE='^#pragma once'
# Regular expression to recognize the start of a C-comment block.
COMMENT_BEGIN_RE='(^|[^\/])\/\*([^*]|\*+($|[^\/*]))*$'
# Regular expression to recognize the end of a C-comment block.
COMMENT_END_RE='\*\/'
# Regular expression to match C++ unsafe headers. We currently don't have any C++ unsafe headers, do we?
# v2.0/standard/mavlink.h is not unsafe, but this way the script will leave it alone and not
# move it above function declarations that need to be declared before including it.
UNSAFE_HEADERS_RE='(v2\.0\/standard\/mavlink\.h)'
#UNSAFE_HEADERS_RE='(stm32\.h|arch\/board\/board\.h)'
# Find all submodules.
test -f $BASEDIR/.gitmodules || fatal "No such file: $BASEDIR/.gitmodules"
SUBMODULES=$(grep -A 1 '^\[submodule' $BASEDIR/.gitmodules | grep '^[[:space:]]*path = ' | sed -r -e 's/^[[:space:]]*path = //' | xargs echo)
echo "SUBMODULES=\"$SUBMODULES\""
SUBMODULES_RE="($(echo $SUBMODULES | sed -e 's/ /|/g'))"
# Disable path name expansion (otherwise the find patterns will be expanded against the files in the current working directory).
set -f
EXCLUDE_ARGS=
for excl in $EXCLUDE_FOLDERS; do
if [ -z "$EXCLUDE_ARGS" ]; then
EXCLUDE_ARGS="-wholename $BASEDIR/$excl/*"
else
EXCLUDE_ARGS+=" -o -wholename $BASEDIR/$excl/*"
fi
done
for excl in $EXCLUDE_PATTERNS; do
EXCLUDE_ARGS+=" -o -wholename */$excl/*"
done
INCLUDE_H_ARGS=
for ext in $H_EXTENSIONS $HXX_EXTENSIONS; do
if [ -z "$INCLUDE_H_ARGS" ]; then
INCLUDE_H_ARGS="-name *$ext"
else
INCLUDE_H_ARGS+=" -o -name *$ext"
fi
done
INCLUDE_C_ARGS=
for ext in $C_EXTENSIONS $CXX_EXTENSIONS; do
if [ -z "$INCLUDE_C_ARGS" ]; then
INCLUDE_C_ARGS="-name *$ext"
else
INCLUDE_C_ARGS+=" -o -name *$ext"
fi
done
# Also exclude all submodules -- because we don't maintain those (are we?).
for subm in $SUBMODULES; do
if [ -z "$SUBMODULES_ARGS" ]; then
SUBMODULES_ARGS="-wholename $BASEDIR/$subm/*"
else
SUBMODULES_ARGS+=" -o -wholename $BASEDIR/$subm/*"
fi
done
echo -n "Finding all source files with #include's (excluding submodules and build directory)... "
find $BASEDIR -mindepth 2 -type f ! \( -wholename $BASEDIR/build/* -o $EXCLUDE_ARGS -o $SUBMODULES_ARGS \) \( $INCLUDE_C_ARGS -o $INCLUDE_H_ARGS \) > $TMPDIR/fix_headers_sources
cat "$TMPDIR/fix_headers_sources" | xargs grep -l "$INCLUDE_RE" > $TMPDIR/fix_headers_sources_with_includes
echo "done"
number_of_files=$(sed -n '$=' "$TMPDIR/fix_headers_sources_with_includes")
count=0
echo -n "Finding all submodule header files (excluding stdc++ headers)... "
find $BASEDIR -type f ! \( $EXCLUDE_ARGS \) \( $SUBMODULES_ARGS \) \( $INCLUDE_H_ARGS \) > $TMPDIR/fix_headers_SUBMODULE_HEADERS
echo "done"
echo -n "Finding all header files (excluding stdc++ headers)... "
find $BASEDIR -type f ! \( $EXCLUDE_ARGS \) -wholename $BASEDIR/build/* \( $INCLUDE_H_ARGS \) > $TMPDIR/fix_headers_HEADERS
grep -E "$HEADER_RE" $TMPDIR/fix_headers_sources >> $TMPDIR/fix_headers_HEADERS
cat $TMPDIR/fix_headers_SUBMODULE_HEADERS >> $TMPDIR/fix_headers_HEADERS
echo "done"
echo -n "Finding all include paths... "
for f in `cat $TMPDIR/fix_headers_sources_with_includes`; do grep -E "$INCLUDE_RE" $f | sed -r -e "s%$INCLUDE_RE%%"';s/[">].*//'; done | sort -u | grep -E -v "(/|^)$EXCLUDE_PATTERNS_RE/" > $TMPDIR/fix_headers_include_paths
echo "done"
function include_path()
{
# If the include path starts with a '.', then it is a local header.
if [[ $1 =~ ^\. ]]; then return 1; fi
# If the include path starts with 'platforms/' then it is a local header;
# added this exception here because not everyone has all build_ directories for all targets installed.
if [[ $1 =~ platforms/ ]]; then return 1; fi
# apps.h is generated from apps.h.in.
if [ $1 = "apps.h" ]; then return 1; fi
# Treat the following headers from src/platforms/*/include as system header because they replace what is found in nuttx (for posix and qurt).
if [ $1 = "arch/board/board.h" -o $1 = "crc32.h" -o $1 = "i2c.h" -o $1 = "queue.h" -o $1 = "poll.h" -o $1 = "sys/ioctl.h" ]; then return 2; fi
# Escape the path for reg.exp. matching.
PATH_RE=$(echo $1 | sed -e 's/\([+.]\)/\\\1/')
issubmodule=0;
islocal=0;
foo=0
for includedir in $(grep "/$PATH_RE\$" $TMPDIR/fix_headers_HEADERS | cut -c $striplen-); do
# If the include directory is NuttX header that was copied to the build directory, then it's still a system file.
if [[ $includedir/ =~ ^build/.*/NuttX/ ]]; then
issubmodule=1
# If the include directory is a submodule, then treat it as a system file.
elif [[ $includedir/ =~ ^$SUBMODULES_RE/ ]]; then
issubmodule=1;
else
islocal=1
fi
done
if [ $islocal -eq 0 ]; then
if [ $issubmodule -eq 0 ]; then
# If an include path can't be found then usually it will be a real system header,
# however, there are a few (ros related?) files that start with px4... In that
# case just leave the quotes alone ("px4muorb.h" and several <px4/...>).
if [[ $1 =~ ^px4 ]]; then return 0; fi
# While if the include path starts with uORB/topics or topics, and it isn't found,
# then likely we just don't have a build directory. These should be local though.
# Same for the generated files mixer_multirotor.generated.h and build_git_version.h.
if [[ $1 =~ ((/|^)topics/|mixer_multirotor\.generated\.h|build_git_version\.h) ]]; then return 1; fi
fi
return 2;
fi # Submodule or system header.
if [ $issubmodule -eq 0 ]; then return 1; fi # Local.
# Files that are both local and submodule are simply left alone.
# These are (at this moment): "battery.h" "common.h" "Matrix.hpp" "mavlink.h" "protocol.h" "pwm.h" "spi.h" "Vector.hpp".
return 0;
}
# Run the include_path function for each of the files in $TMPDIR/fix_headers_include_paths
echo -n "Determining which headers need to be included with double quotes... "
echo -n > $TMPDIR/fix_headers_quotes
for arg in $(cat "$TMPDIR/fix_headers_include_paths"); do
include_path $arg
localsystem=$?
if [ $localsystem -eq 1 ]; then
echo "$arg \"$arg\"" >> $TMPDIR/fix_headers_quotes
elif [ $localsystem -eq 2 ]; then
echo "$arg <$arg>" >> $TMPDIR/fix_headers_quotes
fi
done
echo "done"
# Truncate the error log.
echo -n > $TMPDIR/fix_headers_ERROR.log
function print_error
{
echo
echo -n " ";
echo "*** $1" | tee -a "$TMPDIR/fix_headers_ERROR.log"
return 1
}
if [ $debug -ne 0 ]; then
# Debug Line.
DL='if (cdbl != NR) { printf "\n%u. \"%s\"", NR, $0; cdbl = NR }'
# Debug Begin.
DB='if (cdbl != NR) { printf "\n%u. \"%s\" ---> ", NR, $0; cdbl = NR } else printf "; "; printf'
# Debug End.
DE=''
else
DL='#'
DB='#'
DE=''
fi
# Error Prefix.
EP='###'
# The main function that is called for each source file.
function fixup_header
{
count=$((count + 1))
echo -n "[$((100 * count / number_of_files))%] Fixing headers of $1... "
# Is this a header?
echo "$1" | sed -e 's/\.in$/;in/;s/.*\././;s/;in$/.in/' | grep -v -E "$HEADER_RE\$" >/dev/null; is_header=$?
if [ $debug -ne 0 ]; then echo "is_header = \"$is_header\""; fi
# Is this C++ source?
echo "$1" | sed -e 's/.*\././' | grep -v -E $CXXSRC_RE >/dev/null; is_cxxsrc=$?
if [ $debug -ne 0 ]; then echo "is_cxxsrc = \"$is_cxxsrc\""; fi
dont_make_cxxsrc=1
if [ $is_cxxsrc -eq 0 -a $is_header -ne 0 ]; then
grep -m 1 -q -E "^[[:space:]]*(#[[:space:]]*include[[:space:]]*<$STDCXX_HEADERS_RE>|(template|namespace|class)(\$|[^[:alnum:]_]))" "$1"
dont_make_cxxsrc=$?
fi
if [ $dont_make_cxxsrc -eq 0 ]; then
is_cxxsrc=1
fi
# Current directory.
curdir=$(dirname "$BASEDIR/$1")
# Parse the file.
#
# Returns an array of line[]'s. The first line is either the first #include, when it is outside
# any #if*...#endif constructs not counting the header guard if the file is a header. For example:
#
# // Anything here except #include lines.
# #include <first_include.h> // <-- first line.
#
# Or, the first #if* that contains the first #include line. For example:
# // Anything here except #include lines.
# #ifndef FOO_H // header guard.
# #define FOO_H
# int global = 1; // Anything unknown.
# #ifdef SOMETHING // <-- first line.
# #if maybe_more
# // anything except #include lines.
# #else
# // anything except #include lines.
# #include <first_include.h>
#
# Subsequent line[]'s mark the beginning of a new block, where we have the following blocks:
# type[] Description
type_include=0 # An #include, outside #if*...#endif constructs except a possible header guard.
type_ifincludeendif=1 # #if*...#endif constructs with #include's.
type_ifendif=2 # #if*...#endif constructs without #include's.
type_decls=3 # __BEGIN_DECLS ... __END_DECLS block.
type_macro=4 # Contiguous #define block.
type_comment=5 #(Multi-line) comments.
type_emptyline=6 # Empty lines.
type_pragmaonce=7 # #pragma once (must be outside any #if*...#endif constructs).
type_end=8 # The first line of the remainder of the file.
#
# However, any block NOT containing one or more #include's (all types > 1) will
# cause subsequent blocks that do not contain #include's to be ignored,
# with as result that those blocks will be treated as contiguous code blocks.
# A comment that is followed by a type that is not to be ignored as such
# is given the type that follows (which itself is then ignored).
# Empty lines are ignored unless they appear directly in front of a type
# that is not to be ignored according to the above rules, where 'previous
# types' then are the types before the empty line.
#
# For example:
#
# > #include <first_header.h> # type_include
# > #include <second_header.h> # type_include
# > # type_emptyline
# > #include <third_header.h> # type_include
# ^ #ifdef FOO # type_ifendif
# | #define BAR 1
# | #endif # (detected here)
# | <-- ignored because:
# v #define BAZ(x) x // Do baz <-- ignored (prev and this type in {type_ifendif, type_macro})
# > # type_emptyline
# ^ // This include is important: # type_comment, but then replaced by type_ifincludeendif
# | <-- ignored because:
# | // more here. <-- ignored same type
# | #ifdef BAR <-- "ignored": type_ifincludeendif, but put 3 lines higher.
# | #include <bar.h>
# v #endif # (detected here)
# > # type_emptyline
# > #include <another.h> # type_include
#
# This script stops parsing at the first not recognized line outside #if*...#endif constructs
# unless no first line was found yet. It does not attempt overly hard to decode rare constructs,
# most notably anything with a leading C comment is not recognized and will thus lead to an abort.
# For example the following lines are not recognized:
#
# /* Some comment */ #include <header.h>
# /* Some comment */ // Another comment.
#
# Lines that have a trailing comment are recognized (by ignoring the comment).
result=$(awk "\
function add(l, t) {
# First add always succeeds.
if (ptr > 0) {
# An empty line is always added, at first, unless the immediate preceding type is an empty line.
if (t == $type_emptyline && type[ptr - 1] == $type_emptyline) {
return; $DB \"ignored because line %d is also empty.\", line[ptr - 1] $DE
}
# A comment is always, added at first, unless the preceding non-empty line type is a comment.
# Same for #include's.
if (t == $type_comment && last_none_type == t) {
$DB \"ignoring because same type as last_none_type (%s)\", type_name[t] $DE
# Gobble up preceding empty lines.
if (type[ptr - 1] == $type_emptyline) {
--ptr; $DB \"ptr = %d; Removed type_emptyline @ line %d\", ptr, line[ptr] $DE
}
return;
}
# {ifendif, macro}'s are collapsed too.
if ((t == $type_ifendif || t == $type_macro) && (last_nonws_type == $type_ifendif || last_nonws_type == $type_macro)) {
# Gobble up preceding comments and empty lines.
while (ptr > 0 && (type[ptr - 1] == $type_emptyline || type[ptr - 1] == $type_comment)) {
--ptr; $DB \"ptr = %d; Removed %s @ line %d\", ptr, type_name[type[ptr]], line[ptr] $DE
}
# ptr > 0 here because the first add is never for an empty line or comment.
last_none_type = type[ptr - 1]; $DB \"last_none_type = %s\", type_name[last_none_type] $DE
return;
}
# type_include and type_pragmaonce and higher are always added.
}
if (t == $type_end) {
# Remove drag.
while(ptr > 0 && line[ptr - 1] >= l) --ptr;
}
# If this type is not an empty line and it was preceded by a comment, then melt it together with that comment.
else if (t != $type_emptyline && last_none_type == $type_comment) {
# In this case t cannot be type_comment.
# Gobble up preceding empty lines.
if (type[ptr - 1] == $type_emptyline) {
--ptr; $DB \"ptr = %d; Removed type_emptyline @ line %d\", ptr, line[ptr] $DE
}
# And replace the comment type.
--ptr; $DB \"ptr = %d; replacing the %s @ line %d\", ptr, type_name[type[ptr]], line[ptr] $DE
l = line[ptr];
}
line[ptr] = l; $DB \"ptr = %d; %s @ line %d\", ptr, type_name[t], l $DE;
type[ptr++] = t;
if (t != $type_emptyline) {
last_none_type = t; $DB \"last_none_type = %s\", type_name[last_none_type] $DE
if (t != $type_comment)
last_nonws_type = t;
}
}
BEGIN {
debug = $debug; # 0: no debug output; non-zero: print debug output.
header = $is_header; # 0: do not look for a header guard; 1: treat first #ifndef as header guard.
in_if = 0; # The number of nested levels inside #if, #ifdef or #ifndef ... #endif constructs.
in_if_base = 0; # 0: no header guard was found (or #pragma once); 1: an #ifndef header guard was found.
in_decl = 0; # 0: not inside a __BEGIN_DECLS ... __END_DECLS block; 1: inside such a block.
found_guard = 0; # 0: no header guard was found; 1: a header guard was found (including #pragma once).
base_if = 0; # The current base-level #if that we are scanning.
drag = 0; # The number of lines since the last certainly relevant line (a base-level #include or a base-level #endif containing one of more #includes).
skipped = 0; # 0: No #include was encountered in the current (base-level) #if block; 1: one or more #include's encountered in the current base-level #if block.
in_comment = 0; # 0: not in a multi-line C comment; 1: in a multi-line C comment.
cdbl = 0; # Current debug line.
error = 0; # 0: no error occured; 1: an error occured.
ptr = 0; # Current pointer into line[] and type[].
found_comment_end = 0; # The last line (possibly the current line) that is/was a multi-line C comment termination.
last_none_type = -1; # The last non-emptyline type that was added.
last_nonws_type = -1; # The last non-whitespace type that was added.
# For debug purposes:
type_name[$type_ifendif] = \"type_ifendif\";
type_name[$type_ifincludeendif] = \"type_ifincludeendif\";
type_name[$type_decls] = \"type_decls\";
type_name[$type_comment] = \"type_comment\";
type_name[$type_emptyline] = \"type_emptyline\";
type_name[$type_include] = \"type_include\";
type_name[$type_macro] = \"type_macro\";
type_name[$type_pragmaonce] = \"type_pragmaonce\";
type_name[$type_end] = \"type_end\";
}
END {
last_line = NR - drag;
add(last_line + 1, $type_end); $DB \"\n\" $DE;
# Print output.
if (error || ptr == 0 || last_line < line[0]) {
print \"error=1\";
exit
}
printf \"lines=\\\"\";
for (i = 0; i < ptr - 1; ++i)
printf \"%d \", line[i];
printf \"%d\\\"; \", line[ptr - 1];
printf \"types=\\\"\";
for (i = 0; i < ptr - 1; ++i)
printf \"%d \", type[i];
printf \"%d\\\"; \", type[ptr - 1];
print \"error=0; first_line=\" line[0] \"; last_line=\" last_line
}
#======================================================================================================
# Handle multi-line C comments.
/$COMMENT_END_RE/ {
if (in_comment) {
in_comment = 0; $DB \"comment end\" $DE;
found_comment_end = NR;
sub(/^([^*]|\*+[^*\/])*\*+\//, \"\") # Remove the tail of the comment.
}
# FALL-THROUGH
}
{
if (in_comment) {
++drag; $DB \"in comment; drag = %d\", drag $DE;
next
}
found_comment_begin = 0;
# FALL-THROUGH
}
/$COMMENT_BEGIN_RE/ {
in_comment = 1; $DB \"comment begin\" $DE;
found_comment_begin = 1;
sub(/\/\*([^*]|\*+($|[^*\/]))*$/, \"\") # Remove the head of the comment so that we'll recognize this as an empty line if it is.
# FALL-THROUGH
}
#======================================================================================================
# Detect and handle header guard.
/$PRAGMA_ONCE_RE/ {
++drag; $DB \"drag = %d\", drag $DE;
if (header && found_guard == 0 && in_if == 0) {
found_guard = NR; $DB \"found_guard = %d\", found_guard $DE;
if (ptr > 0)
add(NR, $type_pragmaonce)
next
}
print \"\\n$EP $1:\" NR \": unexpected #pragma once\";
error = 1;
exit
}
/^#ifndef / {
if (ptr == 0 && header && found_guard == 0 && in_if == 0) {
found_guard = NR; $DB \"found_guard = %d\", found_guard $DE;
in_if = 1; $DB \"in_if = %d\", in_if $DE;
in_if_base = 1; $DB \"in_if_base = %d\", in_if_base $DE;
next
}
# FALL-THROUGH
}
#======================================================================================================
# Detect and handle __BEGIN_DECLS ... __END_DECLS blocks.
/^[[:space:]]*__BEGIN_DECLS/ {
++drag; $DB \"drag = %d\", drag $DE;
if (in_decl == 0) {
in_decl = 1; $DB \"in_decl = 1\" $DE
add(NR, $type_decls);
next
}
print \"\\n$EP $1:\" NR \": Nested __BEGIN_DECLS!\";
error = 1;
exit
}
/^[[:space:]]*__END_DECLS/ {
++drag; $DB \"drag = %d\", drag $DE;
if (in_decl == 1) {
in_decl = 0; $DB \"in_decl = 0\" $DE
if (skipped) {
drag = 0;
} else if (ptr == 1) {
ptr = 0; $DB \"erase DECLS block\" $DE
last_none_type = -1;
}
next
}
print \"\\n$EP $1:\" NR \": __END_DECLS without matching __BEGIN_DECLS!\";
error = 1;
exit
}
#======================================================================================================
# Detect and handle #if ... #endif blocks.
/$IF_RE/ {
++drag; $DB \"drag = %d\", drag $DE;
if (in_if == in_if_base && in_decl == 0) {
skipped = 0; $DB \"skipped = 0\" $DE;
base_if = NR; $DB \"base_if = %d\", NR $DE;
}
++in_if; $DB \"in_if = %d\", in_if $DE;
next
}
/$ENDIF_RE/ {
--in_if; $DB \"in_if = %d\", in_if $DE;
if (in_if < 0) {
print \"\\n$EP $1:\" NR \": #endif without matching #if!\";
error = 1;
exit
}
++drag;
if (in_if == in_if_base && in_decl == 0) {
if (skipped) {
drag = 0;
add(base_if, $type_ifincludeendif);
} else if (ptr > 0)
add(base_if, $type_ifendif);
} $DB \"drag = %d\", drag $DE;
# Left header guard?
if (in_if < in_if_base) { $DB \"left header guard:\" $DE;
# assert(in_if == 0 && in_if_base == 1 && header && found_guard)
exit
}
next
}
#======================================================================================================
# Handle #include lines.
/$INCLUDE_RE/ {
if (!/\"(\.\/)?mavlink_msg/) {
# If we're inside a __BEGIN_DECLS ... __END_DECLS block then only certain headers may be included.
hname = gensub(/^[[:space:]]*#[[:space:]]*include[[:space:]]*[<\"]([^>\"]*)[>\"].*/, \"\\\1\", \"1\");
cpp_safe = !(hname ~ /$UNSAFE_HEADERS_RE/);
$DB \"hname = \\\"\" hname \"\\\"; cpp_safe = \" cpp_safe \"; in_decl = \" in_decl \"; is_cxxsrc = $is_cxxsrc\" $DE
if (in_decl && cpp_safe) {
print \"\\n$EP $1:\" NR \": including \" hname \" inside a __BEGIN_DECLS ... __END_DECLS block.\";
error = 1;
exit
} else if (!in_decl && !cpp_safe && $is_cxxsrc) {
print \"\\n$EP $1:\" NR \": including \" hname \" outside a __BEGIN_DECLS ... __END_DECLS block!\";
error = 1;
exit
}
if (in_if > in_if_base || in_decl) {
skipped = 1; $DB \"skipped = 1\" $DE;
} else {
drag = 0; $DB \"drag = 0\" $DE;
add(NR, $type_include); $DB \"first_line = %d\", NR $DE;
}
next
}
}
#======================================================================================================
# Ignore #define's, empty lines and lines with just comments.
/$DEFINE_RE/ {
++drag; $DB \"drag = %d\", drag $DE;
if (ptr > 0 && in_if == in_if_base && in_decl == 0) {
add(NR, $type_macro);
}
next
}
/$EMPTY_LINE_RE/ {
++drag; $DB \"drag = %d\", drag $DE;
if (ptr > 0 && in_if == in_if_base && in_decl == 0) {
if (found_comment_begin)
add(NR, $type_comment);
else if (found_comment_end != NR)
add(NR, $type_emptyline);
}
next
}
/$COMMENT_LINE_RE/ {
++drag; $DB \"drag = %d\", drag $DE;
if (ptr > 0 && in_if == in_if_base && in_decl == 0 && type[ptr - 1] != $type_comment) {
add(NR, $type_comment);
}
next
}
#======================================================================================================
# Handle everything else (unrecognized lines).
{
++drag; $DB \"unknown; drag = %d\", drag $DE;
if (ptr > 0 && in_if <= in_if_base && in_decl == 0) {
exit
}
}
" "$BASEDIR/$1")
# Decode the result.
vars=$(echo "$result" | tail -n 1)
error_msg=$(echo "$result" | grep "^$EP " | sed -e 's/^....//')
if [ $debug -ne 0 ]; then
len=$(echo "$result" | wc --lines)
echo "$result" | head -n $((len - 1)) | grep -v "^$EP " # Debug messages
echo "vars: $vars"
fi
# Evaluate the last line printed in END.
error=1; eval $vars
test -z "$error_msg" || print_error "$error_msg" || return
test $error -eq 0 -a $first_line -gt 0 || print_error "FAILED to find an #include in $1?!" || return
test $last_line -ge $first_line || print_error "FAILED to find a sensible last line in $1?!" || return
# Calculate the number of lines starting from the current line.
# Use sed to count lines, because wc --lines doesn't report the last line when that doesn't end on a new-line, contrary to the fact that tail treats such lines as lines.
total_lines=$(sed -n '$=' "$BASEDIR/$1")
if [ $debug -ne 0 ]; then echo "total_lines = \"$total_lines\""; fi
# Edit the first_line...last_line block.
# Header files are ordered as follows (lowest value first):
cat_winsock=0; # Winsock2.h
cat_posix_sys=1; # posix_sys.h or one of the px4_ headers that include it.
cat_px4=2; # Other px4_*.h
cat_local=3; # "*.h"
cat_cxx=4; # <std c++ header>, ie <iostream>
cat_c=5; # <c std c++ header>, ie <cstdio>
cat_system=6; # <*.h>
head -n $last_line "$BASEDIR/$1" | tail -n $((last_line - first_line + 1)) | awk "
function sort_by_type_line_header_type_hname(blk2, v2, blk1, v1) {
# Return true if blk1 comes before blk2.
# Move type_include before the rest. Keep the same line order for the rest.
return (type[blk2] != $type_include && (type[blk1] == $type_include || line[blk1] < line[blk2])) ||
(type[blk2] == $type_include && type[blk1] == $type_include &&
# If both are include's then put include with a lower header_type first; sort alphabetically for the same header type.
(header_type[blk1] < header_type[blk2] || (header_type[blk1] == header_type[blk2] && hname[blk1] < hname[blk2])));
}
BEGIN {
first_line = $first_line;
split(\"$lines\", line);
split(\"$types\", type);
i = 0;
do {
line[++i] -= first_line - 1;
} while(type[i] != $type_end)
for(b = 0; b < i; ++b) header_type[b] = 100;
blk = 1;
n = 0;
is_cxxsrc = $is_cxxsrc;
# px4_posix.h includes px4_defines.h includes px4_log.h includes posix_sys.h which must be the first header included.
sys_val[\"px4_posix.h\"] = 1;
sys_val[\"px4_defines.h\"] = 2;
sys_val[\"px4_log.h\"] = 3;
sys_val[\"posix_sys.h\"] = 4;
saw_sys_val = 5; # Didn't see any of the above; otherwise the lowest value of the header seen.
for(b = 0; b < i; ++b) saw_sys[b] = saw_sys_val;
}
END {
l = asorti(txt, k, \"sort_by_type_line_header_type_hname\");
for (b = 1; b <= l; ++b) {
if (type[k[b]] == $type_include && header_type[k[b]] == $cat_posix_sys && saw_sys[k[b]] > saw_sys_val) continue;
len = length(txt[k[b]]);
for (n = 0; n < len; ++n) print txt[k[b]][n];
if (b < l && type[k[b]] == $type_include && type[k[b+1]] != $type_emptyline &&
(type[k[b+1]] != $type_include || (header_type[k[b]] != header_type[k[b+1]] && header_type[k[b+1]] != $cat_px4))) {
printf \"\n\";
}
}
}
{
if (NR == line[blk + 1]) {
++blk;
n = 0;
}
}
/$INCLUDE_RE/ {
# Don't use double quotes around standard header names.
\$0 = gensub(/^([[:space:]]*#[[:space:]]*include[[:space:]]*)\\\"$STDC_HEADERS_RE\\.h\\\"/, \"\\\1<\\\2.h>\", \"1\");
if (is_cxxsrc) {
\$0 = gensub(/^([[:space:]]*#[[:space:]]*include[[:space:]]*)\\\"$STDCXX_HEADERS_RE\\\"/, \"\\\1<\\\2>\", \"1\");
# Change deprecated C header names to standard C++ header names in C++ source files.
\$0 = gensub(/^([[:space:]]*#[[:space:]]*include[[:space:]]*<)$STDC_HEADERS_RE\\.h>/, \"\\\1c\\\2>\", \"1\");
}
# Don't include \"./foo.h\", that is implied, so just include \"foo.h\".
\$0 = gensub(/^([[:space:]]*#[[:space:]]*include[[:space:]]*\\\")\.\//, \"\\\1\", \"1\");
# Extract the header filename.
hname[blk] = gensub(/^[[:space:]]*#[[:space:]]*include[[:space:]]*[<\"]([^>\"]*)[>\"].*/, \"\\\1\", \"1\");
# If the header exists in the directory of the including file, then it is a local header.
command = sprintf(\"test -e %s/%s\", \"$curdir\", hname[blk]);
if (system(command) == 0) {
\$0 = gensub(/^([[:space:]]*#[[:space:]]*include[[:space:]]*)[\"<]([^\">]*)[\">]/, \"\\\1\\\"\\\2\\\"\", \"1\");
} else {
# Do we know if this is a local file, or a submodule / system header?
# The grep reg.exp needs \\ (for backslah) and \1 for back reference, thus: \\\1.
# However we print the grep command using sprintf, so each backslash needs to be escaped once more: \\\\\\1.
# Finally, this is a bash string and we need to escape each backslash once more to pass it corrently to awk, hence we need twelve backslahes:
command = sprintf(\"grep '^%s ' '%s' 2>/dev/null\", gensub(/([.+])/, \"\\\\\\\\\\\\1\", \"g\", hname[blk]), \"$TMPDIR/fix_headers_quotes\");
ret = command | getline result;
if (ret != 0) {
result = substr(result, index(result, \" \") + 1);
\$0 = gensub(/^([[:space:]]*#[[:space:]]*include[[:space:]]*)[\"<][^\">]*[\">]/, \"\\\1\" result, \"1\");
}
}
# Categorise the header.
if (hname[blk] == \"Winsock2.h\") {
if (header_type[blk] > $cat_winsock)
header_type[blk] = $cat_winsock;
}
else if (hname[blk] in sys_val) {
if (header_type[blk] > $cat_posix_sys)
header_type[blk] = $cat_posix_sys;
# posix_sys.h is sometimes included within #ifdef __PX4_POSIX ... #endif. The other headers should not be conditional.
if ((hname[blk] == \"posix_sys.h\" || type[blk] == $type_include)) {
type[blk] = $type_include; # Treat #ifdef __PX4_POSIX #include \"posix_sys.h\" #endif as an include for sorting purposes.
saw_sys[blk] = sys_val[hname[blk]]; # There will be only one include (header name) for this block.
if (sys_val[hname[blk]] < saw_sys_val)
saw_sys_val = sys_val[hname[blk]];
}
# Use double quotes for these headers.
\$0 = gensub(/<([[:alnum:]_\/.]*)>/, \"\\\"\\\1\\\"\", \"1\");
}
else if (hname[blk] ~ /^(platforms\/px4_|px4_)/) {
if (header_type[blk] > $cat_px4)
header_type[blk] = $cat_px4;
# Use double quotes for these headers.
\$0 = gensub(/<([[:alnum:]_\/.]*)>/, \"\\\"\\\1\\\"\", \"1\");
}
else if (\$0 ~ /^[[:space:]]*#[[:space:]]*include[[:space:]]*\"/) {
if (header_type[blk] > $cat_local)
header_type[blk] = $cat_local;
}
else if (hname[blk] ~ /^$STDCXX_HEADERS_RE\$/) {
if (header_type[blk] > $cat_cxx)
header_type[blk] = $cat_cxx;
}
else if (hname[blk] ~ /^c$STDC_HEADERS_RE\$/) {
if (header_type[blk] > $cat_c)
header_type[blk] = $cat_c;
}
else if (hname[blk] ~ /^$STDC_HEADERS_RE\.h\$/) {
if (header_type[blk] > $cat_system)
header_type[blk] = $cat_system;
}
}
{
# Remove empty lines before #include's.
if (type[blk] == $type_include) {
for (i = 1; blk > i && type[blk - i] == $type_emptyline; ++i)
delete txt[blk - i]
}
txt[blk][n++] = \$0;
}
" > $TMPDIR/fix_headers_current_block
# Construct a new file in TMPDIR.
head -n $((first_line - 1)) "$BASEDIR/$1" > $TMPDIR/fix_headers_current_file
# Append the editted block.
cat $TMPDIR/fix_headers_current_block >> $TMPDIR/fix_headers_current_file
# Append the rest.
tail -n $((total_lines - last_line)) "$BASEDIR/$1" >> $TMPDIR/fix_headers_current_file
# Compare original with result.
if cmp --quiet "$BASEDIR/$1" $TMPDIR/fix_headers_current_file; then
echo "No change"
else
echo "Fixed lines $first_line-$last_line"
mv $TMPDIR/fix_headers_current_file "$BASEDIR/$1" || fatal "Failed to move $TMPDIR/fix_headers_current_file to $BASEDIR/$1 !?!"
fi
}
if [ $non_option_arguments -ne 0 ]; then
fixup_header $1
exit
fi
# Run the fixup function for each of the files in $TMPDIR/fix_headers_sources_with_includes.
# Strip BASEDIR because we don't know how long that is and it might too much for bash.
for arg in $(cat "$TMPDIR/fix_headers_sources_with_includes" | cut -c $striplen-); do
fixup_header $arg
done
# Clean up.
if [ $debug -eq 0 -o $# -eq 0 ]; then
rm "$TMPDIR/fix_headers_sources" "$TMPDIR/fix_headers_sources_with_includes" "$TMPDIR/fix_headers_SUBMODULE_HEADERS" "$TMPDIR/fix_headers_HEADERS" \
"$TMPDIR/fix_headers_include_paths" "$TMPDIR/fix_headers_quotes" "$TMPDIR/fix_headers_current_block"
fi
# Print all error messages again at the end.
if [ -s "$TMPDIR/fix_headers_ERROR.log" ]; then
echo "$0 finished with errors:"
cat "$TMPDIR/fix_headers_ERROR.log"
else
echo "SUCCESS"
rm "$TMPDIR/fix_headers_ERROR.log"
fi

0
Tools/geotag_images_ulog.py Normal file → Executable file
View File

View File

@ -1,200 +0,0 @@
#!/bin/bash
#Author: Benjamin Perseghetti
#Email: bperseghetti@rudislabs.com
# This script unifies running gazebo simulation for HITL and SITL
# You can run multiple instances of the 'px4' binary, with the gazebo SITL simulation
# This script assumes px4 is already built, with 'make px4_sitl_default gazebo'
# You can also run HITL with -h flag
# Generate world and/or model files with editable json -j [m (model), w (world), mw (model and world), or wm (world and model)]
# The simulator in SITL is expected to send to TCP port 4560+i for i in [0, N-1]
# For example gazebo can be run like this for multiple SITL:
# ./Tools/gz_sim.sh -n 10 -m iris
# Or gazebo can be run like this for HITL:
# ./Tools/gz_sim.sh -h 1 -m standard_vtol
function cleanup() {
echo "running the cleanup"
pkill -x px4
pkill gazebo
pkill gzclient
pkill gzserver
}
trap "cleanup" INT SIGINT SIGTERM EXIT
function spawn_model() {
MODEL=$1
N=$2 #Instance Number
WORLD_FILE=$3
MJ=$4
SITL_MODEL_NAME="${MODEL}_${N}"
sitl_path=${SCRIPT_DIR}/sitl_gazebo
jinja_model_script=${sitl_path}/scripts/jinja_model_gen.py
base_model="--base_model ${MODEL}"
model_json="--json_gen ${MJ}"
if [ $hitl == true ]; then
python3 ${src_path}/Tools/boot_now.py "/dev/ttyACM0"
hil_mode="--hil_mode 1"
model_name="--model_name ${MODEL}"
hitl_launch_command="${model_json} ${base_model} ${hil_mode} ${model_name}"
echo "Generating: ${jinja_model_script} ${hitl_launch_command}"
python3 ${jinja_model_script} ${hitl_launch_command}
sleep 1
source ${src_path}/Tools/setup_gazebo.bash ${src_path} ${src_path}/build/${target}
sleep 2
gazebo ${sitl_path}/worlds/temp_${WORLD_FILE}.world --verbose
else
mavlink_tcp="--mavlink_tcp_port $((4560+${N}))"
mavlink_udp="--mavlink_udp_port $((14560+${N}))"
model_name="--model_name ${SITL_MODEL_NAME}"
output_path="--output_path /tmp"
working_dir="$build_path/instance_$n"
sitl_launch_command="${model_json} ${base_model} ${mavlink_tcp} ${mavlink_udp} ${model_name} ${output_path}"
[ ! -d "$working_dir" ] && mkdir -p "$working_dir"
pushd "$working_dir" &>/dev/null
echo "starting instance $N in $(pwd)"
../bin/px4 -i $N -d "$build_path/etc" -w sitl_${SITL_MODEL_NAME} -s etc/init.d-posix/rcS >out.log 2>err.log &
python3 ${jinja_model_script} ${sitl_launch_command}
echo "Generating: ${jinja_model_script} ${sitl_launch_command}"
echo "Spawning ${SITL_MODEL_NAME}"
gz model --spawn-file=/tmp/${SITL_MODEL_NAME}.sdf --model-name=${SITL_MODEL_NAME} -x 0.0 -y $((3*${N})) -z 0.2
popd &>/dev/null
fi
}
if [ "$1" == "--help" ]; then
echo "Usage: $0 [-n <num_vehicles>] [-m <vehicle_model>] [-h <run_hitl>] [-w <world>] [-s <script>] [-t <num_threads>] [-j <json_params>]"
echo "-s flag is used to script spawning vehicles e.g. $0 -s iris:3,plane:2"
echo "-h flag is used to launch a single vehicle in HITL mode"
echo "-t flag is used to set the number of ODE threads for the world"
echo "-j flag is used to enable json parameters from gen_params.json for the world (w), model (m), or both (wm or mw)"
exit 1
fi
while getopts n:m:h:w:s:t:j:p option
do
case "${option}"
in
n) NUM_VEHICLES=${OPTARG};;
m) VEHICLE_MODEL=${OPTARG};;
h) HITL=${OPTARG};;
w) WORLD=${OPTARG};;
s) SCRIPT=${OPTARG};;
t) THREADS=${OPTARG};;
j) JSON=${OPTARG};;
p) TARGET=${OPTARG};;
esac
done
num_vehicles=${NUM_VEHICLES:=1}
world=${WORLD:=empty}
hitl=${HITL:=false}
threads=${THREADS:=1}
json_opts=${JSON:=0}
target=${TARGET:=px4_sitl_default}
system_threads=`grep -Pc '^processor\t' /proc/cpuinfo`
echo "Number of requested ODE threads: $((threads))"
echo "Max number of possilbe threads: $((system_threads))"
if [ $((threads)) -gt $((system_threads)) ]; then
threads=$system_threads
echo "Requested ODE thread count too high, set to system max of $threads threads."
elif [ $(( ${threads} )) -lt 1 ]; then
threads=1
echo "Requested ODE thread count too low, set to $threads thread."
else
echo "Using $threads threads for ODE."
fi
if [ "$json_opts" == "mw" ] || [ "$json_opts" == "wm" ]; then
echo "JSON used for both world and model generation"
wjson="1"
mjson="1"
elif [ "$json_opts" == "w" ]; then
echo "JSON used for world generation"
wjson="1"
mjson="0"
elif [ "$json_opts" == "m" ]; then
echo "JSON used for model generation"
mjson="1"
wjson="0"
else
wjson="0"
mjson="0"
fi
if [ "$hitl" == "True" ] || [ "$hitl" == "1" ] || [ "$hitl" == "true" ]; then
hitl=true
else
hitl=false
fi
export PX4_SIM_MODEL=${VEHICLE_MODEL:=iris}
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
src_path="$SCRIPT_DIR/.."
echo ${SCRIPT}
build_path=${src_path}/build/${target}
source ${src_path}/Tools/setup_gazebo.bash ${src_path} ${src_path}/build/${target}
sleep 1
sitl_path=${SCRIPT_DIR}/sitl_gazebo
world_name="--world_name ${world}"
jinja_world_script=${sitl_path}/scripts/jinja_world_gen.py
sitl_ode_threads="--ode_threads ${threads}"
world_json="--json_gen ${wjson}"
if [ $hitl == true ]; then
hitl_model_name="--model_name ${PX4_SIM_MODEL}"
echo "HITL mode is currently turned on, disabling multiple vehicle spawn and script spawn."
echo "RUNNING: python3 $jinja_world_script $world_name $hitl_model_name $world_json"
python3 $jinja_world_script $world_name $hitl_model_name $world_json
echo "Generated temp_${world}.world"
spawn_model ${PX4_SIM_MODEL} 0 ${world} ${mjson}
else
echo "killing running instances"
pkill -x px4 || true
echo "HITL mode is currently turned off."
echo "RUNNING: python3 $jinja_world_script $world_name $sitl_ode_threads $world_json"
python3 $jinja_world_script $world_name $sitl_ode_threads $world_json
echo "Generated temp_${world}.world"
echo "Starting gazebo: gzserver ${sitl_path}/worlds/temp_${world}.world --verbose"
gzserver ${sitl_path}/worlds/temp_${world}.world --verbose &
sleep 5
n=0
if [ -z ${SCRIPT} ]; then
if [ $num_vehicles -gt 255 ]; then
echo "Tried spawning $num_vehicles vehicles. The maximum number of supported vehicles is 255"
exit 1
fi
while [ $n -lt $num_vehicles ]; do
spawn_model ${PX4_SIM_MODEL} $n ${world} ${mjson}
n=$(($n + 1))
done
else
for target in ${SCRIPT}; do
target="$(echo "$target" | tr -d ' ')" #Remove spaces
target_vehicle="${target%:*}"
target_number="${target#*:}"
if [ $n -gt 255 ]; then
echo "Tried spawning $n vehicles. The maximum number of supported vehicles is 255"
exit 1
fi
m=0
while [ $m -lt ${target_number} ]; do
spawn_model ${PX4_SIM_MODEL} $n ${world} ${mjson}
m=$(($m + 1))
n=$(($n + 1))
done
done
fi
echo "Starting gazebo client"
gzclient
fi

0
Tools/mavlink_px4.py Normal file → Executable file
View File

View File

@ -1,5 +0,0 @@
$(info px4_developer.mk inclded)
ifeq ($(UAVCAN_BL_OVERRIDE),y)
$(info ************************** UAVCAN BOOT LOADERS built for In place application Debugging ***************************************)
export EXTRAFLAGS +=-DDEBUG_APPLICATION_INPLACE
endif

0
Tools/px_romfs_pruner.py Normal file → Executable file
View File

View File

@ -1,6 +0,0 @@
#!/usr/bin/env bash
make parameters_metadata
cp parameters.xml ../qgroundcontrol/src/FirmwarePlugin/PX4/PX4ParameterFactMetaData.xml
make airframe_metadata
cp airframes.xml ../qgroundcontrol/src/AutoPilotPlugins/PX4/AirframeFactMetaData.xml

View File

@ -1,39 +0,0 @@
#!/bin/bash
#
# Setup environment to make JSBSim visible to PX4.
#
# License: according to LICENSE.md in the root directory of the PX4 Firmware repository
if [ "$#" != 3 ]; then
echo -e "usage: source setup_jsbsim.bash src_dir build_dir model\n"
return 1
fi
SRC_DIR="$1"
BUILD_DIR="$2"
MODEL="$3"
export FG_AIRCRAFT="${SRC_DIR}/Tools/jsbsim_bridge/models"
# This is needed for aircraft namespace mapping
# Need more architectural discussions to make this more scalable
case "$MODEL" in
rascal)
MODEL_NAME="Rascal110-JSBSim"
;;
malolo)
MODEL_NAME="Malolo1"
;;
quadrotor_x)
MODEL_NAME="quadrotor_x"
;;
hexarotor_x)
MODEL_NAME="hexarotor_x"
;;
*)
echo "Unknown Model"
exit 1
esac
export JSBSIM_AIRCRAFT_MODEL="$MODEL_NAME"

View File

@ -0,0 +1,47 @@
#!/usr/bin/env bash
set -e
if [ "$#" -lt 4 ]; then
echo usage: sitl_run.sh sitl_bin model src_path build_path
exit 1
fi
sitl_bin="$1"
model="$2"
src_path="$3"
build_path="$4"
echo SITL ARGS
echo sitl_bin: $sitl_bin
echo model: $model
echo src_path: $src_path
echo build_path: $build_path
rootfs="$build_path/rootfs" # this is the working directory
mkdir -p "$rootfs"
export PX4_SIM_MODEL=${model}
echo "FG setup"
cd "${src_path}/Tools/simulation/flightgear/flightgear_bridge/"
./FG_run.py models/${model}.json 0
"${build_path}/build_flightgear_bridge/flightgear_bridge" 0 `./get_FGbridge_params.py "models/"${model}".json"` &
FG_BRIDGE_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\" \"$build_path\"/etc"
echo SITL COMMAND: $sitl_command
eval $sitl_command
popd >/dev/null
kill $FG_BRIDGE_PID
kill -9 `cat /tmp/px4fgfspid_0`

View File

@ -17,7 +17,7 @@ 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/sitl_gazebo/models
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
echo -e "GAZEBO_PLUGIN_PATH $GAZEBO_PLUGIN_PATH"

View File

@ -4,7 +4,7 @@
# 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/gazebo_sitl_multiple_run.sh -n 10 -m iris
#./Tools/simulation/gazebo/sitl_multiple_run.sh -n 10 -m iris
function cleanup() {
pkill -x px4
@ -29,13 +29,13 @@ function spawn_model() {
exit 1
fi
working_dir="$build_path/instance_$n"
working_dir="$build_path/rootfs/$n"
[ ! -d "$working_dir" ] && mkdir -p "$working_dir"
pushd "$working_dir" &>/dev/null
echo "starting instance $N in $(pwd)"
../bin/px4 -i $N -d "$build_path/etc" -w sitl_${MODEL}_${N} -s etc/init.d-posix/rcS >out.log 2>err.log &
python3 ${src_path}/Tools/sitl_gazebo/scripts/jinja_gen.py ${src_path}/Tools/sitl_gazebo/models/${MODEL}/${MODEL}.sdf.jinja ${src_path}/Tools/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
$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
echo "Spawning ${MODEL}_${N} at ${X} ${Y}"
@ -73,7 +73,7 @@ export PX4_SIM_MODEL=${vehicle_model}
echo ${SCRIPT}
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
src_path="$SCRIPT_DIR/.."
src_path="$SCRIPT_DIR/../../.."
build_path=${src_path}/build/${target}
mavlink_udp_port=14560
@ -84,7 +84,7 @@ pkill -x px4 || true
sleep 1
source ${src_path}/Tools/setup_gazebo.bash ${src_path} ${src_path}/build/${target}
source ${src_path}/Tools/simulation/gazebo/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/sitl_gazebo/worlds/${world}.world --verbose $ros_args &
gzserver ${src_path}/Tools/simulation/gazebo/sitl_gazebo/worlds/${world}.world --verbose $ros_args &
sleep 5
n=0

View File

@ -0,0 +1,180 @@
#!/usr/bin/env bash
set -e
if [ "$#" -lt 6 ]; then
echo usage: sitl_run.sh sitl_bin debugger model world src_path build_path
exit 1
fi
if [[ -n "$DONT_RUN" ]]; then
echo "Not running simulation (DONT_RUN is set)."
exit 0
fi
sitl_bin="$1"
debugger="$2"
model="$3"
world="$4"
src_path="$5"
build_path="$6"
echo SITL ARGS
echo sitl_bin: $sitl_bin
echo debugger: $debugger
echo model: $model
echo world: $world
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
# To disable user input
if [[ -n "$VERBOSE_SIM" ]]; then
verbose="--verbose"
else
verbose=""
fi
# Disable follow mode
if [[ "$PX4_NO_FOLLOW_MODE" != "1" ]]; then
follow_mode="--gui-client-plugin libgazebo_user_camera_plugin.so"
else
follow_mode=""
fi
# To use gazebo_ros ROS2 plugins
if [[ -n "$ROS_VERSION" ]] && [ "$ROS_VERSION" == "2" ]; then
ros_args="-s libgazebo_ros_init.so -s libgazebo_ros_factory.so"
else
ros_args=""
fi
if [ "$model" == "" ] || [ "$model" == "none" ]; then
echo "empty model, setting iris as default"
model="iris"
fi
# kill process names that might stil
# be running from last time
pkill -x gazebo || true
export PX4_SIM_MODEL=${model}
export PX4_SIM_WORLD=${world}
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}"
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
echo "empty world, default world ${model}.world for model found"
world_path="${src_path}/Tools/simulation/gazebo/sitl_gazebo/worlds/${model}.world"
else
echo "empty world, setting empty.world as default"
world_path="${src_path}/Tools/simulation/gazebo/sitl_gazebo/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"
fi
else
if [ -f ${src_path}/Tools/simulation/gazebo/sitl_gazebo/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"
else
# Spawn world from environment variable with absolute path
world_path="$PX4_SITL_WORLD"
fi
fi
gzserver $verbose $world_path $ros_args &
SIM_PID=$!
# Check all paths in ${GAZEBO_MODEL_PATH} for specified model
IFS_bak=$IFS
IFS=":"
for possible_model_path in ${GAZEBO_MODEL_PATH}; do
if [ -z $possible_model_path ]; then
continue
fi
# trim \r from path
possible_model_path=$(echo $possible_model_path | tr -d '\r')
if test -f "${possible_model_path}/${model}/${model}.sdf" ; then
modelpath=$possible_model_path
break
fi
done
IFS=$IFS_bak
if [ -z $modelpath ]; then
echo "Model ${model} not found in model path: ${GAZEBO_MODEL_PATH}"
exit 1
else
echo "Using: ${modelpath}/${model}/${model}.sdf"
fi
while gz model --verbose --spawn-file="${modelpath}/${model}/${model_name}.sdf" --model-name=${model} -x 1.01 -y 0.98 -z 0.83 2>&1 | grep -q "An instance of Gazebo is not running."; do
echo "gzserver not ready yet, trying again!"
sleep 1
done
if [[ -n "$HEADLESS" ]]; then
echo "not running gazebo gui"
else
# gzserver needs to be running to avoid a race. Since the launch
# is putting it into the background we need to avoid it by backing off
sleep 3
nice -n 20 gzclient --verbose $follow_mode &
GUI_PID=$!
fi
else
echo "You need to have gazebo simulator installed!"
exit 1
fi
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
kill -9 $SIM_PID
if [[ ! -n "$HEADLESS" ]]; then
kill -9 $GUI_PID
fi

View File

Before

Width:  |  Height:  |  Size: 206 KiB

After

Width:  |  Height:  |  Size: 206 KiB

View File

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

View File

Before

Width:  |  Height:  |  Size: 182 KiB

After

Width:  |  Height:  |  Size: 182 KiB

View File

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 88 KiB

View File

Before

Width:  |  Height:  |  Size: 112 KiB

After

Width:  |  Height:  |  Size: 112 KiB

View File

Before

Width:  |  Height:  |  Size: 166 KiB

After

Width:  |  Height:  |  Size: 166 KiB

View File

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

View File

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 57 KiB

View File

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<sdf version="1.9">
<world name="empty">
<world name="default">
<physics type="ode">
<max_step_size>0.004</max_step_size>
<real_time_factor>1.0</real_time_factor>

View File

@ -0,0 +1,67 @@
#!/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

View File

@ -0,0 +1,96 @@
#!/usr/bin/env bash
set -e
if [ "$#" -lt 5 ]; then
echo usage: sitl_run.sh sitl_bin model world src_path build_path
exit 1
fi
if [[ -n "$DONT_RUN" ]]; then
echo "Not running simulation (DONT_RUN is set)."
exit 0
fi
sitl_bin="$1"
model="$2"
world="$3"
src_path="$4"
build_path="$5"
echo SITL ARGS
echo sitl_bin: $sitl_bin
echo model: $model
echo world: $world
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
export PX4_SIM_MODEL=${model}
export PX4_SIM_WORLD=${world}
# This is needed for aircraft namespace mapping
# Need more architectural discussions to make this more scalable
case "$model" in
rascal)
MODEL_NAME="Rascal110-JSBSim"
;;
malolo)
MODEL_NAME="Malolo1"
;;
quadrotor_x)
MODEL_NAME="quadrotor_x"
;;
hexarotor_x)
MODEL_NAME="hexarotor_x"
;;
*)
echo "Unknown Model"
exit 1
esac
export JSBSIM_AIRCRAFT_MODEL="$MODEL_NAME"
if [[ -n "$HEADLESS" ]]; then
echo "not running flightgear gui"
else
export FG_AIRCRAFT="${SRC_DIR}/Tools/simulation/jsbsim/jsbsim_bridge/models"
fgfs --fdm=null \
--native-fdm=socket,in,60,,5550,udp \
--aircraft=$JSBSIM_AIRCRAFT_MODEL \
--airport=${world} \
--disable-hud \
--disable-ai-models &> /dev/null &
FGFS_PID=$!
fi
"${build_path}/build_jsbsim_bridge/jsbsim_bridge" ${model} -s "${src_path}/Tools/simulation/jsbsim/jsbsim_bridge/scene/${world}.xml" 2> /dev/null &
JSBSIM_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
eval $sitl_command
popd >/dev/null
kill $JSBSIM_PID
kill $FGFS_PID

View File

@ -4,7 +4,7 @@
# The simulator is expected to send to TCP port 4560+i for i in [0, N-1]
# For example jmavsim can be run like this:
#./Tools/jmavsim_run.sh -p 4561 -l
#./Tools/simulation/jmavsim/jmavsim_run.sh -p 4561 -l
sitl_num=2
[ -n "$1" ] && sitl_num="$1"
@ -28,7 +28,7 @@ while [ $n -lt $sitl_num ]; do
pushd "$working_dir" &>/dev/null
echo "starting instance $n in $(pwd)"
../bin/px4 -i $n -d "$build_path/etc" -s etc/init.d-posix/rcS >out.log 2>err.log &
$build_path/bin/px4 -i $n -d "$build_path/etc" >out.log 2>err.log &
popd &>/dev/null
n=$(($n + 1))

View File

@ -1,287 +0,0 @@
#!/usr/bin/env bash
set -e
if [ "$#" -lt 7 ]; then
echo usage: sitl_run.sh sitl_bin debugger program model world src_path build_path
exit 1
fi
if [[ -n "$DONT_RUN" ]]; then
echo "Not running simulation (DONT_RUN is set)."
exit 0
fi
sitl_bin="$1"
debugger="$2"
program="$3"
model="$4"
world="$5"
src_path="$6"
build_path="$7"
# The rest of the arguments are files to copy into the working dir.
echo SITL ARGS
echo sitl_bin: $sitl_bin
echo debugger: $debugger
echo program: $program
echo model: $model
echo world: $world
echo src_path: $src_path
echo build_path: $build_path
rootfs="$build_path/tmp/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
# To disable user input
if [[ -n "$VERBOSE_SIM" ]]; then
verbose="--verbose"
else
verbose=""
fi
# Disable follow mode
if [[ "$PX4_NO_FOLLOW_MODE" != "1" ]]; then
follow_mode="--gui-client-plugin libgazebo_user_camera_plugin.so"
else
follow_mode=""
fi
# To use gazebo_ros ROS2 plugins
if [[ -n "$ROS_VERSION" ]] && [ "$ROS_VERSION" == "2" ]; then
ros_args="-s libgazebo_ros_init.so -s libgazebo_ros_factory.so"
else
ros_args=""
fi
if [ "$program" == "jmavsim" ]; then
jmavsim_pid=`ps aux | grep java | grep "\-jar jmavsim_run.jar" | awk '{ print $2 }'`
if [ -n "$jmavsim_pid" ]; then
kill $jmavsim_pid
fi
fi
if [ "$model" == "" ] || [ "$model" == "none" ]; then
if [ "$program" == "jsbsim" ]; then
echo "empty model, setting rascal as default for jsbsim"
model="rascal"
elif [ "$program" == "sihsim" ]; then
echo "empty model, setting quadx as default for sihsim"
model="quadx"
else
echo "empty model, setting iris as default"
model="iris"
fi
fi
# kill process names that might stil
# be running from last time
pkill -x gazebo || true
# Do NOT kill PX4 if debug in ide
if [ "$debugger" != "ide" ]; then
pkill -x px4 || true
pkill -x px4_$model || true
fi
cp "$src_path/Tools/posix_lldbinit" "$rootfs/.lldbinit"
cp "$src_path/Tools/posix.gdbinit" "$rootfs/.gdbinit"
shift 7
for file in "$@"; do
cp "$file" $rootfs/
done
export PX4_SIM_MODEL=${model}
export PX4_SIM_WORLD=${world}
SIM_PID=0
if [ "$program" == "jmavsim" ] && [ ! -n "$no_sim" ]; then
# Start Java simulator
"$src_path"/Tools/jmavsim_run.sh -r 250 -l &
SIM_PID=$!
elif [ "$program" == "gazebo" ] && [ ! -n "$no_sim" ]; then
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/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/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/sitl_gazebo/worlds/${model}.world ]; then
echo "empty world, default world ${model}.world for model found"
world_path="${src_path}/Tools/sitl_gazebo/worlds/${model}.world"
else
echo "empty world, setting empty.world as default"
world_path="${src_path}/Tools/sitl_gazebo/worlds/empty.world"
fi
else
#Spawn empty world if world with model name doesn't exist
world_path="${src_path}/Tools/sitl_gazebo/worlds/${world}.world"
fi
else
if [ -f ${src_path}/Tools/sitl_gazebo/worlds/${PX4_SITL_WORLD}.world ]; then
# Spawn world by name if exists in the worlds directory from environment variable
world_path="${src_path}/Tools/sitl_gazebo/worlds/${PX4_SITL_WORLD}.world"
else
# Spawn world from environment variable with absolute path
world_path="$PX4_SITL_WORLD"
fi
fi
gzserver $verbose $world_path $ros_args &
SIM_PID=$!
# Check all paths in ${GAZEBO_MODEL_PATH} for specified model
IFS_bak=$IFS
IFS=":"
for possible_model_path in ${GAZEBO_MODEL_PATH}; do
if [ -z $possible_model_path ]; then
continue
fi
# trim \r from path
possible_model_path=$(echo $possible_model_path | tr -d '\r')
if test -f "${possible_model_path}/${model}/${model}.sdf" ; then
modelpath=$possible_model_path
break
fi
done
IFS=$IFS_bak
if [ -z $modelpath ]; then
echo "Model ${model} not found in model path: ${GAZEBO_MODEL_PATH}"
exit 1
else
echo "Using: ${modelpath}/${model}/${model}.sdf"
fi
while gz model --verbose --spawn-file="${modelpath}/${model}/${model_name}.sdf" --model-name=${model} -x 1.01 -y 0.98 -z 0.83 2>&1 | grep -q "An instance of Gazebo is not running."; do
echo "gzserver not ready yet, trying again!"
sleep 1
done
if [[ -n "$HEADLESS" ]]; then
echo "not running gazebo gui"
else
# gzserver needs to be running to avoid a race. Since the launch
# is putting it into the background we need to avoid it by backing off
sleep 3
nice -n 20 gzclient --verbose $follow_mode &
GUI_PID=$!
fi
else
echo "You need to have gazebo simulator installed!"
exit 1
fi
elif [ "$program" == "ignition" ] && [ -z "$no_sim" ]; then
echo "Ignition Gazebo"
if [[ -n "$HEADLESS" ]]; then
ignition_headless="-s"
else
ignition_headless=""
fi
export IGN_GAZEBO_RESOURCE_PATH=$IGN_GAZEBO_RESOURCE_PATH:${src_path}/Tools/simulation/gazebo/models
# TODO: verify if world already exists?
ign service --info --service /world/empty/create
echo $?
ign gazebo ${ignition_headless} -r "${src_path}/Tools/simulation/gazebo/worlds/${world}.sdf" &
elif [ "$program" == "flightgear" ] && [ -z "$no_sim" ]; then
echo "FG setup"
cd "${src_path}/Tools/flightgear_bridge/"
"${src_path}/Tools/flightgear_bridge/FG_run.py" "models/"${model}".json" 0
"${build_path}/build_flightgear_bridge/flightgear_bridge" 0 `./get_FGbridge_params.py "models/"${model}".json"` &
FG_BRIDGE_PID=$!
elif [ "$program" == "jsbsim" ] && [ -z "$no_sim" ]; then
source "$src_path/Tools/setup_jsbsim.bash" "${src_path}" "${build_path}" ${model}
if [[ -n "$HEADLESS" ]]; then
echo "not running flightgear gui"
else
fgfs --fdm=null \
--native-fdm=socket,in,60,,5550,udp \
--aircraft=$JSBSIM_AIRCRAFT_MODEL \
--airport=${world} \
--disable-hud \
--disable-ai-models &> /dev/null &
FGFS_PID=$!
fi
"${build_path}/build_jsbsim_bridge/jsbsim_bridge" ${model} -s "${src_path}/Tools/jsbsim_bridge/scene/${world}.xml" 2> /dev/null &
JSBSIM_PID=$!
elif [ "$program" == "sihsim" ] && [ ! -n "$no_sim" ]; then
export SIM_MODE="sihsim"
if [ "$model" != "airplane" ] && [ "$model" != "quadx" ] && [ "$model" != "xvert" ]; then
echo "Model ${model} not compatible with with sih. sih supports [quadx,airplane,xvert]."
exit 1
fi
fi
pushd "$rootfs" >/dev/null
# Do not exit on failure now from here on because we want the complete cleanup
set +e
if [[ ${model} == test_* ]] || [[ ${model} == *_generated ]]; then
sitl_command="\"$sitl_bin\" $no_pxh \"$src_path\"/ROMFS/px4fmu_test -s \"${src_path}\"/posix-configs/SITL/init/test/${model} -t \"$src_path\"/test_data"
else
sitl_command="\"$sitl_bin\" $no_pxh \"$build_path\"/etc -s etc/init.d-posix/rcS -t \"$src_path\"/test_data"
fi
echo SITL COMMAND: $sitl_command
if [ "$debugger" == "lldb" ]; then
eval lldb -- $sitl_command
elif [ "$debugger" == "gdb" ]; then
eval gdb --args $sitl_command
elif [ "$debugger" == "ddd" ]; then
eval ddd --debugger 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
elif [ "$debugger" == "ide" ]; then
echo "######################################################################"
echo
echo "PX4 simulator not started, use your IDE to start PX4_${model} target."
echo "Hit enter to quit..."
echo
echo "######################################################################"
read
else
eval $sitl_command
fi
popd >/dev/null
if [ "$program" == "jmavsim" ]; then
pkill -9 -P $SIM_PID
kill -9 $SIM_PID
elif [ "$program" == "gazebo" ]; then
kill -9 $SIM_PID
if [[ ! -n "$HEADLESS" ]]; then
kill -9 $GUI_PID
fi
elif [ "$program" == "flightgear" ]; then
kill $FG_BRIDGE_PID
kill -9 `cat /tmp/px4fgfspid_0`
elif [ "$program" == "jsbsim" ]; then
kill $JSBSIM_PID
kill $FGFS_PID
fi

View File

@ -1,34 +0,0 @@
#!/bin/bash
UAVCANFW=../ROMFS/px4fmu_common/uavcan/fw
ROMFS_REFIX=_
echo Removing : $UAVCANFW
rm -fr $UAVCANFW
for f in $(find firmware -type f -name "*.*.bin")
do
UAVCAN_NAME=$(echo $f | cut -d"/" -f2 | cut -d. -f1-4 | cut -d- -f1-2)
UAVCAN_HW=$(echo $f cut -d/ -f2 | cut -d. -f1-4 | cut -d- -f3)
DST=${ROMFS_REFIX}$(echo $f | cut -d. -f3-7 | cut -d- -f1,2,3).$(echo $f | cut -d. -f6,7)
# deal with legacy non conforming naming
if [[ ${DST:(-7)} == bin.bin ]]
then
echo " WARNING: Improper name format!!!!!!!!! $f see should be <uavcan_name>-<HW_MAJOR>.<HW_MINOR)-<HW_MAJOR>.<HW_MINOR).<git hash[8]>.bin"
DST=${DST%????}
fi
echo Processing file: $f Length:${#DST}
if [ ${#DST} -le 28 ]
then
if [ -d "${UAVCANFW}/${UAVCAN_NAME}/${UAVCAN_HW}" ]
then
echo " ERROR: name colision directory ${UAVCANFW}/${UAVCAN_NAME}/${UAVCAN_HW} exits!"
exit 2
fi
echo " Creating Directory ${UAVCANFW}/${UAVCAN_NAME}/${UAVCAN_HW}"
mkdir -p ${UAVCANFW}/${UAVCAN_NAME}/${UAVCAN_HW}
echo " Copying $f to ${UAVCANFW}/${UAVCAN_NAME}/${UAVCAN_HW}/${DST}"
cp $f ${UAVCANFW}/${UAVCAN_NAME}/${UAVCAN_HW}/${DST}
else
echo " ERROR: $DST is ${#DST} charaters and needs to be less than or equal to 28"
exit 1
fi
done
exit 0

0
Tools/usb_serialload.py Normal file → Executable file
View File

View File

@ -28,7 +28,7 @@ CONFIG_DRIVERS_PCA9685_PWM_OUT=y
CONFIG_DRIVERS_POWER_MONITOR_INA226=y
CONFIG_DRIVERS_PWM_INPUT=y
CONFIG_DRIVERS_PWM_OUT=y
CONFIG_DRIVERS_PWM_OUT_SIM=y
CONFIG_MODULES_SIMULATION_PWM_OUT_SIM=y
CONFIG_DRIVERS_RC_INPUT=y
CONFIG_DRIVERS_ROBOCLAW=y
CONFIG_DRIVERS_RPM=y
@ -70,7 +70,7 @@ CONFIG_MODULES_NAVIGATOR=y
CONFIG_MODULES_RC_UPDATE=y
CONFIG_MODULES_ROVER_POS_CONTROL=y
CONFIG_MODULES_SENSORS=y
CONFIG_MODULES_SIH=y
CONFIG_MODULES_SIMULATION_SIH=y
CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_UUV_ATT_CONTROL=y
CONFIG_MODULES_UUV_POS_CONTROL=y

View File

@ -30,7 +30,7 @@ CONFIG_MODULES_CONTROL_ALLOCATOR=y
CONFIG_MODULES_NAVIGATOR=y
CONFIG_MODULES_RC_UPDATE=y
CONFIG_MODULES_SENSORS=y
CONFIG_MODULES_SIH=y
CONFIG_MODULES_SIMULATION_SIH=y
CONFIG_MODULES_GIMBAL=y
CONFIG_SYSTEMCMDS_BL_UPDATE=y
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y

View File

@ -27,7 +27,7 @@ CONFIG_DRIVERS_PCA9685=y
CONFIG_DRIVERS_PCA9685_PWM_OUT=y
CONFIG_DRIVERS_POWER_MONITOR_INA226=y
CONFIG_DRIVERS_PWM_OUT=y
CONFIG_DRIVERS_PWM_OUT_SIM=y
CONFIG_MODULES_SIMULATION_PWM_OUT_SIM=y
CONFIG_DRIVERS_RC_INPUT=y
CONFIG_DRIVERS_ROBOCLAW=y
CONFIG_DRIVERS_RPM=y
@ -67,7 +67,7 @@ CONFIG_MODULES_NAVIGATOR=y
CONFIG_MODULES_RC_UPDATE=y
CONFIG_MODULES_ROVER_POS_CONTROL=y
CONFIG_MODULES_SENSORS=y
CONFIG_MODULES_SIH=y
CONFIG_MODULES_SIMULATION_SIH=y
CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_UUV_ATT_CONTROL=y
CONFIG_MODULES_UUV_POS_CONTROL=y

View File

@ -16,7 +16,7 @@ CONFIG_DRIVERS_IMU_INVENSENSE_ICM20948=y
CONFIG_DRIVERS_IMU_INVENSENSE_MPU9250=y
CONFIG_DRIVERS_LINUX_PWM_OUT=y
CONFIG_DRIVERS_MAGNETOMETER_HMC5883=y
CONFIG_DRIVERS_PWM_OUT_SIM=y
CONFIG_MODULES_SIMULATION_PWM_OUT_SIM=y
CONFIG_DRIVERS_RC_INPUT=y
CONFIG_DRIVERS_SMART_BATTERY_BATMON=y
CONFIG_MODULES_AIRSPEED_SELECTOR=y
@ -52,7 +52,7 @@ CONFIG_MODULES_NAVIGATOR=y
CONFIG_MODULES_RC_UPDATE=y
CONFIG_MODULES_ROVER_POS_CONTROL=y
CONFIG_MODULES_SENSORS=y
CONFIG_MODULES_SIH=y
CONFIG_MODULES_SIMULATION_SIH=y
CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_UUV_ATT_CONTROL=y
CONFIG_MODULES_UUV_POS_CONTROL=y

View File

@ -31,7 +31,7 @@ CONFIG_DRIVERS_PCA9685=y
CONFIG_DRIVERS_PCA9685_PWM_OUT=y
CONFIG_DRIVERS_POWER_MONITOR_INA226=y
CONFIG_DRIVERS_PWM_OUT=y
CONFIG_DRIVERS_PWM_OUT_SIM=y
CONFIG_MODULES_SIMULATION_PWM_OUT_SIM=y
CONFIG_DRIVERS_RC_INPUT=y
CONFIG_DRIVERS_ROBOCLAW=y
CONFIG_DRIVERS_RPM=y
@ -74,7 +74,7 @@ CONFIG_MODULES_NAVIGATOR=y
CONFIG_MODULES_RC_UPDATE=y
CONFIG_MODULES_ROVER_POS_CONTROL=y
CONFIG_MODULES_SENSORS=y
CONFIG_MODULES_SIH=y
CONFIG_MODULES_SIMULATION_SIH=y
CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_GIMBAL=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y

View File

@ -32,7 +32,7 @@ CONFIG_DRIVERS_PCA9685=y
CONFIG_DRIVERS_PCA9685_PWM_OUT=y
CONFIG_DRIVERS_POWER_MONITOR_INA226=y
CONFIG_DRIVERS_PWM_OUT=y
CONFIG_DRIVERS_PWM_OUT_SIM=y
CONFIG_MODULES_SIMULATION_PWM_OUT_SIM=y
CONFIG_DRIVERS_RC_INPUT=y
CONFIG_DRIVERS_ROBOCLAW=y
CONFIG_DRIVERS_RPM=y
@ -75,7 +75,7 @@ CONFIG_MODULES_NAVIGATOR=y
CONFIG_MODULES_RC_UPDATE=y
CONFIG_MODULES_ROVER_POS_CONTROL=y
CONFIG_MODULES_SENSORS=y
CONFIG_MODULES_SIH=y
CONFIG_MODULES_SIMULATION_SIH=y
CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_GIMBAL=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y

View File

@ -28,7 +28,7 @@ CONFIG_DRIVERS_PCA9685_PWM_OUT=y
CONFIG_DRIVERS_POWER_MONITOR_INA226=y
CONFIG_DRIVERS_PWM_INPUT=y
CONFIG_DRIVERS_PWM_OUT=y
CONFIG_DRIVERS_PWM_OUT_SIM=y
CONFIG_MODULES_SIMULATION_PWM_OUT_SIM=y
CONFIG_DRIVERS_PX4IO=y
#CONFIG_DRIVERS_ROBOCLAW=y
CONFIG_DRIVERS_RPM=y
@ -70,7 +70,7 @@ CONFIG_MODULES_NAVIGATOR=y
CONFIG_MODULES_RC_UPDATE=y
CONFIG_MODULES_ROVER_POS_CONTROL=y
CONFIG_MODULES_SENSORS=y
CONFIG_MODULES_SIH=y
CONFIG_MODULES_SIMULATION_SIH=y
CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y

View File

@ -29,7 +29,7 @@ CONFIG_DRIVERS_PCA9685=y
CONFIG_DRIVERS_PCA9685_PWM_OUT=y
CONFIG_DRIVERS_POWER_MONITOR_INA226=y
CONFIG_DRIVERS_PWM_OUT=y
CONFIG_DRIVERS_PWM_OUT_SIM=y
CONFIG_MODULES_SIMULATION_PWM_OUT_SIM=y
CONFIG_DRIVERS_PX4IO=y
CONFIG_DRIVERS_ROBOCLAW=y
CONFIG_DRIVERS_RPM=y
@ -70,7 +70,7 @@ CONFIG_MODULES_NAVIGATOR=y
CONFIG_MODULES_RC_UPDATE=y
CONFIG_MODULES_ROVER_POS_CONTROL=y
CONFIG_MODULES_SENSORS=y
CONFIG_MODULES_SIH=y
CONFIG_MODULES_SIMULATION_SIH=y
CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_UUV_ATT_CONTROL=y
CONFIG_MODULES_UUV_POS_CONTROL=y

View File

@ -18,7 +18,7 @@ CONFIG_DRIVERS_IMU_ST_LSM9DS1=y
CONFIG_DRIVERS_LINUX_PWM_OUT=y
CONFIG_DRIVERS_MAGNETOMETER_HMC5883=y
CONFIG_DRIVERS_MAGNETOMETER_LSM9DS1_MAG=y
CONFIG_DRIVERS_PWM_OUT_SIM=y
CONFIG_MODULES_SIMULATION_PWM_OUT_SIM=y
CONFIG_DRIVERS_RC_INPUT=y
CONFIG_DRIVERS_SMART_BATTERY_BATMON=y
CONFIG_MODULES_AIRSPEED_SELECTOR=y
@ -54,7 +54,7 @@ CONFIG_MODULES_NAVIGATOR=y
CONFIG_MODULES_RC_UPDATE=y
CONFIG_MODULES_ROVER_POS_CONTROL=y
CONFIG_MODULES_SENSORS=y
CONFIG_MODULES_SIH=y
CONFIG_MODULES_SIMULATION_SIH=y
CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_UUV_ATT_CONTROL=y
CONFIG_MODULES_UUV_POS_CONTROL=y

View File

@ -28,7 +28,7 @@ CONFIG_DRIVERS_PCA9685=y
CONFIG_DRIVERS_PCA9685_PWM_OUT=y
CONFIG_DRIVERS_POWER_MONITOR_INA226=y
CONFIG_DRIVERS_PWM_OUT=y
CONFIG_DRIVERS_PWM_OUT_SIM=y
CONFIG_MODULES_SIMULATION_PWM_OUT_SIM=y
CONFIG_DRIVERS_PX4IO=y
CONFIG_DRIVERS_ROBOCLAW=y
CONFIG_DRIVERS_RPM=y
@ -67,7 +67,7 @@ CONFIG_MODULES_NAVIGATOR=y
CONFIG_MODULES_RC_UPDATE=y
CONFIG_MODULES_ROVER_POS_CONTROL=y
CONFIG_MODULES_SENSORS=y
CONFIG_MODULES_SIH=y
CONFIG_MODULES_SIMULATION_SIH=y
CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_GIMBAL=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y

View File

@ -21,7 +21,7 @@ CONFIG_COMMON_OPTICAL_FLOW=y
CONFIG_DRIVERS_OSD=y
CONFIG_DRIVERS_POWER_MONITOR_INA226=y
CONFIG_DRIVERS_PWM_OUT=y
CONFIG_DRIVERS_PWM_OUT_SIM=y
CONFIG_MODULES_SIMULATION_PWM_OUT_SIM=y
CONFIG_DRIVERS_RC_INPUT=y
CONFIG_DRIVERS_ROBOCLAW=y
CONFIG_DRIVERS_RPM=y
@ -62,7 +62,7 @@ CONFIG_MODULES_RC_UPDATE=y
CONFIG_MODULES_ROVER_POS_CONTROL=y
CONFIG_MODULES_SENSORS=y
# CONFIG_SENSORS_VEHICLE_AIRSPEED is not set
CONFIG_MODULES_SIH=y
CONFIG_MODULES_SIMULATION_SIH=y
CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y

View File

@ -32,7 +32,7 @@ CONFIG_DRIVERS_PCA9685_PWM_OUT=y
CONFIG_DRIVERS_POWER_MONITOR_INA226=y
CONFIG_DRIVERS_PWM_INPUT=y
CONFIG_DRIVERS_PWM_OUT=y
CONFIG_DRIVERS_PWM_OUT_SIM=y
CONFIG_MODULES_SIMULATION_PWM_OUT_SIM=y
CONFIG_DRIVERS_PX4IO=y
CONFIG_DRIVERS_RC_INPUT=y
CONFIG_DRIVERS_ROBOCLAW=y
@ -75,7 +75,7 @@ CONFIG_MODULES_NAVIGATOR=y
CONFIG_MODULES_RC_UPDATE=y
CONFIG_MODULES_ROVER_POS_CONTROL=y
CONFIG_MODULES_SENSORS=y
CONFIG_MODULES_SIH=y
CONFIG_MODULES_SIMULATION_SIH=y
CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_UUV_ATT_CONTROL=y
CONFIG_MODULES_UUV_POS_CONTROL=y

View File

@ -30,7 +30,7 @@ CONFIG_DRIVERS_PCA9685_PWM_OUT=y
CONFIG_DRIVERS_POWER_MONITOR_INA226=y
CONFIG_DRIVERS_POWER_MONITOR_VOXLPM=y
CONFIG_DRIVERS_PWM_OUT=y
CONFIG_DRIVERS_PWM_OUT_SIM=y
CONFIG_MODULES_SIMULATION_PWM_OUT_SIM=y
CONFIG_DRIVERS_RC_INPUT=y
CONFIG_DRIVERS_ROBOCLAW=y
CONFIG_DRIVERS_RPM=y
@ -72,7 +72,7 @@ CONFIG_MODULES_NAVIGATOR=y
CONFIG_MODULES_RC_UPDATE=y
CONFIG_MODULES_ROVER_POS_CONTROL=y
CONFIG_MODULES_SENSORS=y
CONFIG_MODULES_SIH=y
CONFIG_MODULES_SIMULATION_SIH=y
CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_UUV_ATT_CONTROL=y
CONFIG_MODULES_UUV_POS_CONTROL=y

View File

@ -29,7 +29,7 @@ CONFIG_DRIVERS_PCA9685_PWM_OUT=y
CONFIG_DRIVERS_POWER_MONITOR_INA226=y
CONFIG_DRIVERS_POWER_MONITOR_VOXLPM=y
CONFIG_DRIVERS_PWM_OUT=y
CONFIG_DRIVERS_PWM_OUT_SIM=y
CONFIG_MODULES_SIMULATION_PWM_OUT_SIM=y
CONFIG_DRIVERS_RC_INPUT=y
CONFIG_DRIVERS_ROBOCLAW=y
CONFIG_DRIVERS_RPM=y
@ -70,7 +70,7 @@ CONFIG_MODULES_NAVIGATOR=y
CONFIG_MODULES_RC_UPDATE=y
CONFIG_MODULES_ROVER_POS_CONTROL=y
CONFIG_MODULES_SENSORS=y
CONFIG_MODULES_SIH=y
CONFIG_MODULES_SIMULATION_SIH=y
CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y

View File

@ -26,7 +26,7 @@ CONFIG_DRIVERS_PCA9685=y
CONFIG_DRIVERS_PCA9685_PWM_OUT=y
CONFIG_DRIVERS_POWER_MONITOR_INA226=y
CONFIG_DRIVERS_PWM_OUT=y
CONFIG_DRIVERS_PWM_OUT_SIM=y
CONFIG_MODULES_SIMULATION_PWM_OUT_SIM=y
CONFIG_DRIVERS_RC_INPUT=y
CONFIG_DRIVERS_ROBOCLAW=y
CONFIG_DRIVERS_RPM=y
@ -67,7 +67,7 @@ CONFIG_MODULES_NAVIGATOR=y
CONFIG_MODULES_RC_UPDATE=y
CONFIG_MODULES_ROVER_POS_CONTROL=y
CONFIG_MODULES_SENSORS=y
CONFIG_MODULES_SIH=y
CONFIG_MODULES_SIMULATION_SIH=y
CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_UUV_ATT_CONTROL=y
CONFIG_MODULES_UUV_POS_CONTROL=y

View File

@ -26,7 +26,7 @@ CONFIG_DRIVERS_PCA9685=y
CONFIG_DRIVERS_PCA9685_PWM_OUT=y
CONFIG_DRIVERS_POWER_MONITOR_INA226=y
CONFIG_DRIVERS_PWM_OUT=y
CONFIG_DRIVERS_PWM_OUT_SIM=y
CONFIG_MODULES_SIMULATION_PWM_OUT_SIM=y
CONFIG_DRIVERS_RC_INPUT=y
CONFIG_DRIVERS_ROBOCLAW=y
CONFIG_DRIVERS_RPM=y
@ -68,7 +68,7 @@ CONFIG_MODULES_NAVIGATOR=y
CONFIG_MODULES_RC_UPDATE=y
CONFIG_MODULES_ROVER_POS_CONTROL=y
CONFIG_MODULES_SENSORS=y
CONFIG_MODULES_SIH=y
CONFIG_MODULES_SIMULATION_SIH=y
CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_UUV_ATT_CONTROL=y
CONFIG_MODULES_UUV_POS_CONTROL=y

View File

@ -25,7 +25,7 @@ CONFIG_DRIVERS_PCA9685=y
CONFIG_DRIVERS_PCA9685_PWM_OUT=y
CONFIG_DRIVERS_POWER_MONITOR_INA226=y
CONFIG_DRIVERS_PWM_OUT=y
CONFIG_DRIVERS_PWM_OUT_SIM=y
CONFIG_MODULES_SIMULATION_PWM_OUT_SIM=y
CONFIG_DRIVERS_RC_INPUT=y
CONFIG_DRIVERS_ROBOCLAW=y
CONFIG_DRIVERS_RPM=y
@ -68,7 +68,7 @@ CONFIG_MODULES_NAVIGATOR=y
CONFIG_MODULES_RC_UPDATE=y
CONFIG_MODULES_ROVER_POS_CONTROL=y
CONFIG_MODULES_SENSORS=y
CONFIG_MODULES_SIH=y
CONFIG_MODULES_SIMULATION_SIH=y
CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_UUV_ATT_CONTROL=y
CONFIG_MODULES_UUV_POS_CONTROL=y

View File

@ -26,7 +26,7 @@ CONFIG_DRIVERS_PCA9685=y
CONFIG_DRIVERS_PCA9685_PWM_OUT=y
CONFIG_DRIVERS_POWER_MONITOR_INA226=y
CONFIG_DRIVERS_PWM_OUT=y
CONFIG_DRIVERS_PWM_OUT_SIM=y
CONFIG_MODULES_SIMULATION_PWM_OUT_SIM=y
CONFIG_DRIVERS_RC_INPUT=y
CONFIG_DRIVERS_ROBOCLAW=y
CONFIG_DRIVERS_RPM=y
@ -67,7 +67,7 @@ CONFIG_MODULES_NAVIGATOR=y
CONFIG_MODULES_RC_UPDATE=y
CONFIG_MODULES_ROVER_POS_CONTROL=y
CONFIG_MODULES_SENSORS=y
CONFIG_MODULES_SIH=y
CONFIG_MODULES_SIMULATION_SIH=y
CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_UUV_ATT_CONTROL=y
CONFIG_MODULES_UUV_POS_CONTROL=y

View File

@ -26,7 +26,7 @@ CONFIG_DRIVERS_PCA9685=y
CONFIG_DRIVERS_PCA9685_PWM_OUT=y
CONFIG_DRIVERS_POWER_MONITOR_INA226=y
CONFIG_DRIVERS_PWM_OUT=y
CONFIG_DRIVERS_PWM_OUT_SIM=y
CONFIG_MODULES_SIMULATION_PWM_OUT_SIM=y
CONFIG_DRIVERS_RC_INPUT=y
CONFIG_DRIVERS_ROBOCLAW=y
CONFIG_DRIVERS_RPM=y
@ -68,7 +68,7 @@ CONFIG_MODULES_NAVIGATOR=y
CONFIG_MODULES_RC_UPDATE=y
CONFIG_MODULES_ROVER_POS_CONTROL=y
CONFIG_MODULES_SENSORS=y
CONFIG_MODULES_SIH=y
CONFIG_MODULES_SIMULATION_SIH=y
CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_UUV_ATT_CONTROL=y
CONFIG_MODULES_UUV_POS_CONTROL=y

View File

@ -26,7 +26,7 @@ CONFIG_DRIVERS_PCA9685=y
CONFIG_DRIVERS_PCA9685_PWM_OUT=y
CONFIG_DRIVERS_POWER_MONITOR_INA226=y
CONFIG_DRIVERS_PWM_OUT=y
CONFIG_DRIVERS_PWM_OUT_SIM=y
CONFIG_MODULES_SIMULATION_PWM_OUT_SIM=y
CONFIG_DRIVERS_RC_INPUT=y
CONFIG_DRIVERS_ROBOCLAW=y
CONFIG_DRIVERS_RPM=y
@ -68,7 +68,7 @@ CONFIG_MODULES_NAVIGATOR=y
CONFIG_MODULES_RC_UPDATE=y
CONFIG_MODULES_ROVER_POS_CONTROL=y
CONFIG_MODULES_SENSORS=y
CONFIG_MODULES_SIH=y
CONFIG_MODULES_SIMULATION_SIH=y
CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_UUV_ATT_CONTROL=y
CONFIG_MODULES_UUV_POS_CONTROL=y

View File

@ -27,7 +27,7 @@ CONFIG_DRIVERS_PCA9685_PWM_OUT=y
CONFIG_DRIVERS_POWER_MONITOR_INA226=y
CONFIG_DRIVERS_PWM_INPUT=y
CONFIG_DRIVERS_PWM_OUT=y
CONFIG_DRIVERS_PWM_OUT_SIM=y
CONFIG_MODULES_SIMULATION_PWM_OUT_SIM=y
CONFIG_DRIVERS_PX4IO=y
CONFIG_DRIVERS_ROBOCLAW=y
CONFIG_DRIVERS_RPM=y
@ -69,7 +69,7 @@ CONFIG_MODULES_NAVIGATOR=y
CONFIG_MODULES_RC_UPDATE=y
CONFIG_MODULES_ROVER_POS_CONTROL=y
CONFIG_MODULES_SENSORS=y
CONFIG_MODULES_SIH=y
CONFIG_MODULES_SIMULATION_SIH=y
CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_UUV_ATT_CONTROL=y
CONFIG_MODULES_UUV_POS_CONTROL=y

View File

@ -28,7 +28,7 @@ CONFIG_DRIVERS_PCA9685_PWM_OUT=y
CONFIG_DRIVERS_POWER_MONITOR_INA226=y
CONFIG_DRIVERS_PWM_INPUT=y
CONFIG_DRIVERS_PWM_OUT=y
CONFIG_DRIVERS_PWM_OUT_SIM=y
CONFIG_MODULES_SIMULATION_PWM_OUT_SIM=y
CONFIG_DRIVERS_PX4IO=y
CONFIG_DRIVERS_ROBOCLAW=y
CONFIG_DRIVERS_RPM=y
@ -70,7 +70,7 @@ CONFIG_MODULES_NAVIGATOR=y
CONFIG_MODULES_RC_UPDATE=y
CONFIG_MODULES_ROVER_POS_CONTROL=y
CONFIG_MODULES_SENSORS=y
CONFIG_MODULES_SIH=y
CONFIG_MODULES_SIMULATION_SIH=y
CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_UUV_ATT_CONTROL=y
CONFIG_MODULES_UUV_POS_CONTROL=y

View File

@ -28,7 +28,7 @@ CONFIG_DRIVERS_PCA9685=y
CONFIG_DRIVERS_PCA9685_PWM_OUT=y
CONFIG_DRIVERS_POWER_MONITOR_INA226=y
CONFIG_DRIVERS_PWM_OUT=y
CONFIG_DRIVERS_PWM_OUT_SIM=y
CONFIG_MODULES_SIMULATION_PWM_OUT_SIM=y
CONFIG_DRIVERS_RC_INPUT=y
CONFIG_DRIVERS_ROBOCLAW=y
CONFIG_DRIVERS_RPM=y
@ -70,7 +70,7 @@ CONFIG_MODULES_NAVIGATOR=y
CONFIG_MODULES_RC_UPDATE=y
CONFIG_MODULES_ROVER_POS_CONTROL=y
CONFIG_MODULES_SENSORS=y
CONFIG_MODULES_SIH=y
CONFIG_MODULES_SIMULATION_SIH=y
CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_GIMBAL=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y

View File

@ -32,7 +32,7 @@ CONFIG_DRIVERS_PCA9685=y
CONFIG_DRIVERS_PCA9685_PWM_OUT=y
CONFIG_DRIVERS_POWER_MONITOR_INA226=y
CONFIG_DRIVERS_PWM_OUT=y
CONFIG_DRIVERS_PWM_OUT_SIM=y
CONFIG_MODULES_SIMULATION_PWM_OUT_SIM=y
CONFIG_DRIVERS_RC_INPUT=y
CONFIG_DRIVERS_ROBOCLAW=y
CONFIG_DRIVERS_RPM=y
@ -75,7 +75,7 @@ CONFIG_MODULES_NAVIGATOR=y
CONFIG_MODULES_RC_UPDATE=y
CONFIG_MODULES_ROVER_POS_CONTROL=y
CONFIG_MODULES_SENSORS=y
CONFIG_MODULES_SIH=y
CONFIG_MODULES_SIMULATION_SIH=y
CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_GIMBAL=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y

View File

@ -19,7 +19,7 @@ CONFIG_DRIVERS_LIGHTS_RGBLED_PWM=y
CONFIG_DRIVERS_MAGNETOMETER_HMC5883=y
CONFIG_DRIVERS_MAGNETOMETER_ISENTEK_IST8310=y
CONFIG_DRIVERS_PWM_OUT=y
CONFIG_DRIVERS_PWM_OUT_SIM=y
CONFIG_MODULES_SIMULATION_PWM_OUT_SIM=y
CONFIG_DRIVERS_RC_INPUT=y
CONFIG_DRIVERS_SAFETY_BUTTON=y
CONFIG_DRIVERS_TONE_ALARM=y

View File

@ -32,7 +32,7 @@ CONFIG_DRIVERS_PCA9685=y
CONFIG_DRIVERS_PCA9685_PWM_OUT=y
CONFIG_DRIVERS_PWM_INPUT=y
CONFIG_DRIVERS_PWM_OUT=y
CONFIG_DRIVERS_PWM_OUT_SIM=y
CONFIG_MODULES_SIMULATION_PWM_OUT_SIM=y
CONFIG_DRIVERS_PX4IO=y
CONFIG_DRIVERS_ROBOCLAW=y
CONFIG_DRIVERS_RPM=y
@ -73,7 +73,7 @@ CONFIG_MODULES_NAVIGATOR=y
CONFIG_MODULES_RC_UPDATE=y
CONFIG_MODULES_ROVER_POS_CONTROL=y
CONFIG_MODULES_SENSORS=y
CONFIG_MODULES_SIH=y
CONFIG_MODULES_SIMULATION_SIH=y
CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_UUV_ATT_CONTROL=y
CONFIG_MODULES_UUV_POS_CONTROL=y

View File

@ -31,7 +31,7 @@ CONFIG_DRIVERS_PCA9685_PWM_OUT=y
CONFIG_DRIVERS_POWER_MONITOR_INA226=y
CONFIG_DRIVERS_PWM_INPUT=y
CONFIG_DRIVERS_PWM_OUT=y
CONFIG_DRIVERS_PWM_OUT_SIM=y
CONFIG_MODULES_SIMULATION_PWM_OUT_SIM=y
CONFIG_DRIVERS_RC_INPUT=y
CONFIG_DRIVERS_ROBOCLAW=y
CONFIG_DRIVERS_RPM=y
@ -74,7 +74,7 @@ CONFIG_MODULES_NAVIGATOR=y
CONFIG_MODULES_RC_UPDATE=y
CONFIG_MODULES_ROVER_POS_CONTROL=y
CONFIG_MODULES_SENSORS=y
CONFIG_MODULES_SIH=y
CONFIG_MODULES_SIMULATION_SIH=y
CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_UUV_ATT_CONTROL=y
CONFIG_MODULES_UUV_POS_CONTROL=y

View File

@ -30,7 +30,7 @@ CONFIG_DRIVERS_PCA9685=y
CONFIG_DRIVERS_PCA9685_PWM_OUT=y
CONFIG_DRIVERS_PWM_INPUT=y
CONFIG_DRIVERS_PWM_OUT=y
CONFIG_DRIVERS_PWM_OUT_SIM=y
CONFIG_MODULES_SIMULATION_PWM_OUT_SIM=y
CONFIG_DRIVERS_PX4IO=y
CONFIG_DRIVERS_ROBOCLAW=y
CONFIG_DRIVERS_RPM=y
@ -71,7 +71,7 @@ CONFIG_MODULES_NAVIGATOR=y
CONFIG_MODULES_RC_UPDATE=y
CONFIG_MODULES_ROVER_POS_CONTROL=y
CONFIG_MODULES_SENSORS=y
CONFIG_MODULES_SIH=y
CONFIG_MODULES_SIMULATION_SIH=y
CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_UUV_ATT_CONTROL=y
CONFIG_MODULES_UUV_POS_CONTROL=y

View File

@ -33,11 +33,9 @@ CONFIG_DRIVERS_PCA9685_PWM_OUT=y
CONFIG_DRIVERS_POWER_MONITOR_INA226=y
CONFIG_DRIVERS_PWM_INPUT=y
CONFIG_DRIVERS_PWM_OUT=y
CONFIG_DRIVERS_PWM_OUT_SIM=y
CONFIG_DRIVERS_PX4IO=y
CONFIG_DRIVERS_RC_INPUT=y
CONFIG_DRIVERS_ROBOCLAW=y
CONFIG_DRIVERS_RPM=y
CONFIG_DRIVERS_SAFETY_BUTTON=y
CONFIG_DRIVERS_SMART_BATTERY_BATMON=y
CONFIG_COMMON_TELEMETRY=y
@ -78,7 +76,8 @@ CONFIG_MODULES_NAVIGATOR=y
CONFIG_MODULES_RC_UPDATE=y
CONFIG_MODULES_ROVER_POS_CONTROL=y
CONFIG_MODULES_SENSORS=y
CONFIG_MODULES_SIH=y
CONFIG_MODULES_SIMULATION_PWM_OUT_SIM=y
CONFIG_MODULES_SIMULATION_SIMULATOR_SIH=y
CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_UUV_ATT_CONTROL=y
CONFIG_MODULES_UUV_POS_CONTROL=y

View File

@ -37,11 +37,9 @@ CONFIG_DRIVERS_POWER_MONITOR_INA228=y
CONFIG_DRIVERS_POWER_MONITOR_INA238=y
CONFIG_DRIVERS_PWM_INPUT=y
CONFIG_DRIVERS_PWM_OUT=y
CONFIG_DRIVERS_PWM_OUT_SIM=y
CONFIG_DRIVERS_PX4IO=y
CONFIG_DRIVERS_RC_INPUT=y
CONFIG_DRIVERS_ROBOCLAW=y
CONFIG_DRIVERS_RPM=y
CONFIG_DRIVERS_SAFETY_BUTTON=y
CONFIG_DRIVERS_SMART_BATTERY_BATMON=y
CONFIG_COMMON_TELEMETRY=y
@ -81,7 +79,8 @@ CONFIG_MODULES_NAVIGATOR=y
CONFIG_MODULES_RC_UPDATE=y
CONFIG_MODULES_ROVER_POS_CONTROL=y
CONFIG_MODULES_SENSORS=y
CONFIG_MODULES_SIH=y
CONFIG_MODULES_SIMULATION_PWM_OUT_SIM=y
CONFIG_MODULES_SIMULATION_SIMULATOR_SIH=y
CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y

View File

@ -24,7 +24,6 @@ CONFIG_DRIVERS_POWER_MONITOR_INA226=y
CONFIG_DRIVERS_POWER_MONITOR_INA228=y
CONFIG_DRIVERS_POWER_MONITOR_INA238=y
CONFIG_DRIVERS_PWM_OUT=y
CONFIG_DRIVERS_PWM_OUT_SIM=y
CONFIG_DRIVERS_PX4IO=y
CONFIG_COMMON_TELEMETRY=y
CONFIG_DRIVERS_TONE_ALARM=y
@ -62,7 +61,8 @@ CONFIG_MODULES_NAVIGATOR=y
CONFIG_MODULES_RC_UPDATE=y
CONFIG_MODULES_ROVER_POS_CONTROL=y
CONFIG_MODULES_SENSORS=y
CONFIG_MODULES_SIH=y
CONFIG_MODULES_SIMULATION_PWM_OUT_SIM=y
CONFIG_MODULES_SIMULATION_SIMULATOR_SIH=y
CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y

View File

@ -29,7 +29,7 @@ CONFIG_DRIVERS_PCA9685=y
CONFIG_DRIVERS_PCA9685_PWM_OUT=y
CONFIG_DRIVERS_POWER_MONITOR_INA226=y
CONFIG_DRIVERS_PWM_OUT=y
CONFIG_DRIVERS_PWM_OUT_SIM=y
CONFIG_MODULES_SIMULATION_PWM_OUT_SIM=y
CONFIG_DRIVERS_RC_INPUT=y
CONFIG_DRIVERS_ROBOCLAW=y
CONFIG_DRIVERS_RPM=y
@ -70,7 +70,7 @@ CONFIG_MODULES_NAVIGATOR=y
CONFIG_MODULES_RC_UPDATE=y
CONFIG_MODULES_ROVER_POS_CONTROL=y
CONFIG_MODULES_SENSORS=y
CONFIG_MODULES_SIH=y
CONFIG_MODULES_SIMULATION_SIH=y
CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_GIMBAL=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y

View File

@ -30,7 +30,6 @@ CONFIG_DRIVERS_POWER_MONITOR_INA226=y
CONFIG_DRIVERS_POWER_MONITOR_INA228=y
CONFIG_DRIVERS_POWER_MONITOR_INA238=y
CONFIG_DRIVERS_PWM_OUT=y
CONFIG_DRIVERS_PWM_OUT_SIM=y
CONFIG_DRIVERS_PX4IO=y
CONFIG_DRIVERS_RC_INPUT=y
CONFIG_DRIVERS_SAFETY_BUTTON=y
@ -68,7 +67,8 @@ CONFIG_MODULES_NAVIGATOR=y
CONFIG_MODULES_RC_UPDATE=y
CONFIG_MODULES_ROVER_POS_CONTROL=y
CONFIG_MODULES_SENSORS=y
CONFIG_MODULES_SIH=y
CONFIG_MODULES_SIMULATION_PWM_OUT_SIM=y
CONFIG_MODULES_SIMULATION_SIMULATOR_SIH=y
CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y

Some files were not shown because too many files have changed in this diff Show More