2020-07-28 03:23:28 -03:00
#!/usr/bin/env bash
2015-10-24 11:57:46 -03:00
2016-08-25 16:47:45 -03:00
set -e
2020-03-16 18:41:51 -03:00
if [ " $# " -lt 7 ] ; then
echo usage: sitl_run.sh sitl_bin debugger program model world src_path build_path
2020-03-06 10:55:14 -04:00
exit 1
fi
if [ [ -n " $DONT_RUN " ] ] ; then
echo "Not running simulation (DONT_RUN is set)."
2020-04-29 03:46:59 -03:00
exit 0
2020-03-06 10:55:14 -04:00
fi
2018-08-04 07:01:12 -03:00
sitl_bin = " $1 "
2018-08-31 12:20:36 -03:00
debugger = " $2 "
program = " $3 "
model = " $4 "
2020-03-16 18:41:51 -03:00
world = " $5 "
src_path = " $6 "
build_path = " $7 "
2018-11-23 11:29:17 -04:00
# The rest of the arguments are files to copy into the working dir.
2015-10-24 11:57:46 -03:00
echo SITL ARGS
2016-08-25 16:47:45 -03:00
echo sitl_bin: $sitl_bin
2015-10-24 11:57:46 -03:00
echo debugger: $debugger
echo program: $program
2015-10-29 06:35:35 -03:00
echo model: $model
2020-03-16 18:41:51 -03:00
echo world: $world
2016-08-25 16:47:45 -03:00
echo src_path: $src_path
2015-10-25 20:25:18 -03:00
echo build_path: $build_path
2015-10-24 11:57:46 -03:00
2018-08-04 07:01:12 -03:00
rootfs = " $build_path /tmp/rootfs " # this is the working directory
mkdir -p " $rootfs "
2015-12-22 04:48:11 -04:00
2016-11-25 12:04:12 -04:00
# To disable user input
if [ [ -n " $NO_PXH " ] ] ; then
no_pxh = -d
else
no_pxh = ""
fi
2018-09-14 08:19:18 -03:00
if [ " $model " != none ] ; then
jmavsim_pid = ` ps aux | grep java | grep "\-jar jmavsim_run.jar" | awk '{ print $2 }' `
2019-02-24 11:53:45 -04:00
if [ -n " $jmavsim_pid " ] ; then
2018-09-14 08:19:18 -03:00
kill $jmavsim_pid
fi
fi
2019-02-24 11:53:45 -04:00
if [ " $model " = = "" ] || [ " $model " = = "none" ] ; then
2015-10-29 06:35:35 -03:00
echo "empty model, setting iris as default"
model = "iris"
fi
2015-10-25 11:57:24 -03:00
# kill process names that might stil
# be running from last time
2017-01-18 05:16:34 -04:00
pkill -x gazebo || true
2019-11-02 11:27:07 -03:00
2019-12-07 05:10:51 -04:00
# Do NOT kill PX4 if debug in ide
2019-11-02 11:27:07 -03:00
if [ " $debugger " != "ide" ] ; then
pkill -x px4 || true
pkill -x px4_$model || true
fi
2017-01-18 05:16:34 -04:00
2018-11-23 13:55:44 -04:00
cp " $src_path /Tools/posix_lldbinit " " $rootfs /.lldbinit "
cp " $src_path /Tools/posix.gdbinit " " $rootfs /.gdbinit "
2015-10-23 18:58:28 -03:00
2020-03-16 18:41:51 -03:00
shift 7
2018-11-23 11:29:17 -04:00
for file in " $@ " ; do
cp " $file " $rootfs /
done
2015-10-23 18:58:28 -03:00
SIM_PID = 0
2019-02-24 11:53:45 -04:00
if [ " $program " = = "jmavsim" ] && [ ! -n " $no_sim " ] ; then
2018-08-04 07:01:12 -03:00
# Start Java simulator
2019-06-17 06:42:42 -03:00
" $src_path " /Tools/jmavsim_run.sh -r 250 -l &
2015-10-26 17:03:22 -03:00
SIM_PID = ` echo $! `
2019-02-24 11:53:45 -04:00
elif [ " $program " = = "gazebo" ] && [ ! -n " $no_sim " ] ; then
if [ -x " $( command -v gazebo) " ] ; then
2020-08-24 12:01:11 -03:00
# 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
2020-03-23 06:13:50 -03:00
# Set the plugin path so Gazebo finds our model and sim
source " $src_path /Tools/setup_gazebo.bash " " ${ src_path } " " ${ build_path } "
2020-03-16 18:41:51 -03:00
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 "
gzserver " ${ src_path } /Tools/sitl_gazebo/worlds/ ${ model } .world " &
else
echo "empty world, setting empty.world as default"
gzserver " ${ src_path } /Tools/sitl_gazebo/worlds/empty.world " &
fi
else
#Spawn empty world if world with model name doesn't exist
gzserver " ${ 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
gzserver " ${ src_path } /Tools/sitl_gazebo/worlds/ ${ PX4_SITL_WORLD } .world " &
else
# Spawn world from environment variable with absolute path
gzserver " $PX4_SITL_WORLD " &
fi
2020-03-23 06:13:50 -03:00
fi
2020-06-24 04:12:44 -03:00
SIM_PID = $!
2020-03-16 18:41:51 -03:00
2020-08-24 12:01:11 -03:00
while gz model --verbose --spawn-file= " ${ src_path } /Tools/sitl_gazebo/models/ ${ 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
2020-07-28 03:23:28 -03:00
echo "gzserver not ready yet, trying again!"
sleep 1
done
2017-09-14 06:51:02 -03:00
2020-03-23 06:13:50 -03:00
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 &
GUI_PID = ` echo $! `
2016-04-24 19:48:56 -03:00
fi
2015-10-22 11:30:23 -03:00
else
echo "You need to have gazebo simulator installed!"
exit 1
fi
2020-04-29 03:46:59 -03:00
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 = ` echo $! `
2015-10-17 12:41:57 -03:00
fi
2016-01-28 17:28:36 -04:00
2018-08-04 07:01:12 -03:00
pushd " $rootfs " >/dev/null
2015-11-23 08:51:18 -04:00
# Do not exit on failure now from here on because we want the complete cleanup
set +e
2018-08-30 11:30:37 -03:00
if [ [ ${ model } = = test_* ] ] || [ [ ${ model } = = *_generated ] ] ; then
2018-11-23 13:55:44 -04:00
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 "
2018-08-04 07:01:12 -03:00
else
2018-11-23 13:55:44 -04:00
sitl_command = " \" $sitl_bin \" $no_pxh \" $src_path \"/ROMFS/px4fmu_common -s etc/init.d-posix/rcS -t \" $src_path \"/test_data "
2018-08-04 07:01:12 -03:00
fi
2016-08-25 16:47:45 -03:00
echo SITL COMMAND: $sitl_command
add posix shell
squashed & rebased version, not including:
- listener changes
- src/firmware renaming
Commits:
tag_to_version.py: fix Python3 error
subprocess.communicate returns bytes instead of a str which is not the
same for Python3. Therefore, we need to decode the bytes.
cmake: remove folder src/firmware
The folder src/firmware was not intuitive. Why would the binaries for
SITL be inside a src and why even inside a src/firmware folder. Also,
the rootfs was put there which made it even more confusing.
The CMakeLists.txt files are moved into cmake/ and get now called from
the main CMakeLists.txt.
qshell: support for return value
Instead of just sending commands, qshell will now also wait until
the command has finished on QURT and sent back a return value. This will
allow all modules on the DSP side to be spawned from the Linux side
meaning that we only need one config/startup file instead of two.
adb_upload: create folders before pushing
Previously the script failed if the folder on the destination was not
already existing. This therefore makes pushing easier.
posix: spawn PX4 modules in bash
This adds the possibility to spawn PX4 modules out of bash. Basically,
the main executable can now be started as a server/daemon or as a
client.
The server replaces the existing functionality of the main exe with
the pxh shell, however, it also opens a pipe that clients can talk to.
Clients can run or spawn PX4 modules or commands by connecting to the
server over the pipe. They clients will get the stdout and return value
of their commands via a client specific pipe back.
This work will allow to start all modules using a bash script similar to
the way it is done in NuttX where the NuttShell scripts the startup
scripts and starts the modules.
SITL: use new client shell in SITL
This is a first step to use the new shell capabilities for SITL.
The new startup bash script rcS merges (and therefore replaces) the two
existing scripts rcS_gazebo_iris and rcS_jmavsim_iris.
More cleanup will be necessary for the rest of the SITL startup scripts.
Snapdragon: use new shell to start all modules
Instead of different mainapp.config and px4.config files, we can now use
a unified rcS bash script which starts all the modules based on
parameters, mainly the SYS_AUTOSTART param.
Snapdragon: fix the airframe description
pxh: argv needs to end with a nullptr
The comment was wrong that argv needs an additional 0 termination.
Instead it needs a nullptr at the end.
px4_posix_tasks: variable cleanup
The px4_task_spawn_cmd function got a cleanup while debugging, however,
no functional changes.
Snapdragon: move some drivers to 4100 config
These drivers are supported by the community, so they go into the 4100
config.
Snapdragon: update 210qc platform
px4_daemon: use doxygen comments
apps.h_in: fix string printf: use .c_str()
px4_daemon: \b -> \n in printf
px4_daemon: handle error in generate_uuid (close the file on error)
posix main: some clarifications in comment (it's the symlinks not the script aliases)
cmake: remove new install command again
This one was probably wrong and untested. Installing needs revisiting.
POSIX: remove argument USES_TERMINAL
POSIX: copy init and mixer files for SITL
Instead of using non-working install commands, the mixer and startup
files are now copied as part of the build in cmake.
adb_upload.sh: remove leftover commented printf
POSIX main: just the pointer instead of memmove
POSIX main: remove chroot
chroot is removed because it hasn't been used anywhere and seems
untested.
px4_daemon: remove client pipe when cleaning up
px4_daemon: fail if the client pipe already exists
The client pipe is supposed to be specific (by UUID), so the path
shouldn't exist already.
history: limit the number of history entries
This is a protection to avoid filling the memory if we are entering a
lot of commands (e.g. auto-generated).
px4_daemon: add a threadsafe map and use it
px4_daemon: whitespace
px4_daemon: fix client parsing
Sometimes the client ends up reading more than one packet in one read.
The parsing is not made for this and would require a (ring)buffer for
it.
The solution of this commit just reads as much as needed from the pipe
which avoids having to do buffering and parsing.
posix: changes sitl_run.sh and main.cpp cleanup
This changes the paths in sitl_run.sh quite a bit to allow the px4
binary to run in the rootfs directory which should make it convenient
and very close to the NuttX variant.
Also main.cpp got a big cleanup after the big rebase with some
conflicts. Quite some functionality was removed but it has yet to be
seen if it needs to be re-added.
px4_log: cleanup log levels, now they make sense
Before DEBUG and INFO log levels where inverted which didn't make much
sense in my eyes.
dataman: fix path for bash shell
logger: fix paths for bash shell
mavlink: fix paths for bash shell
param: fix path for bash shell
inav: fix paths for bash shell
sdlog2: fix paths for bash shell
ROMFS: add forgotten mixer to list
SITL init: more models, more options
- Support for different models using the unified startup
script rcS.
- Support to choose the estimator by setting the environment variable
PX4_ESTIMATOR.
- Support to choose the logger by setting the environment variable
PX4_LOGGER.
rcS: fix string comparison
listener: use template file
Instead of having all of the C++ code inside the Python file it is
nicer to have a separate template file with the C++ headers, etc.
px4_log: add PX4_INFO_RAW for raw printfs
This allows to do custom formatting but is still transported over
sockets to clients.
topic_listener: use PX4_INFO_RAW instead of printf
commander: use PX4_INFO_RAW for status
listener: rewrite to classes and factory
posix: fix some argument warnings
generate_listener.py: by accident changed shebang
listener: big refactor of the generator
Hopefully this makes it easier to read and change in the future.
rcS: manually take over rebase changes
listener: remove leftover try
listener: properly clean up topic instance
rcS: take over some vehicle specific changes
posix-configs: vehicle specifics to separate files
posix-configs: remove leftover lines
uORBDevices: new PX4_INFO_RAW instead of printf
px4_log: just use printf on NuttX
listener: use less binary space, strip on NuttX
generate_listener.py: remove commented code
cmake: fix syntax error from merge
px4_daemon: fixes after rebase of apps.h/cpp fix
px4_daemon: namespace missing
posix: only create stub for fsync on QURT
unitests: reduce dependencies of param test
This makes the unit test compile and link again after the bash changes.
QURT: some compile fixes after a rebase
SITL: arg change for sitl_run.sh to use rcS_test
This allows to use a custom startup file for testing.
SITL: add the folder test_data
SITL: implement shutdown command as systemcmd
The shutdown command needs to be a proper systemcmd, otherwise the alias
and symlink generation doesn't work and we end up calling shutdown of
the host computer which is to be avoided.
px4fmu_test: same IO_pass mixer as px4fmu_default
px4fmu_test: use normal quad x mixer
There is no good reason to use a specific test mixer, except more cmake
code around it. Therefore just use the same mixer as default, and at
some point px4fmu_test and px4fmu_default can get merged
POSIX: cleanup, dir and symlink fixes
This cleans up the logic behind the symlinking and creating directories.
POSIX: correct arg order in usage info
tests: fix paths for SITL tests
POSIX: printf fix
sitl_run.sh: try to make this run on Mac as well
cmake: try to make jenkins happier
Path cleanup, the bin is no longer in src/firmware
POSIX: fix symlink logic
SITL: prefix all exported env variables
cmake: fix path for ROS tests
integrationtests: fix log path
launch: try to make tets with ROS working again
px4_defines: fix after wrong merge deconflicting
px4_defines: get paths for POSIX correct
cmake: fix cmake arguments
This was fine with cmake 3.6 but did not work with cmake 3.2.2
cmake: use cp instead of cmake -E copy
cmake -E copy does not support copying multiple files with versions <
3.5. Therefore, just use cp for now.
ROMFS: fix build error after rebase
cmake: fix paths in configs
launch: use `spawn_model` again
cmake: various fixes after big rebase
param: path fixes after rebase
posix platform: fixes after rebase
test_mixer: fix screwed up rebase
2018-08-02 16:32:51 -03:00
export PX4_SIM_MODEL = ${ model }
2020-03-06 10:55:14 -04:00
if [ " $debugger " = = "lldb" ] ; then
2019-01-08 17:11:19 -04:00
eval lldb -- $sitl_command
2019-02-24 11:53:45 -04:00
elif [ " $debugger " = = "gdb" ] ; then
2019-01-08 17:11:19 -04:00
eval gdb --args $sitl_command
2019-02-24 11:53:45 -04:00
elif [ " $debugger " = = "ddd" ] ; then
2019-01-08 17:11:19 -04:00
eval ddd --debugger gdb --args $sitl_command
2019-02-24 11:53:45 -04:00
elif [ " $debugger " = = "valgrind" ] ; then
2019-01-08 17:11:19 -04:00
eval valgrind --track-origins= yes --leak-check= full -v $sitl_command
2019-02-24 11:53:45 -04:00
elif [ " $debugger " = = "callgrind" ] ; then
2019-01-08 17:11:19 -04:00
eval valgrind --tool= callgrind -v $sitl_command
2019-02-24 11:53:45 -04:00
elif [ " $debugger " = = "ide" ] ; then
2016-12-08 00:41:46 -04:00
echo "######################################################################"
echo
echo " PX4 simulator not started, use your IDE to start PX4_ ${ model } target. "
echo "Hit enter to quit..."
echo
echo "######################################################################"
read
2015-09-20 07:54:22 -03:00
else
add posix shell
squashed & rebased version, not including:
- listener changes
- src/firmware renaming
Commits:
tag_to_version.py: fix Python3 error
subprocess.communicate returns bytes instead of a str which is not the
same for Python3. Therefore, we need to decode the bytes.
cmake: remove folder src/firmware
The folder src/firmware was not intuitive. Why would the binaries for
SITL be inside a src and why even inside a src/firmware folder. Also,
the rootfs was put there which made it even more confusing.
The CMakeLists.txt files are moved into cmake/ and get now called from
the main CMakeLists.txt.
qshell: support for return value
Instead of just sending commands, qshell will now also wait until
the command has finished on QURT and sent back a return value. This will
allow all modules on the DSP side to be spawned from the Linux side
meaning that we only need one config/startup file instead of two.
adb_upload: create folders before pushing
Previously the script failed if the folder on the destination was not
already existing. This therefore makes pushing easier.
posix: spawn PX4 modules in bash
This adds the possibility to spawn PX4 modules out of bash. Basically,
the main executable can now be started as a server/daemon or as a
client.
The server replaces the existing functionality of the main exe with
the pxh shell, however, it also opens a pipe that clients can talk to.
Clients can run or spawn PX4 modules or commands by connecting to the
server over the pipe. They clients will get the stdout and return value
of their commands via a client specific pipe back.
This work will allow to start all modules using a bash script similar to
the way it is done in NuttX where the NuttShell scripts the startup
scripts and starts the modules.
SITL: use new client shell in SITL
This is a first step to use the new shell capabilities for SITL.
The new startup bash script rcS merges (and therefore replaces) the two
existing scripts rcS_gazebo_iris and rcS_jmavsim_iris.
More cleanup will be necessary for the rest of the SITL startup scripts.
Snapdragon: use new shell to start all modules
Instead of different mainapp.config and px4.config files, we can now use
a unified rcS bash script which starts all the modules based on
parameters, mainly the SYS_AUTOSTART param.
Snapdragon: fix the airframe description
pxh: argv needs to end with a nullptr
The comment was wrong that argv needs an additional 0 termination.
Instead it needs a nullptr at the end.
px4_posix_tasks: variable cleanup
The px4_task_spawn_cmd function got a cleanup while debugging, however,
no functional changes.
Snapdragon: move some drivers to 4100 config
These drivers are supported by the community, so they go into the 4100
config.
Snapdragon: update 210qc platform
px4_daemon: use doxygen comments
apps.h_in: fix string printf: use .c_str()
px4_daemon: \b -> \n in printf
px4_daemon: handle error in generate_uuid (close the file on error)
posix main: some clarifications in comment (it's the symlinks not the script aliases)
cmake: remove new install command again
This one was probably wrong and untested. Installing needs revisiting.
POSIX: remove argument USES_TERMINAL
POSIX: copy init and mixer files for SITL
Instead of using non-working install commands, the mixer and startup
files are now copied as part of the build in cmake.
adb_upload.sh: remove leftover commented printf
POSIX main: just the pointer instead of memmove
POSIX main: remove chroot
chroot is removed because it hasn't been used anywhere and seems
untested.
px4_daemon: remove client pipe when cleaning up
px4_daemon: fail if the client pipe already exists
The client pipe is supposed to be specific (by UUID), so the path
shouldn't exist already.
history: limit the number of history entries
This is a protection to avoid filling the memory if we are entering a
lot of commands (e.g. auto-generated).
px4_daemon: add a threadsafe map and use it
px4_daemon: whitespace
px4_daemon: fix client parsing
Sometimes the client ends up reading more than one packet in one read.
The parsing is not made for this and would require a (ring)buffer for
it.
The solution of this commit just reads as much as needed from the pipe
which avoids having to do buffering and parsing.
posix: changes sitl_run.sh and main.cpp cleanup
This changes the paths in sitl_run.sh quite a bit to allow the px4
binary to run in the rootfs directory which should make it convenient
and very close to the NuttX variant.
Also main.cpp got a big cleanup after the big rebase with some
conflicts. Quite some functionality was removed but it has yet to be
seen if it needs to be re-added.
px4_log: cleanup log levels, now they make sense
Before DEBUG and INFO log levels where inverted which didn't make much
sense in my eyes.
dataman: fix path for bash shell
logger: fix paths for bash shell
mavlink: fix paths for bash shell
param: fix path for bash shell
inav: fix paths for bash shell
sdlog2: fix paths for bash shell
ROMFS: add forgotten mixer to list
SITL init: more models, more options
- Support for different models using the unified startup
script rcS.
- Support to choose the estimator by setting the environment variable
PX4_ESTIMATOR.
- Support to choose the logger by setting the environment variable
PX4_LOGGER.
rcS: fix string comparison
listener: use template file
Instead of having all of the C++ code inside the Python file it is
nicer to have a separate template file with the C++ headers, etc.
px4_log: add PX4_INFO_RAW for raw printfs
This allows to do custom formatting but is still transported over
sockets to clients.
topic_listener: use PX4_INFO_RAW instead of printf
commander: use PX4_INFO_RAW for status
listener: rewrite to classes and factory
posix: fix some argument warnings
generate_listener.py: by accident changed shebang
listener: big refactor of the generator
Hopefully this makes it easier to read and change in the future.
rcS: manually take over rebase changes
listener: remove leftover try
listener: properly clean up topic instance
rcS: take over some vehicle specific changes
posix-configs: vehicle specifics to separate files
posix-configs: remove leftover lines
uORBDevices: new PX4_INFO_RAW instead of printf
px4_log: just use printf on NuttX
listener: use less binary space, strip on NuttX
generate_listener.py: remove commented code
cmake: fix syntax error from merge
px4_daemon: fixes after rebase of apps.h/cpp fix
px4_daemon: namespace missing
posix: only create stub for fsync on QURT
unitests: reduce dependencies of param test
This makes the unit test compile and link again after the bash changes.
QURT: some compile fixes after a rebase
SITL: arg change for sitl_run.sh to use rcS_test
This allows to use a custom startup file for testing.
SITL: add the folder test_data
SITL: implement shutdown command as systemcmd
The shutdown command needs to be a proper systemcmd, otherwise the alias
and symlink generation doesn't work and we end up calling shutdown of
the host computer which is to be avoided.
px4fmu_test: same IO_pass mixer as px4fmu_default
px4fmu_test: use normal quad x mixer
There is no good reason to use a specific test mixer, except more cmake
code around it. Therefore just use the same mixer as default, and at
some point px4fmu_test and px4fmu_default can get merged
POSIX: cleanup, dir and symlink fixes
This cleans up the logic behind the symlinking and creating directories.
POSIX: correct arg order in usage info
tests: fix paths for SITL tests
POSIX: printf fix
sitl_run.sh: try to make this run on Mac as well
cmake: try to make jenkins happier
Path cleanup, the bin is no longer in src/firmware
POSIX: fix symlink logic
SITL: prefix all exported env variables
cmake: fix path for ROS tests
integrationtests: fix log path
launch: try to make tets with ROS working again
px4_defines: fix after wrong merge deconflicting
px4_defines: get paths for POSIX correct
cmake: fix cmake arguments
This was fine with cmake 3.6 but did not work with cmake 3.2.2
cmake: use cp instead of cmake -E copy
cmake -E copy does not support copying multiple files with versions <
3.5. Therefore, just use cp for now.
ROMFS: fix build error after rebase
cmake: fix paths in configs
launch: use `spawn_model` again
cmake: various fixes after big rebase
param: path fixes after rebase
posix platform: fixes after rebase
test_mixer: fix screwed up rebase
2018-08-02 16:32:51 -03:00
eval $sitl_command
2015-09-20 07:54:22 -03:00
fi
2015-10-23 18:58:28 -03:00
2018-08-04 07:01:12 -03:00
popd >/dev/null
add posix shell
squashed & rebased version, not including:
- listener changes
- src/firmware renaming
Commits:
tag_to_version.py: fix Python3 error
subprocess.communicate returns bytes instead of a str which is not the
same for Python3. Therefore, we need to decode the bytes.
cmake: remove folder src/firmware
The folder src/firmware was not intuitive. Why would the binaries for
SITL be inside a src and why even inside a src/firmware folder. Also,
the rootfs was put there which made it even more confusing.
The CMakeLists.txt files are moved into cmake/ and get now called from
the main CMakeLists.txt.
qshell: support for return value
Instead of just sending commands, qshell will now also wait until
the command has finished on QURT and sent back a return value. This will
allow all modules on the DSP side to be spawned from the Linux side
meaning that we only need one config/startup file instead of two.
adb_upload: create folders before pushing
Previously the script failed if the folder on the destination was not
already existing. This therefore makes pushing easier.
posix: spawn PX4 modules in bash
This adds the possibility to spawn PX4 modules out of bash. Basically,
the main executable can now be started as a server/daemon or as a
client.
The server replaces the existing functionality of the main exe with
the pxh shell, however, it also opens a pipe that clients can talk to.
Clients can run or spawn PX4 modules or commands by connecting to the
server over the pipe. They clients will get the stdout and return value
of their commands via a client specific pipe back.
This work will allow to start all modules using a bash script similar to
the way it is done in NuttX where the NuttShell scripts the startup
scripts and starts the modules.
SITL: use new client shell in SITL
This is a first step to use the new shell capabilities for SITL.
The new startup bash script rcS merges (and therefore replaces) the two
existing scripts rcS_gazebo_iris and rcS_jmavsim_iris.
More cleanup will be necessary for the rest of the SITL startup scripts.
Snapdragon: use new shell to start all modules
Instead of different mainapp.config and px4.config files, we can now use
a unified rcS bash script which starts all the modules based on
parameters, mainly the SYS_AUTOSTART param.
Snapdragon: fix the airframe description
pxh: argv needs to end with a nullptr
The comment was wrong that argv needs an additional 0 termination.
Instead it needs a nullptr at the end.
px4_posix_tasks: variable cleanup
The px4_task_spawn_cmd function got a cleanup while debugging, however,
no functional changes.
Snapdragon: move some drivers to 4100 config
These drivers are supported by the community, so they go into the 4100
config.
Snapdragon: update 210qc platform
px4_daemon: use doxygen comments
apps.h_in: fix string printf: use .c_str()
px4_daemon: \b -> \n in printf
px4_daemon: handle error in generate_uuid (close the file on error)
posix main: some clarifications in comment (it's the symlinks not the script aliases)
cmake: remove new install command again
This one was probably wrong and untested. Installing needs revisiting.
POSIX: remove argument USES_TERMINAL
POSIX: copy init and mixer files for SITL
Instead of using non-working install commands, the mixer and startup
files are now copied as part of the build in cmake.
adb_upload.sh: remove leftover commented printf
POSIX main: just the pointer instead of memmove
POSIX main: remove chroot
chroot is removed because it hasn't been used anywhere and seems
untested.
px4_daemon: remove client pipe when cleaning up
px4_daemon: fail if the client pipe already exists
The client pipe is supposed to be specific (by UUID), so the path
shouldn't exist already.
history: limit the number of history entries
This is a protection to avoid filling the memory if we are entering a
lot of commands (e.g. auto-generated).
px4_daemon: add a threadsafe map and use it
px4_daemon: whitespace
px4_daemon: fix client parsing
Sometimes the client ends up reading more than one packet in one read.
The parsing is not made for this and would require a (ring)buffer for
it.
The solution of this commit just reads as much as needed from the pipe
which avoids having to do buffering and parsing.
posix: changes sitl_run.sh and main.cpp cleanup
This changes the paths in sitl_run.sh quite a bit to allow the px4
binary to run in the rootfs directory which should make it convenient
and very close to the NuttX variant.
Also main.cpp got a big cleanup after the big rebase with some
conflicts. Quite some functionality was removed but it has yet to be
seen if it needs to be re-added.
px4_log: cleanup log levels, now they make sense
Before DEBUG and INFO log levels where inverted which didn't make much
sense in my eyes.
dataman: fix path for bash shell
logger: fix paths for bash shell
mavlink: fix paths for bash shell
param: fix path for bash shell
inav: fix paths for bash shell
sdlog2: fix paths for bash shell
ROMFS: add forgotten mixer to list
SITL init: more models, more options
- Support for different models using the unified startup
script rcS.
- Support to choose the estimator by setting the environment variable
PX4_ESTIMATOR.
- Support to choose the logger by setting the environment variable
PX4_LOGGER.
rcS: fix string comparison
listener: use template file
Instead of having all of the C++ code inside the Python file it is
nicer to have a separate template file with the C++ headers, etc.
px4_log: add PX4_INFO_RAW for raw printfs
This allows to do custom formatting but is still transported over
sockets to clients.
topic_listener: use PX4_INFO_RAW instead of printf
commander: use PX4_INFO_RAW for status
listener: rewrite to classes and factory
posix: fix some argument warnings
generate_listener.py: by accident changed shebang
listener: big refactor of the generator
Hopefully this makes it easier to read and change in the future.
rcS: manually take over rebase changes
listener: remove leftover try
listener: properly clean up topic instance
rcS: take over some vehicle specific changes
posix-configs: vehicle specifics to separate files
posix-configs: remove leftover lines
uORBDevices: new PX4_INFO_RAW instead of printf
px4_log: just use printf on NuttX
listener: use less binary space, strip on NuttX
generate_listener.py: remove commented code
cmake: fix syntax error from merge
px4_daemon: fixes after rebase of apps.h/cpp fix
px4_daemon: namespace missing
posix: only create stub for fsync on QURT
unitests: reduce dependencies of param test
This makes the unit test compile and link again after the bash changes.
QURT: some compile fixes after a rebase
SITL: arg change for sitl_run.sh to use rcS_test
This allows to use a custom startup file for testing.
SITL: add the folder test_data
SITL: implement shutdown command as systemcmd
The shutdown command needs to be a proper systemcmd, otherwise the alias
and symlink generation doesn't work and we end up calling shutdown of
the host computer which is to be avoided.
px4fmu_test: same IO_pass mixer as px4fmu_default
px4fmu_test: use normal quad x mixer
There is no good reason to use a specific test mixer, except more cmake
code around it. Therefore just use the same mixer as default, and at
some point px4fmu_test and px4fmu_default can get merged
POSIX: cleanup, dir and symlink fixes
This cleans up the logic behind the symlinking and creating directories.
POSIX: correct arg order in usage info
tests: fix paths for SITL tests
POSIX: printf fix
sitl_run.sh: try to make this run on Mac as well
cmake: try to make jenkins happier
Path cleanup, the bin is no longer in src/firmware
POSIX: fix symlink logic
SITL: prefix all exported env variables
cmake: fix path for ROS tests
integrationtests: fix log path
launch: try to make tets with ROS working again
px4_defines: fix after wrong merge deconflicting
px4_defines: get paths for POSIX correct
cmake: fix cmake arguments
This was fine with cmake 3.6 but did not work with cmake 3.2.2
cmake: use cp instead of cmake -E copy
cmake -E copy does not support copying multiple files with versions <
3.5. Therefore, just use cp for now.
ROMFS: fix build error after rebase
cmake: fix paths in configs
launch: use `spawn_model` again
cmake: various fixes after big rebase
param: path fixes after rebase
posix platform: fixes after rebase
test_mixer: fix screwed up rebase
2018-08-02 16:32:51 -03:00
2020-03-06 10:55:14 -04:00
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
2016-04-24 19:48:56 -03:00
fi
2020-04-29 03:46:59 -03:00
elif [ " $program " = = "flightgear" ] ; then
kill $FG_BRIDGE_PID
kill -9 ` cat /tmp/px4fgfspid_0`
2015-10-23 18:58:28 -03:00
fi