Skip to content

Commit 9f0db26

Browse files
Add custom rosdoc2 config (#161)
Co-authored-by: Felix Exner (fexner) <[email protected]>
1 parent 99b6153 commit 9f0db26

File tree

7 files changed

+84
-14
lines changed

7 files changed

+84
-14
lines changed

.github/workflows/rosdoc2.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: rosdoc2
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
branches:
7+
- master
8+
paths:
9+
- doc/**
10+
- rosdoc2.yaml
11+
- package.xml
12+
13+
14+
jobs:
15+
check:
16+
uses: ros-controls/ros2_control_ci/.github/workflows/reusable-rosdoc2.yml@master

.pre-commit-config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ repos:
2626
- id: check-symlinks
2727
- id: check-xml
2828
- id: check-yaml
29+
exclude: rosdoc2.yaml
2930
- id: debug-statements
3031
- id: end-of-file-fixer
3132
- id: mixed-line-ending
@@ -105,6 +106,7 @@ repos:
105106
description: Check if copyright notice is available in all files.
106107
entry: ament_copyright
107108
language: system
109+
exclude: doc/conf.py
108110

109111
# Docs - RestructuredText hooks
110112
- repo: https://github.com/PyCQA/doc8

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ realtime_tools
33
[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
44
[![codecov](https://codecov.io/gh/ros-controls/realtime_tools/branch/master/graph/badge.svg?token=Osge1FOaAh)](https://app.codecov.io/gh/ros-controls/realtime_tools/tree/master)
55

6+
Contains a set of tools that can be used from a hard realtime thread, without breaking the realtime behavior.
67

78
## Build status
89
ROS2 Distro | Branch | Build status | Documentation | Released packages

doc.dox

Lines changed: 0 additions & 13 deletions
This file was deleted.

doc/conf.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
# settings will be overridden by rosdoc2, so we add here only custom settings
3+
4+
copyright = "2024, ros2_control development team"
5+
html_logo = "https://control.ros.org/master/_static/logo_ros-controls.png"

doc/index.rst

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
Welcome to the documentation for realtime_tools
2+
===============================================
3+
4+
Contains a set of tools that can be used from a hard realtime thread, without breaking the realtime behavior.
5+
6+
For more information of the ros2_control framework see `control.ros.org <https://control.ros.org/>`__.
7+
8+
Realtime Publisher
9+
------------------
10+
The ``realtime_tools::RealtimePublisher`` allows users that write C++ ros2_controllers to publish messages on a ROS topic from a hard realtime loop. The normal ROS publisher is not realtime safe, and should not be used from within the update loop of a realtime controller. The realtime publisher is a wrapper around the ROS publisher; the wrapper creates an extra non-realtime thread that publishes messages on a ROS topic. The example below shows a typical usage of the realtime publisher in the ``on_configure()`` (non-realtime method) and ``update()`` (realtime method) methods of a realtime controller:
11+
12+
.. code-block:: cpp
13+
14+
#include <realtime_tools/realtime_publisher.h>
15+
16+
class MyController : public controller_interface::ControllerInterface
17+
{
18+
...
19+
private:
20+
std::shared_ptr<realtime_tools::RealtimePublisher<my_msgs::msg::MyMsg>> state_publisher_;
21+
std::shared_ptr<rclcpp::Publisher<my_msgs::msg::MyMsg>> s_publisher_;
22+
}
23+
24+
controller_interface::CallbackReturn MyController::on_configure(
25+
const rclcpp_lifecycle::State & /*previous_state*/)
26+
{
27+
...
28+
s_publisher_ = get_node()->create_publisher<my_msgs::msg::MyMsg>(
29+
"~/status", rclcpp::SystemDefaultsQoS());
30+
state_publisher_ =
31+
std::make_unique<realtime_tools::RealtimePublisher<ControllerStateMsg>>(s_publisher_);
32+
...
33+
}
34+
35+
controller_interface::return_type MyController::update(
36+
const rclcpp::Time & /*time*/, const rclcpp::Duration & /*period*/)
37+
{
38+
...
39+
// Publish controller state
40+
state_publisher_->lock();
41+
state_publisher_->msg_ = some_msg;
42+
state_publisher_->unlockAndPublish();
43+
}
44+
45+
46+
API documentation
47+
------------------
48+
49+
.. toctree::
50+
:maxdepth: 2
51+
52+
C++ API <generated/index>
53+
54+
55+
Indices and Search
56+
==================
57+
58+
* :ref:`genindex`
59+
* :ref:`search`

package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<license>3-Clause BSD</license>
1010

11-
<url type="website">http://ros.org/wiki/realtime_tools</url>
11+
<url type="website">https://control.ros.org</url>
1212
<url type="bugtracker">https://github.com/ros-controls/realtime_tools/issues</url>
1313
<url type="repository">https://github.com/ros-controls/realtime_tools/</url>
1414

0 commit comments

Comments
 (0)