forked from Archive/PX4-Autopilot
run tests in posix sitl with gazebo
This commit is contained in:
parent
d85e7732b4
commit
d804f5727e
25
Makefile
25
Makefile
|
@ -114,6 +114,12 @@ define cmake-build
|
||||||
+@(echo "PX4 CONFIG: $@" && cd $(PWD)/build_$@ && $(PX4_MAKE) $(PX4_MAKE_ARGS) $(ARGS))
|
+@(echo "PX4 CONFIG: $@" && cd $(PWD)/build_$@ && $(PX4_MAKE) $(PX4_MAKE_ARGS) $(ARGS))
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
define cmake-build-other
|
||||||
|
+@if [ $(PX4_CMAKE_GENERATOR) = "Ninja" ] && [ -e $(PWD)/build_$@/Makefile ]; then rm -rf $(PWD)/build_$@; fi
|
||||||
|
+@if [ ! -e $(PWD)/build_$@/CMakeCache.txt ]; then Tools/check_submodules.sh && mkdir -p $(PWD)/build_$@ && cd $(PWD)/build_$@ && cmake $(2) -G$(PX4_CMAKE_GENERATOR) || (cd .. && rm -rf $(PWD)/build_$@); fi
|
||||||
|
+@(cd $(PWD)/build_$@ && $(PX4_MAKE) $(PX4_MAKE_ARGS) $(ARGS))
|
||||||
|
endef
|
||||||
|
|
||||||
# create empty targets to avoid msgs for targets passed to cmake
|
# create empty targets to avoid msgs for targets passed to cmake
|
||||||
define cmake-targ
|
define cmake-targ
|
||||||
$(1):
|
$(1):
|
||||||
|
@ -219,8 +225,14 @@ run_sitl_ros: sitl_deprecation
|
||||||
# Other targets
|
# Other targets
|
||||||
# --------------------------------------------------------------------
|
# --------------------------------------------------------------------
|
||||||
|
|
||||||
.PHONY: uavcan_firmware check check_format unittest tests package_firmware clean submodulesclean distclean
|
.PHONY: gazebo_build uavcan_firmware check check_format unittest tests package_firmware clean submodulesclean distclean
|
||||||
.NOTPARALLEL: uavcan_firmware check check_format unittest tests package_firmware clean submodulesclean distclean
|
.NOTPARALLEL: gazebo_build uavcan_firmware check check_format unittest tests package_firmware clean submodulesclean distclean
|
||||||
|
|
||||||
|
gazebo_build:
|
||||||
|
@mkdir -p build_gazebo
|
||||||
|
@if [ ! -e $(PWD)/build_gazebo/CMakeCache.txt ];then cd build_gazebo && cmake -Wno-dev -G$(PX4_CMAKE_GENERATOR) $(PWD)/Tools/sitl_gazebo; fi
|
||||||
|
@cd build_gazebo && $(PX4_MAKE) $(PX4_MAKE_ARGS)
|
||||||
|
@cd build_gazebo && $(PX4_MAKE) $(PX4_MAKE_ARGS) sdf
|
||||||
|
|
||||||
uavcan_firmware:
|
uavcan_firmware:
|
||||||
ifeq ($(VECTORCONTROL),1)
|
ifeq ($(VECTORCONTROL),1)
|
||||||
|
@ -251,7 +263,14 @@ ifeq ($(VECTORCONTROL),1)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
unittest: posix_sitl_test
|
unittest: posix_sitl_test
|
||||||
@(mkdir -p build_unittests && cd build_unittests && cmake -G$(PX4_CMAKE_GENERATOR) ../unittests && $(PX4_MAKE) $(PX4_MAKE_ARGS) && ctest -j2 --output-on-failure)
|
export CC=clang
|
||||||
|
export CXX=clang++
|
||||||
|
export ASAN_OPTIONS=symbolize=1
|
||||||
|
$(call cmake-build-other,unittest, ../unittests)
|
||||||
|
@(cd build_unittest && ctest -j2 --output-on-failure)
|
||||||
|
|
||||||
|
test_onboard_sitl:
|
||||||
|
@HEADLESS=1 make posix_sitl_test gazebo_iris
|
||||||
|
|
||||||
package_firmware:
|
package_firmware:
|
||||||
@zip --junk-paths Firmware.zip `find . -name \*.px4`
|
@zip --junk-paths Firmware.zip `find . -name \*.px4`
|
||||||
|
|
|
@ -58,7 +58,7 @@ cp Tools/posix.gdbinit $build_path/src/firmware/posix/.gdbinit
|
||||||
|
|
||||||
SIM_PID=0
|
SIM_PID=0
|
||||||
|
|
||||||
if [ "$program" == "jmavsim" ] && [ "$no_sim" == "" ]
|
if [ "$program" == "jmavsim" ] && [ ! -n "$no_sim" ]
|
||||||
then
|
then
|
||||||
cd Tools/jMAVSim
|
cd Tools/jMAVSim
|
||||||
ant create_run_jar copy_res
|
ant create_run_jar copy_res
|
||||||
|
@ -66,31 +66,33 @@ then
|
||||||
java -Djava.ext.dirs= -jar jmavsim_run.jar -udp 127.0.0.1:14560 &
|
java -Djava.ext.dirs= -jar jmavsim_run.jar -udp 127.0.0.1:14560 &
|
||||||
SIM_PID=`echo $!`
|
SIM_PID=`echo $!`
|
||||||
cd ../..
|
cd ../..
|
||||||
elif [ "$program" == "gazebo" ] && [ "$no_sim" == "" ]
|
elif [ "$program" == "gazebo" ] && [ ! -n "$no_sim" ]
|
||||||
then
|
then
|
||||||
if [ -x "$(command -v gazebo)" ]
|
if [ -x "$(command -v gazebo)" ]
|
||||||
then
|
then
|
||||||
# Set the plugin path so Gazebo finds our model and sim
|
# Set the plugin path so Gazebo finds our model and sim
|
||||||
export GAZEBO_PLUGIN_PATH=$curr_dir/Tools/sitl_gazebo/Build:${GAZEBO_PLUGIN_PATH}
|
export GAZEBO_PLUGIN_PATH=$curr_dir/build_gazebo:${GAZEBO_PLUGIN_PATH}
|
||||||
# Set the model path so Gazebo finds the airframes
|
# Set the model path so Gazebo finds the airframes
|
||||||
export GAZEBO_MODEL_PATH=${GAZEBO_MODEL_PATH}:$curr_dir/Tools/sitl_gazebo/models
|
export GAZEBO_MODEL_PATH=${GAZEBO_MODEL_PATH}:$curr_dir/Tools/sitl_gazebo/models
|
||||||
# The next line would disable online model lookup, can be commented in, in case of unstable behaviour.
|
# The next line would disable online model lookup, can be commented in, in case of unstable behaviour.
|
||||||
# export GAZEBO_MODEL_DATABASE_URI=""
|
# export GAZEBO_MODEL_DATABASE_URI=""
|
||||||
export SITL_GAZEBO_PATH=$curr_dir/Tools/sitl_gazebo
|
export SITL_GAZEBO_PATH=$curr_dir/Tools/sitl_gazebo
|
||||||
mkdir -p Tools/sitl_gazebo/Build
|
make --no-print-directory gazebo_build
|
||||||
cd Tools/sitl_gazebo/Build
|
|
||||||
cmake -Wno-dev ..
|
gzserver --verbose $curr_dir/Tools/sitl_gazebo/worlds/${model}.world &
|
||||||
make -j4
|
|
||||||
make sdf
|
|
||||||
gzserver --verbose ../worlds/${model}.world &
|
|
||||||
SIM_PID=`echo $!`
|
SIM_PID=`echo $!`
|
||||||
gzclient --verbose &
|
|
||||||
GUI_PID=`echo $!`
|
if [[ -n "$HEADLESS" ]]; then
|
||||||
|
echo "not running gazebo gui"
|
||||||
|
else
|
||||||
|
gzclient --verbose &
|
||||||
|
GUI_PID=`echo $!`
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "You need to have gazebo simulator installed!"
|
echo "You need to have gazebo simulator installed!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
elif [ "$program" == "replay" ] && [ "$no_sim" == "" ]
|
elif [ "$program" == "replay" ] && [ ! -n "$no_sim" ]
|
||||||
then
|
then
|
||||||
echo "Replaying logfile: $logfile"
|
echo "Replaying logfile: $logfile"
|
||||||
# This is not a simulator, but a log file to replay
|
# This is not a simulator, but a log file to replay
|
||||||
|
@ -135,5 +137,7 @@ then
|
||||||
elif [ "$program" == "gazebo" ]
|
elif [ "$program" == "gazebo" ]
|
||||||
then
|
then
|
||||||
kill -9 $SIM_PID
|
kill -9 $SIM_PID
|
||||||
kill -9 $GUI_PID
|
if [[ ! -n "$HEADLESS" ]]; then
|
||||||
|
kill -9 $GUI_PID
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -87,7 +87,7 @@ set(config_extra_builtin_cmds
|
||||||
)
|
)
|
||||||
|
|
||||||
set(config_sitl_rcS
|
set(config_sitl_rcS
|
||||||
posix-configs/SITL/init/rcS
|
posix-configs/SITL/init/rcS_test
|
||||||
CACHE FILEPATH "init script for sitl"
|
CACHE FILEPATH "init script for sitl"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
uorb start
|
||||||
|
param load
|
||||||
|
|
||||||
|
dataman start
|
||||||
|
|
||||||
|
simulator start -s
|
||||||
|
rgbledsim start
|
||||||
|
tone_alarm start
|
||||||
|
gyrosim start
|
||||||
|
accelsim start
|
||||||
|
barosim start
|
||||||
|
adcsim start
|
||||||
|
gpssim start
|
||||||
|
pwm_out_sim mode_pwm
|
||||||
|
sleep 1
|
||||||
|
sensors start
|
||||||
|
|
||||||
|
commander_tests
|
||||||
|
controllib_test
|
||||||
|
uorb_tests
|
||||||
|
tests all
|
||||||
|
|
||||||
|
ver all
|
||||||
|
|
||||||
|
shutdown
|
|
@ -14,7 +14,6 @@ gpssim start
|
||||||
pwm_out_sim mode_pwm
|
pwm_out_sim mode_pwm
|
||||||
sleep 1
|
sleep 1
|
||||||
sensors start
|
sensors start
|
||||||
commander start
|
|
||||||
|
|
||||||
commander_tests
|
commander_tests
|
||||||
controllib_test
|
controllib_test
|
||||||
|
@ -22,3 +21,5 @@ uorb_tests
|
||||||
tests all
|
tests all
|
||||||
|
|
||||||
ver all
|
ver all
|
||||||
|
|
||||||
|
shutdown
|
||||||
|
|
Loading…
Reference in New Issue