2015-04-28 01:58:54 -03:00
|
|
|
/****************************************************************************
|
|
|
|
*
|
2016-06-02 11:19:21 -03:00
|
|
|
* Copyright (C) 2015-2016 PX4 Development Team. All rights reserved.
|
2015-04-28 01:58:54 -03:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
*
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in
|
|
|
|
* the documentation and/or other materials provided with the
|
|
|
|
* distribution.
|
|
|
|
* 3. Neither the name PX4 nor the names of its contributors may be
|
|
|
|
* used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
|
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
|
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
|
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
|
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/**
|
2019-10-25 05:56:32 -03:00
|
|
|
* @file log.h
|
2015-06-17 17:28:27 -03:00
|
|
|
* Platform dependant logging/debug implementation
|
2015-04-28 01:58:54 -03:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
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
|
|
|
#define _PX4_LOG_LEVEL_DEBUG 0
|
|
|
|
#define _PX4_LOG_LEVEL_INFO 1
|
2015-08-26 01:59:01 -03:00
|
|
|
#define _PX4_LOG_LEVEL_WARN 2
|
|
|
|
#define _PX4_LOG_LEVEL_ERROR 3
|
|
|
|
#define _PX4_LOG_LEVEL_PANIC 4
|
|
|
|
|
|
|
|
// Used to silence unused variable warning
|
|
|
|
static inline void do_nothing(int level, ...)
|
|
|
|
{
|
|
|
|
(void)level;
|
|
|
|
}
|
|
|
|
|
2016-08-12 14:41:31 -03:00
|
|
|
__BEGIN_DECLS
|
|
|
|
|
|
|
|
/**
|
|
|
|
* initialize the orb logging. Logging to console still works without or before calling this.
|
|
|
|
*/
|
|
|
|
__EXPORT extern void px4_log_initialize(void);
|
|
|
|
|
|
|
|
__END_DECLS
|
2016-06-02 11:19:21 -03:00
|
|
|
|
2015-08-26 01:59:01 -03:00
|
|
|
/****************************************************************************
|
|
|
|
* __px4_log_omit:
|
|
|
|
* Compile out the message
|
|
|
|
****************************************************************************/
|
|
|
|
#define __px4_log_omit(level, FMT, ...) do_nothing(level, ##__VA_ARGS__)
|
|
|
|
|
2019-01-22 12:04:13 -04:00
|
|
|
#if defined(__PX4_QURT)
|
2015-08-26 01:59:01 -03:00
|
|
|
#include "qurt_log.h"
|
|
|
|
/****************************************************************************
|
|
|
|
* Messages that should never be filtered or compiled out
|
|
|
|
****************************************************************************/
|
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
|
|
|
#define PX4_INFO(FMT, ...) qurt_log(_PX4_LOG_LEVEL_INFO, __FILE__, __LINE__, FMT, ##__VA_ARGS__)
|
|
|
|
#define PX4_INFO_RAW(FMT, ...) __px4_log_omit(_PX4_LOG_LEVEL_INFO, FMT, ##__VA_ARGS__)
|
2015-08-26 01:59:01 -03:00
|
|
|
|
|
|
|
#if defined(TRACE_BUILD)
|
|
|
|
/****************************************************************************
|
|
|
|
* Extremely Verbose settings for a Trace build
|
|
|
|
****************************************************************************/
|
2015-09-08 17:16:12 -03:00
|
|
|
#define PX4_PANIC(FMT, ...) qurt_log(_PX4_LOG_LEVEL_PANIC, __FILE__, __LINE__, FMT, ##__VA_ARGS__)
|
|
|
|
#define PX4_ERR(FMT, ...) qurt_log(_PX4_LOG_LEVEL_ERROR, __FILE__, __LINE__, FMT, ##__VA_ARGS__)
|
|
|
|
#define PX4_WARN(FMT, ...) qurt_log(_PX4_LOG_LEVEL_WARN, __FILE__, __LINE__, FMT, ##__VA_ARGS__)
|
|
|
|
#define PX4_DEBUG(FMT, ...) qurt_log(_PX4_LOG_LEVEL_DEBUG, __FILE__, __LINE__, FMT, ##__VA_ARGS__)
|
2015-08-26 01:59:01 -03:00
|
|
|
|
|
|
|
#elif defined(DEBUG_BUILD)
|
|
|
|
/****************************************************************************
|
|
|
|
* Verbose settings for a Debug build
|
|
|
|
****************************************************************************/
|
2015-09-08 17:16:12 -03:00
|
|
|
#define PX4_PANIC(FMT, ...) qurt_log(_PX4_LOG_LEVEL_PANIC, __FILE__, __LINE__, FMT, ##__VA_ARGS__)
|
|
|
|
#define PX4_ERR(FMT, ...) qurt_log(_PX4_LOG_LEVEL_ERROR, __FILE__, __LINE__, FMT, ##__VA_ARGS__)
|
|
|
|
#define PX4_WARN(FMT, ...) qurt_log(_PX4_LOG_LEVEL_WARN, __FILE__, __LINE__, FMT, ##__VA_ARGS__)
|
|
|
|
#define PX4_DEBUG(FMT, ...) qurt_log(_PX4_LOG_LEVEL_DEBUG, __FILE__, __LINE__, FMT, ##__VA_ARGS__)
|
2015-08-26 01:59:01 -03:00
|
|
|
|
|
|
|
#elif defined(RELEASE_BUILD)
|
|
|
|
/****************************************************************************
|
|
|
|
* Non-verbose settings for a Release build to minimize strings in build
|
|
|
|
****************************************************************************/
|
2015-09-08 17:16:12 -03:00
|
|
|
#define PX4_PANIC(FMT, ...) qurt_log(_PX4_LOG_LEVEL_PANIC, __FILE__, __LINE__, FMT, ##__VA_ARGS__)
|
|
|
|
#define PX4_ERR(FMT, ...) qurt_log(_PX4_LOG_LEVEL_ERROR, __FILE__, __LINE__, FMT, ##__VA_ARGS__)
|
2015-08-26 01:59:01 -03:00
|
|
|
#define PX4_WARN(FMT, ...) __px4_log_omit(_PX4_LOG_LEVEL_WARN, FMT, ##__VA_ARGS__)
|
|
|
|
#define PX4_DEBUG(FMT, ...) __px4_log_omit(_PX4_LOG_LEVEL_DEBUG, FMT, ##__VA_ARGS__)
|
|
|
|
|
|
|
|
#else
|
|
|
|
/****************************************************************************
|
|
|
|
* Medium verbose settings for a default build
|
|
|
|
****************************************************************************/
|
2015-09-08 17:16:12 -03:00
|
|
|
#define PX4_PANIC(FMT, ...) qurt_log(_PX4_LOG_LEVEL_PANIC, __FILE__, __LINE__, FMT, ##__VA_ARGS__)
|
|
|
|
#define PX4_ERR(FMT, ...) qurt_log(_PX4_LOG_LEVEL_ERROR, __FILE__, __LINE__, FMT, ##__VA_ARGS__)
|
|
|
|
#define PX4_WARN(FMT, ...) qurt_log(_PX4_LOG_LEVEL_WARN, __FILE__, __LINE__, FMT, ##__VA_ARGS__)
|
2015-08-26 01:59:01 -03:00
|
|
|
#define PX4_DEBUG(FMT, ...) __px4_log_omit(_PX4_LOG_LEVEL_DEBUG, FMT, ##__VA_ARGS__)
|
|
|
|
|
|
|
|
#endif
|
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
|
|
|
#define PX4_LOG_NAMED(name, FMT, ...) qurt_log( _PX4_LOG_LEVEL_INFO, __FILE__, __LINE__, "%s " FMT, name, ##__VA_ARGS__)
|
|
|
|
#define PX4_LOG_NAMED_COND(name, cond, FMT, ...) if( cond ) qurt_log( _PX4_LOG_LEVEL_INFO, __FILE__, __LINE__, "%s " FMT, name, ##__VA_ARGS__)
|
2015-08-26 01:59:01 -03:00
|
|
|
|
2015-06-17 17:49:34 -03:00
|
|
|
#else
|
|
|
|
|
2015-06-17 21:11:21 -03:00
|
|
|
#include <inttypes.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <sys/cdefs.h>
|
|
|
|
#include <stdio.h>
|
2016-06-02 11:56:22 -03:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
2019-10-25 05:56:32 -03:00
|
|
|
#include <px4_platform_common/defines.h>
|
2015-06-17 21:11:21 -03:00
|
|
|
|
2015-06-17 17:28:27 -03:00
|
|
|
__BEGIN_DECLS
|
2015-05-19 15:53:19 -03:00
|
|
|
|
2016-06-09 07:51:04 -03:00
|
|
|
__EXPORT extern const char *__px4_log_level_str[_PX4_LOG_LEVEL_PANIC + 1];
|
|
|
|
__EXPORT extern const char *__px4_log_level_color[_PX4_LOG_LEVEL_PANIC + 1];
|
2018-10-27 05:58:12 -03:00
|
|
|
__EXPORT void px4_log_modulename(int level, const char *moduleName, const char *fmt, ...)
|
|
|
|
__attribute__((format(printf, 3, 4)));
|
|
|
|
__EXPORT void px4_log_raw(int level, const char *fmt, ...)
|
|
|
|
__attribute__((format(printf, 2, 3)));
|
|
|
|
|
|
|
|
#if __GNUC__
|
|
|
|
// Allow empty format strings.
|
|
|
|
#pragma GCC diagnostic ignored "-Wformat-zero-length"
|
|
|
|
#endif
|
2016-07-06 18:52:08 -03:00
|
|
|
|
2015-09-04 15:09:29 -03:00
|
|
|
__END_DECLS
|
2015-06-17 17:28:27 -03:00
|
|
|
|
2015-10-16 16:42:26 -03:00
|
|
|
|
2015-06-17 17:28:27 -03:00
|
|
|
/****************************************************************************
|
|
|
|
* Implementation of log section formatting based on printf
|
2015-06-17 21:11:21 -03:00
|
|
|
*
|
|
|
|
* To write to a specific stream for each message type, open the streams and
|
|
|
|
* set __px4__log_startline to something like:
|
2016-08-12 03:57:08 -03:00
|
|
|
* printf(_px4_fd[level],
|
2015-06-17 21:11:21 -03:00
|
|
|
*
|
|
|
|
* Additional behavior can be added using "{\" for __px4__log_startline and
|
|
|
|
* "}" for __px4__log_endline and any other required setup or teardown steps
|
2015-06-17 17:28:27 -03:00
|
|
|
****************************************************************************/
|
2015-09-27 06:37:30 -03:00
|
|
|
#define __px4__log_printcond(cond, ...) if (cond) printf(__VA_ARGS__)
|
2016-08-12 03:57:08 -03:00
|
|
|
#define __px4__log_printline(level, ...) printf(__VA_ARGS__)
|
2015-06-17 21:11:21 -03:00
|
|
|
|
|
|
|
#define __px4__log_timestamp_fmt "%-10" PRIu64 " "
|
2015-06-17 17:28:27 -03:00
|
|
|
#define __px4__log_timestamp_arg ,hrt_absolute_time()
|
|
|
|
#define __px4__log_level_fmt "%-5s "
|
|
|
|
#define __px4__log_level_arg(level) ,__px4_log_level_str[level]
|
2015-06-17 21:11:21 -03:00
|
|
|
#define __px4__log_thread_fmt "%#X "
|
2015-07-05 06:03:27 -03:00
|
|
|
#define __px4__log_thread_arg ,(unsigned int)pthread_self()
|
2016-06-02 11:19:21 -03:00
|
|
|
#define __px4__log_modulename_fmt "%-10s "
|
2016-07-06 18:52:08 -03:00
|
|
|
#define __px4__log_modulename_pfmt "[%s] "
|
2016-06-02 11:19:21 -03:00
|
|
|
#define __px4__log_modulename_arg ,"[" MODULE_NAME "]"
|
2015-06-17 17:28:27 -03:00
|
|
|
|
2015-06-17 21:11:21 -03:00
|
|
|
#define __px4__log_file_and_line_fmt " (file %s line %u)"
|
2015-06-17 17:28:27 -03:00
|
|
|
#define __px4__log_file_and_line_arg , __FILE__, __LINE__
|
|
|
|
#define __px4__log_end_fmt "\n"
|
2015-06-13 06:07:17 -03:00
|
|
|
|
2016-06-09 07:51:04 -03:00
|
|
|
#define PX4_ANSI_COLOR_RED "\x1b[31m"
|
|
|
|
#define PX4_ANSI_COLOR_GREEN "\x1b[32m"
|
|
|
|
#define PX4_ANSI_COLOR_YELLOW "\x1b[33m"
|
|
|
|
#define PX4_ANSI_COLOR_BLUE "\x1b[34m"
|
|
|
|
#define PX4_ANSI_COLOR_MAGENTA "\x1b[35m"
|
|
|
|
#define PX4_ANSI_COLOR_CYAN "\x1b[36m"
|
|
|
|
#define PX4_ANSI_COLOR_GRAY "\x1B[37m"
|
|
|
|
#define PX4_ANSI_COLOR_RESET "\x1b[0m"
|
|
|
|
|
|
|
|
#ifdef __PX4_POSIX
|
|
|
|
#define PX4_LOG_COLORIZED_OUTPUT //if defined and output is a tty, colorize the output according to the log level
|
|
|
|
#endif /* __PX4_POSIX */
|
|
|
|
|
|
|
|
|
2015-06-17 17:28:27 -03:00
|
|
|
/****************************************************************************
|
|
|
|
* Output format macros
|
|
|
|
* Use these to implement the code level macros below
|
|
|
|
****************************************************************************/
|
2015-06-17 21:11:21 -03:00
|
|
|
|
2015-08-26 01:59:01 -03:00
|
|
|
|
2015-08-11 16:07:06 -03:00
|
|
|
/****************************************************************************
|
|
|
|
* __px4_log_named_cond:
|
|
|
|
* Convert a message in the form:
|
|
|
|
* PX4_LOG_COND(__dbg_enabled, "val is %d", val);
|
|
|
|
* to
|
|
|
|
* printf("%-5s val is %d\n", "LOG", val);
|
|
|
|
* if the first arg/condition is true.
|
|
|
|
****************************************************************************/
|
|
|
|
#define __px4_log_named_cond(name, cond, FMT, ...) \
|
2015-09-27 06:37:30 -03:00
|
|
|
__px4__log_printcond(cond,\
|
2015-10-19 08:25:39 -03:00
|
|
|
"%s " \
|
|
|
|
FMT\
|
|
|
|
__px4__log_end_fmt \
|
|
|
|
,name, ##__VA_ARGS__\
|
|
|
|
)
|
2015-08-11 16:07:06 -03:00
|
|
|
|
2015-06-17 21:11:21 -03:00
|
|
|
/****************************************************************************
|
|
|
|
* __px4_log:
|
|
|
|
* Convert a message in the form:
|
|
|
|
* PX4_WARN("val is %d", val);
|
|
|
|
* to
|
|
|
|
* printf("%-5s val is %d\n", __px4_log_level_str[3], val);
|
|
|
|
****************************************************************************/
|
2015-06-17 17:28:27 -03:00
|
|
|
#define __px4_log(level, FMT, ...) \
|
2015-09-27 06:37:30 -03:00
|
|
|
__px4__log_printline(level,\
|
2015-10-19 08:25:39 -03:00
|
|
|
__px4__log_level_fmt \
|
|
|
|
FMT\
|
|
|
|
__px4__log_end_fmt \
|
|
|
|
__px4__log_level_arg(level), ##__VA_ARGS__\
|
|
|
|
)
|
2015-06-17 17:28:27 -03:00
|
|
|
|
2016-06-02 11:19:21 -03:00
|
|
|
/****************************************************************************
|
|
|
|
* __px4_log_modulename:
|
|
|
|
* Convert a message in the form:
|
|
|
|
* PX4_WARN("val is %d", val);
|
|
|
|
* to
|
2016-07-06 18:52:08 -03:00
|
|
|
* printf("%-5s [%s] val is %d\n", __px4_log_level_str[3],
|
2016-06-02 11:19:21 -03:00
|
|
|
* MODULENAME, val);
|
|
|
|
****************************************************************************/
|
|
|
|
|
2016-07-06 18:52:08 -03:00
|
|
|
#define __px4_log_modulename(level, fmt, ...) \
|
|
|
|
do { \
|
|
|
|
px4_log_modulename(level, MODULE_NAME, fmt, ##__VA_ARGS__); \
|
|
|
|
} while(0)
|
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
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* __px4_log_raw:
|
|
|
|
* Convert a message in the form:
|
|
|
|
* PX4_INFO("val is %d", val);
|
|
|
|
* to
|
|
|
|
* printf("val is %d", val);
|
|
|
|
*
|
|
|
|
* This can be used for simple printfs with all the formatting control.
|
|
|
|
****************************************************************************/
|
|
|
|
#define __px4_log_raw(level, fmt, ...) \
|
|
|
|
do { \
|
|
|
|
px4_log_raw(level, fmt, ##__VA_ARGS__); \
|
|
|
|
} while(0)
|
|
|
|
|
|
|
|
|
2015-06-17 21:11:21 -03:00
|
|
|
/****************************************************************************
|
|
|
|
* __px4_log_timestamp:
|
|
|
|
* Convert a message in the form:
|
|
|
|
* PX4_WARN("val is %d", val);
|
|
|
|
* to
|
|
|
|
* printf("%-5s %10lu val is %d\n", __px4_log_level_str[3],
|
|
|
|
* hrt_absolute_time(), val);
|
|
|
|
****************************************************************************/
|
2015-06-17 17:28:27 -03:00
|
|
|
#define __px4_log_timestamp(level, FMT, ...) \
|
2015-09-27 06:37:30 -03:00
|
|
|
__px4__log_printline(level,\
|
2015-10-19 08:25:39 -03:00
|
|
|
__px4__log_level_fmt\
|
|
|
|
__px4__log_timestamp_fmt\
|
|
|
|
FMT\
|
|
|
|
__px4__log_end_fmt\
|
|
|
|
__px4__log_level_arg(level)\
|
|
|
|
__px4__log_timestamp_arg\
|
|
|
|
, ##__VA_ARGS__\
|
|
|
|
)
|
2015-06-17 21:11:21 -03:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* __px4_log_timestamp_thread:
|
|
|
|
* Convert a message in the form:
|
|
|
|
* PX4_WARN("val is %d", val);
|
|
|
|
* to
|
|
|
|
* printf("%-5s %10lu %#X val is %d\n", __px4_log_level_str[3],
|
|
|
|
* hrt_absolute_time(), pthread_self(), val);
|
|
|
|
****************************************************************************/
|
|
|
|
#define __px4_log_timestamp_thread(level, FMT, ...) \
|
2015-09-27 06:37:30 -03:00
|
|
|
__px4__log_printline(level,\
|
2015-10-19 08:25:39 -03:00
|
|
|
__px4__log_level_fmt\
|
|
|
|
__px4__log_timestamp_fmt\
|
|
|
|
__px4__log_thread_fmt\
|
|
|
|
FMT\
|
|
|
|
__px4__log_end_fmt\
|
|
|
|
__px4__log_level_arg(level)\
|
|
|
|
__px4__log_timestamp_arg\
|
|
|
|
__px4__log_thread_arg\
|
|
|
|
, ##__VA_ARGS__\
|
|
|
|
)
|
2015-06-17 17:28:27 -03:00
|
|
|
|
2015-06-17 21:11:21 -03:00
|
|
|
/****************************************************************************
|
|
|
|
* __px4_log_file_and_line:
|
|
|
|
* Convert a message in the form:
|
|
|
|
* PX4_WARN("val is %d", val);
|
|
|
|
* to
|
2015-09-27 06:37:30 -03:00
|
|
|
* printf("%-5s val is %d (file %s line %u)\n",
|
2015-06-17 21:11:21 -03:00
|
|
|
* __px4_log_level_str[3], val, __FILE__, __LINE__);
|
|
|
|
****************************************************************************/
|
2015-06-17 17:28:27 -03:00
|
|
|
#define __px4_log_file_and_line(level, FMT, ...) \
|
2015-09-27 06:37:30 -03:00
|
|
|
__px4__log_printline(level,\
|
2015-10-19 08:25:39 -03:00
|
|
|
__px4__log_level_fmt\
|
|
|
|
__px4__log_timestamp_fmt\
|
|
|
|
FMT\
|
|
|
|
__px4__log_file_and_line_fmt\
|
|
|
|
__px4__log_end_fmt\
|
|
|
|
__px4__log_level_arg(level)\
|
|
|
|
__px4__log_timestamp_arg\
|
|
|
|
, ##__VA_ARGS__\
|
|
|
|
__px4__log_file_and_line_arg\
|
|
|
|
)
|
2015-06-17 17:28:27 -03:00
|
|
|
|
2015-06-17 21:11:21 -03:00
|
|
|
/****************************************************************************
|
|
|
|
* __px4_log_timestamp_file_and_line:
|
|
|
|
* Convert a message in the form:
|
|
|
|
* PX4_WARN("val is %d", val);
|
|
|
|
* to
|
2015-09-27 06:37:30 -03:00
|
|
|
* printf("%-5s %-10lu val is %d (file %s line %u)\n",
|
2015-06-17 21:11:21 -03:00
|
|
|
* __px4_log_level_str[3], hrt_absolute_time(),
|
|
|
|
* val, __FILE__, __LINE__);
|
|
|
|
****************************************************************************/
|
2015-06-17 17:28:27 -03:00
|
|
|
#define __px4_log_timestamp_file_and_line(level, FMT, ...) \
|
2015-09-27 06:37:30 -03:00
|
|
|
__px4__log_printline(level,\
|
2015-10-19 08:25:39 -03:00
|
|
|
__px4__log_level_fmt\
|
|
|
|
__px4__log_timestamp_fmt\
|
|
|
|
FMT\
|
|
|
|
__px4__log_file_and_line_fmt\
|
|
|
|
__px4__log_end_fmt\
|
|
|
|
__px4__log_level_arg(level)\
|
|
|
|
__px4__log_timestamp_arg\
|
|
|
|
, ##__VA_ARGS__\
|
|
|
|
__px4__log_file_and_line_arg\
|
|
|
|
)
|
2015-06-17 17:28:27 -03:00
|
|
|
|
2015-06-17 21:11:21 -03:00
|
|
|
/****************************************************************************
|
|
|
|
* __px4_log_thread_file_and_line:
|
|
|
|
* Convert a message in the form:
|
|
|
|
* PX4_WARN("val is %d", val);
|
|
|
|
* to
|
2015-09-27 06:37:30 -03:00
|
|
|
* printf("%-5s %#X val is %d (file %s line %u)\n",
|
|
|
|
* __px4_log_level_str[3], pthread_self(),
|
2015-06-17 21:11:21 -03:00
|
|
|
* val, __FILE__, __LINE__);
|
|
|
|
****************************************************************************/
|
2015-06-17 17:28:27 -03:00
|
|
|
#define __px4_log_thread_file_and_line(level, FMT, ...) \
|
2015-09-27 06:37:30 -03:00
|
|
|
__px4__log_printline(level,\
|
2015-10-19 08:25:39 -03:00
|
|
|
__px4__log_level_fmt\
|
|
|
|
__px4__log_thread_fmt\
|
|
|
|
FMT\
|
|
|
|
__px4__log_file_and_line_fmt\
|
|
|
|
__px4__log_end_fmt\
|
|
|
|
__px4__log_level_arg(level)\
|
|
|
|
__px4__log_thread_arg\
|
|
|
|
, ##__VA_ARGS__\
|
|
|
|
__px4__log_file_and_line_arg\
|
|
|
|
)
|
2015-06-17 21:11:21 -03:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* __px4_log_timestamp_thread_file_and_line:
|
|
|
|
* Convert a message in the form:
|
|
|
|
* PX4_WARN("val is %d", val);
|
|
|
|
* to
|
2015-09-27 06:37:30 -03:00
|
|
|
* printf("%-5s %-10lu %#X val is %d (file %s line %u)\n",
|
|
|
|
* __px4_log_level_str[3], hrt_absolute_time(),
|
2015-06-17 21:11:21 -03:00
|
|
|
* pthread_self(), val, __FILE__, __LINE__);
|
|
|
|
****************************************************************************/
|
|
|
|
#define __px4_log_timestamp_thread_file_and_line(level, FMT, ...) \
|
2015-09-27 06:37:30 -03:00
|
|
|
__px4__log_printline(level,\
|
2015-10-19 08:25:39 -03:00
|
|
|
__px4__log_level_fmt\
|
|
|
|
__px4__log_timestamp_fmt\
|
|
|
|
__px4__log_thread_fmt\
|
|
|
|
FMT\
|
|
|
|
__px4__log_file_and_line_fmt\
|
|
|
|
__px4__log_end_fmt\
|
|
|
|
__px4__log_level_arg(level)\
|
|
|
|
__px4__log_timestamp_arg\
|
|
|
|
__px4__log_thread_arg\
|
|
|
|
, ##__VA_ARGS__\
|
|
|
|
__px4__log_file_and_line_arg\
|
|
|
|
)
|
2015-06-13 06:07:17 -03:00
|
|
|
|
2015-04-28 01:58:54 -03:00
|
|
|
|
2015-06-17 17:28:27 -03:00
|
|
|
/****************************************************************************
|
|
|
|
* Code level macros
|
|
|
|
* These are the log APIs that should be used by the code
|
|
|
|
****************************************************************************/
|
2015-04-28 01:58:54 -03:00
|
|
|
|
2015-06-17 21:11:21 -03:00
|
|
|
/****************************************************************************
|
|
|
|
* Messages that should never be filtered or compiled out
|
|
|
|
****************************************************************************/
|
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
|
|
|
#define PX4_INFO(FMT, ...) __px4_log_modulename(_PX4_LOG_LEVEL_INFO, FMT, ##__VA_ARGS__)
|
|
|
|
|
|
|
|
#ifdef __NUTTX
|
|
|
|
#define PX4_INFO_RAW printf
|
|
|
|
#else
|
|
|
|
#define PX4_INFO_RAW(FMT, ...) __px4_log_raw(_PX4_LOG_LEVEL_INFO, FMT, ##__VA_ARGS__)
|
|
|
|
#endif
|
2015-06-17 21:11:21 -03:00
|
|
|
|
|
|
|
#if defined(TRACE_BUILD)
|
|
|
|
/****************************************************************************
|
|
|
|
* Extremely Verbose settings for a Trace build
|
|
|
|
****************************************************************************/
|
|
|
|
#define PX4_PANIC(FMT, ...) __px4_log_timestamp_thread_file_and_line(_PX4_LOG_LEVEL_PANIC, FMT, ##__VA_ARGS__)
|
|
|
|
#define PX4_ERR(FMT, ...) __px4_log_timestamp_thread_file_and_line(_PX4_LOG_LEVEL_ERROR, FMT, ##__VA_ARGS__)
|
|
|
|
#define PX4_WARN(FMT, ...) __px4_log_timestamp_thread_file_and_line(_PX4_LOG_LEVEL_WARN, FMT, ##__VA_ARGS__)
|
2015-07-05 06:03:27 -03:00
|
|
|
#define PX4_DEBUG(FMT, ...) __px4_log_timestamp_thread(_PX4_LOG_LEVEL_DEBUG, FMT, ##__VA_ARGS__)
|
2015-04-28 01:58:54 -03:00
|
|
|
|
2015-06-17 21:11:21 -03:00
|
|
|
#elif defined(DEBUG_BUILD)
|
|
|
|
/****************************************************************************
|
|
|
|
* Verbose settings for a Debug build
|
|
|
|
****************************************************************************/
|
2015-06-17 17:28:27 -03:00
|
|
|
#define PX4_PANIC(FMT, ...) __px4_log_timestamp_file_and_line(_PX4_LOG_LEVEL_PANIC, FMT, ##__VA_ARGS__)
|
|
|
|
#define PX4_ERR(FMT, ...) __px4_log_timestamp_file_and_line(_PX4_LOG_LEVEL_ERROR, FMT, ##__VA_ARGS__)
|
|
|
|
#define PX4_WARN(FMT, ...) __px4_log_timestamp_file_and_line(_PX4_LOG_LEVEL_WARN, FMT, ##__VA_ARGS__)
|
2015-07-05 06:03:27 -03:00
|
|
|
#define PX4_DEBUG(FMT, ...) __px4_log_timestamp(_PX4_LOG_LEVEL_DEBUG, FMT, ##__VA_ARGS__)
|
2015-04-28 01:58:54 -03:00
|
|
|
|
2015-06-17 21:11:21 -03:00
|
|
|
#elif defined(RELEASE_BUILD)
|
|
|
|
/****************************************************************************
|
|
|
|
* Non-verbose settings for a Release build to minimize strings in build
|
|
|
|
****************************************************************************/
|
2016-06-02 11:19:21 -03:00
|
|
|
#define PX4_PANIC(FMT, ...) __px4_log_modulename(_PX4_LOG_LEVEL_PANIC, FMT, ##__VA_ARGS__)
|
|
|
|
#define PX4_ERR(FMT, ...) __px4_log_modulename(_PX4_LOG_LEVEL_ERROR, FMT, ##__VA_ARGS__)
|
2015-06-17 21:11:21 -03:00
|
|
|
#define PX4_WARN(FMT, ...) __px4_log_omit(_PX4_LOG_LEVEL_WARN, FMT, ##__VA_ARGS__)
|
|
|
|
#define PX4_DEBUG(FMT, ...) __px4_log_omit(_PX4_LOG_LEVEL_DEBUG, FMT, ##__VA_ARGS__)
|
2015-04-28 01:58:54 -03:00
|
|
|
|
2015-06-17 21:11:21 -03:00
|
|
|
#else
|
|
|
|
/****************************************************************************
|
|
|
|
* Medium verbose settings for a default build
|
|
|
|
****************************************************************************/
|
2016-06-02 11:19:21 -03:00
|
|
|
#define PX4_PANIC(FMT, ...) __px4_log_modulename(_PX4_LOG_LEVEL_PANIC, FMT, ##__VA_ARGS__)
|
|
|
|
#define PX4_ERR(FMT, ...) __px4_log_modulename(_PX4_LOG_LEVEL_ERROR, FMT, ##__VA_ARGS__)
|
|
|
|
#define PX4_WARN(FMT, ...) __px4_log_modulename(_PX4_LOG_LEVEL_WARN, FMT, ##__VA_ARGS__)
|
2015-06-17 17:28:27 -03:00
|
|
|
#define PX4_DEBUG(FMT, ...) __px4_log_omit(_PX4_LOG_LEVEL_DEBUG, FMT, ##__VA_ARGS__)
|
2015-04-28 01:58:54 -03:00
|
|
|
|
|
|
|
#endif
|
2015-08-11 16:07:06 -03:00
|
|
|
#define PX4_LOG_NAMED(name, FMT, ...) __px4_log_named_cond(name, true, FMT, ##__VA_ARGS__)
|
|
|
|
#define PX4_LOG_NAMED_COND(name, cond, FMT, ...) __px4_log_named_cond(name, cond, FMT, ##__VA_ARGS__)
|
2015-06-17 17:49:34 -03:00
|
|
|
#endif
|