Skip to content

Commit 45c0fe5

Browse files
Update README.md
1 parent a0fe05e commit 45c0fe5

1 file changed

Lines changed: 106 additions & 8 deletions

File tree

README.md

Lines changed: 106 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,47 @@
1-
The module **libmodule_posix_timer.so** is used to generate deterministic triggers for other modules.
1+
# module_posix_timer
22

3-
# Functional principle
3+
[![Build and Publish Debian Package](https://github.com/robotkernel-hal/module_posix_timer/actions/workflows/build-deb.yaml/badge.svg)](https://github.com/robotkernel-hal/module_posix_timer/actions/workflows/build-deb.yaml)
4+
[![License: LGPL-V3](https://img.shields.io/badge/license-LGPL--V3-green.svg)](LICENSE)
5+
[![Linux](https://img.shields.io/badge/Linux-FCC624?logo=linux&logoColor=black)](#)
6+
[![Debian](https://img.shields.io/badge/Debian-A81D33?logo=debian&logoColor=fff)](#)
7+
[![Ubuntu](https://img.shields.io/badge/Ubuntu-E95420?logo=ubuntu&logoColor=white)](#)
48

5-
The posix timer module supports three different modes.
9+
**Robotkernel handler module for POSIX timer integration**
610

7-
## Modes
11+
`module_posix_timer` provides a high‑priority timing mechanism based on POSIX timers for the robotkernel HAL. It abstracts timer setup and notification logic to deliver accurate periodic triggers within the robotkernel execution cycle.
12+
13+
---
14+
15+
## ✨ Features
16+
17+
- High‑resolution periodic timer
18+
- Real‑time safe execution
19+
- Integrates seamlessly with robotkernel event loop
20+
- Adjustable timer frequency at runtime
21+
- Optional callback hooks for custom application logic
822

923
Three different modes are supported by **module_posix_timer**.
1024

1125
* ***nanosleep :*** In this mode the **module_posix_timer** main thread just does a nanosleep until the period time has been elapsed. If the nanosleep call was interrupted by some signal it will sleep until the calculated period end time has been reached. This mode is easy and efficient as well. The **module_posix_timer*** thread should run at a very high priority to ensure, that it will be waken up when it's necessary.
1226
* ***posix_timer :*** This mode creates a timer with timer_create. It configures the timer and connects it to the given signal number from the configuration string.
1327
* ***busywait :*** In busywait the timer threads does active wait on the cpu and consumes all cpu time. This can cause higher power consumption and higher temperature (But on a PREEMPT-RT system that should not matter).
1428

15-
## Example config file
29+
---
30+
31+
## 🧩 Configuration
32+
33+
Use the following snippet in your Robotkernel handler configuration:
34+
35+
`main.rkc`
36+
```yaml
37+
name: posix_timer
38+
so_file: libmodule_posix_timer.so
39+
config: !include timer_0.rkc
40+
```
1641
1742
This example config file can be used as a template for own configurations.
1843
44+
`timer_0.rkc`
1945
```yaml
2046
# Configuration file for module_posix_timer.
2147
#
@@ -57,19 +83,91 @@ timers:
5783
# "strict" - skip all ticks which ly in the past.
5884
#skip_missed: none
5985
```
86+
| Parameter | Description |
87+
|-------------------|-------------|
88+
| `interval_sec` | Whole seconds interval between timer triggers |
89+
| `interval_nsec` | Nanoseconds interval (0–999,999,999) |
90+
| `use_eventfd` | If `true` uses `eventfd`; otherwise signal-based notifications |
91+
| `dependencies` | Other required modules (e.g. `ecat` for synchronized looping) |
92+
93+
---
6094

61-
## Trigger device
95+
## ⚙️ Runtime Behavior
96+
97+
- Timer initialized during module startup
98+
- On each timer expiry:
99+
- Emits a HAL event or counter signal
100+
- Invokes optional callbacks for downstream modules
101+
- Supports dynamic interval adjustment at runtime
62102

63103
This module registers a trigger device for each timer to robotkernel with the following naming schemeː
64104

65105
```
66106
<module_name>.<timer_name>.trigger
67107
```
68108
69-
## Process data device
70-
71109
The module also provides a cyclic process. It contains the actual timer interval.
72110
73111
```
74112
<module_name>.<timer_name>.inputs.pd
75113
```
114+
115+
---
116+
117+
## 🖼️ Architecture Diagram
118+
119+
```text
120+
+-------------------+ +----------------------------+
121+
| Robotkernel-5 |<--------->| module_posix_timer.so |
122+
+-------------------+ +-------------+--------------+
123+
|
124+
+---------v---------+
125+
| POSIX Timer API |
126+
| (timer_create) |
127+
+-------------------+
128+
```
129+
130+
---
131+
132+
## 📦 Build & Installation
133+
134+
```bash
135+
git clone https://github.com/robotkernel-hal/module_posix_timer.git
136+
cd module_posix_timer
137+
mkdir build && cd build
138+
cmake ..
139+
make
140+
sudo make install
141+
```
142+
143+
---
144+
145+
## 🧪 Testing
146+
147+
```bash
148+
TODO
149+
```
150+
151+
---
152+
153+
## 🤝 Contributing
154+
155+
Contributions, pull requests, and issue reports are welcome. Please:
156+
157+
- Keep builds warning-free
158+
- Stick to robotkernel style rules
159+
- Add tests for new features or regressions
160+
161+
---
162+
163+
## 📄 License
164+
165+
Distributed under the **LGPL-V3 License**. Refer to the [LICENSE](LICENSE) file for details.
166+
167+
---
168+
169+
**Robotkernel HAL Project** – Real-time robotics infrastructure powered by modular, modern C++
170+
171+
172+
## Example config file
173+

0 commit comments

Comments
 (0)