Logging ROS2 Messages
Assuming you have the following file structure for your app, you first need to adjust your app's auterion-app.yml
file before building the app by adding a logging:
key.
Auterion-app.yml Logging Key
The logging
key is placed after services in your auterion-app.yml
file.
msg-paths: Defines where log messages are stored. It can be a single string or a list of strings indicating file paths.
subscriptions: Specifies which messages or topics should be logged. You can list them as simple strings or detailed objects with additional properties like logging rates.
profiles: allows control of the logging behaviour under different conditions, and if the run conditions are met, each profile can generate its own
ulog
with its own logging rate and set of logged messages into a defined directory. The run conditionsalways
,never
,while-armed
andwhile-disarmed
can be used for a profile. AOS has two profiles that are already setup,default
andverbose.
Thedefault
profile starts logging when the system is armed. The profiles can be extended in the app configuration to include additional topic subscriptions that the logger will log. This flexibility lets you specify which messages are logged and under what conditions.
The default profile's logs will be stored in /data/log/flight-stack
. A new ulog is created after each arming.
The default profile is streamed to the suite. Therefore, keep the log data rate low (in the order of a few KB/s at the top).
The verbose
profile would be in /data/log/flight-stack-verbose
, currently disabled by default. You can change its condition to activate it.
ROS2 Logging Setup Example
The app needs to publish messages over DDS or ROS2 to log custom app data. In the auterion-app.yml
for your app, you can specify the message paths and set them as subscriptions:
for the AOS logger.
If a message doesn't contain a timestamp field, the logger will add it.
You should then be able to find the messages defined within your app auterion-app.yml
file under the /data/app-config/logging/msgs
after you install your app on AOS.
To log messages to the file, you just need to add ROS2 topics and ROS2 message types under subscriptions.
To extend the verbose
profile such that you are also logging the messages while disarmed, you would do something like this:
Profile extensions will be placed in /data/app-config/logging/profiles
, and logged ROS2 message definitions will be stored in /data/app-config/logging/msgs.
You could also set the logging rate for each topic by setting max_rate_hz
. This is an example to log at low rate while disarmed, and full rate while armed:
Monitoring and Troubleshooting
To monitor the logging activity and troubleshoot potential issues, use:
If the message is logged successfully, running journalctl -u data-logger -b -f
should contain: [dds_source.cpp:111] [dds] Subscriber matched update.
Key Limitations
Maximum Topic Size: 65536 bytes. Ensure that messages do not exceed this size to prevent logging failures.
No Support for Dynamically-Sized Messages: Static message definitions are required due to current logging limitations.
Last updated