2020-01-01 12:15:19 -05:00
# ros2_tracing
2019-06-26 11:16:51 +02:00
2019-06-26 11:18:05 +02:00
Tracing tools for ROS 2.
2019-06-26 11:16:51 +02:00
## Building
2019-07-25 09:38:36 +02:00
If the `TRACETOOLS_DISABLED` option is enabled during build or if LTTng is not found, then this package will not do anything.
2019-06-26 11:16:51 +02:00
To enable tracing:
2019-06-27 16:36:24 +02:00
1. Install [LTTng ](https://lttng.org/docs/#doc-ubuntu ) with the Python bindings to control tracing and read traces:
2019-06-26 11:16:51 +02:00
```
2019-06-26 15:00:56 +02:00
$ sudo apt-add-repository ppa:lttng/stable-2.10
$ sudo apt-get update
2019-06-26 11:16:51 +02:00
$ sudo apt-get install lttng-tools lttng-modules-dkms liblttng-ust-dev
2019-06-26 15:00:56 +02:00
$ sudo apt-get install python3-babeltrace python3-lttng
2019-06-26 11:16:51 +02:00
```
2019-06-27 16:36:24 +02:00
Note: the LTTng stable 2.10 PPA is used to get newer versions of the packages.
2019-07-19 10:02:56 +02:00
2. Build
2019-06-26 11:16:51 +02:00
```
2019-07-19 10:02:56 +02:00
$ colcon build
2019-06-26 11:16:51 +02:00
```
2019-06-26 15:00:56 +02:00
3. Source and check that tracing is enabled:
2019-06-26 11:16:51 +02:00
```
2019-06-26 15:00:56 +02:00
$ source ./install/local_setup.bash
2019-08-01 10:17:09 +02:00
$ ros2 run tracetools status
2019-06-26 11:16:51 +02:00
```
## Tracing
2019-06-26 15:00:56 +02:00
The steps above will not lead to trace data being generated, and thus they will have no impact on execution. LTTng has to be enabled. The packages in this repo provide two options.
2019-06-26 11:16:51 +02:00
2019-06-26 15:00:56 +02:00
### Trace command
The first option is to use the `ros2 trace` command.
```
$ ros2 trace
```
2019-07-05 17:13:00 +02:00
By default, it will enable all ROS tracepoints and a few kernel tracepoints. The trace will be written to `~/.ros/tracing/session-YYYYMMDDHHMMSS` . Run the command with `-h` for more information.
2019-06-26 15:00:56 +02:00
### Launch file trace action
2019-10-13 15:29:21 -07:00
Another option is to use the `Trace` action in a launch file along with your `Node` action(s). This way, tracing happens when launching the launch file.
```
$ ros2 launch tracetools_launch example.launch.py
```
2019-06-26 15:00:56 +02:00
See [this example launch file ](./tracetools_launch/launch/example.launch.py ) for more information.
2019-10-13 15:27:46 -07:00
## Design
See the [design document ](./doc/design_ros_2.md ).
2020-01-01 12:15:07 -05:00
## Analysis
See [`tracetools_analysis` ](https://gitlab.com/micro-ROS/ros_tracing/tracetools_analysis ).