|
1 | | -The **module_tty** works as a transparent layer for other modules. It gains abstract access to a tty-hardware interface. |
| 1 | +# module_tty |
2 | 2 |
|
3 | | -## Example config file |
| 3 | +[](https://github.com/robotkernel-hal/module_tty/actions/workflows/build-deb.yaml) |
| 4 | +[](LICENSE) |
| 5 | +[](#) |
| 6 | +[](#) |
| 7 | +[](#) |
4 | 8 |
|
5 | | -This example config file can be used as a template for own configurations. |
| 9 | +**Robotkernel handler module for serial (TTY) port integration** |
6 | 10 |
|
| 11 | +This module enables robotkernel HAL to interact with standard serial (TTY) devices on UNIX-like systems. It provides a handler interface that integrates seamlessly with robotkernel's module processing model. |
| 12 | + |
| 13 | +--- |
| 14 | + |
| 15 | +## 🧩 Configuration |
| 16 | + |
| 17 | +Configure the module within your robotkernel handler setup: |
| 18 | + |
| 19 | +`main.rkc` |
| 20 | +```yaml |
| 21 | +name: my_tty_handler |
| 22 | +so_file: libmodule_tty.so |
| 23 | +config: !include tty_0 |
| 24 | +``` |
| 25 | +
|
| 26 | +This is a complete template for module_tty configuration: |
| 27 | +
|
| 28 | +`tty_0.rkc` |
7 | 29 | ```yaml |
8 | 30 | # Configuration file for module_tty. |
9 | 31 | # |
@@ -56,3 +78,115 @@ timeout_us: 0 |
56 | 78 | #loglevel: verbose |
57 | 79 |
|
58 | 80 | ``` |
| 81 | + |
| 82 | +| Parameter | Description | |
| 83 | +|-------------------------|--------------------------------------------------| |
| 84 | +| `ifname` | Path to the TTY device (e.g. `/dev/ttyUSB0`) | |
| 85 | +| `baudrate` | Communication speed (e.g. `9600`, `115200`) | |
| 86 | +| `character_size` | Number of bits per character (e.g. `7`, `8`) | |
| 87 | +| `stopbits` | Number of stop bits (`1` or `2`) | |
| 88 | +| `parity` | `'none'`, `'even'`, or `'odd'` | |
| 89 | +| `timeout_us` | Read timeout in [us]. | |
| 90 | +| `hardware_flow_control` | `'none'`, `'rtscts'`, or `'xonxoff'` | |
| 91 | +| `no_baudrate` | Do not set any baudrate on device. | |
| 92 | +| `use_clocal` | Ignore modem control lines | |
| 93 | +| `post_open_script` | Shellscript to run after device was opened. | |
| 94 | +| `async_low_latency` | Asynchronous low latency. | |
| 95 | +| `configure_rs485` | Configure device for RS485 mode. | |
| 96 | + |
| 97 | +--- |
| 98 | + |
| 99 | +## ✨ Features |
| 100 | + |
| 101 | +- Abstracts POSIX TTY interfaces (e.g. `/dev/ttyS*`, `/dev/ttyUSB*`) |
| 102 | +- Asynchronous I/O via robotkernel data streams. |
| 103 | +- Configurable baud rate, parity, stop bits, flow control, etc. |
| 104 | +- Modular design for custom read/write message handling |
| 105 | + |
| 106 | +--- |
| 107 | + |
| 108 | +## ⚙️ Runtime Behavior |
| 109 | + |
| 110 | +- Hooks into the HAL execution loop |
| 111 | +- Uses blocking or non-blocking I/O for real-time compatibility |
| 112 | +- Emits incoming data as messages to downstream modules |
| 113 | +- Retrieves queued messages from other modules and sends them out |
| 114 | + |
| 115 | +--- |
| 116 | + |
| 117 | +## 🔧 Example Output |
| 118 | + |
| 119 | +```text |
| 120 | +TODO |
| 121 | +``` |
| 122 | + |
| 123 | +--- |
| 124 | + |
| 125 | +## 🖼️ Architecture Diagram |
| 126 | + |
| 127 | +```text |
| 128 | ++------------------+ +------------------+ |
| 129 | +| Robotkernel HAL | <----> | module_tty.so | |
| 130 | ++------------------+ +--------+---------+ |
| 131 | + | |
| 132 | + v |
| 133 | + +---------------+ |
| 134 | + | /dev/ttyUSB0 | |
| 135 | + +---------------+ |
| 136 | +``` |
| 137 | + |
| 138 | +--- |
| 139 | + |
| 140 | +## 📦 Build & Installation |
| 141 | + |
| 142 | +Please make sure that the prerequisites are installed. These are: |
| 143 | + |
| 144 | + robotkernel |
| 145 | + |
| 146 | +Then you should be able to build module_tty with: |
| 147 | + |
| 148 | +```bash |
| 149 | +git clone https://github.com/robotkernel-hal/module_tty.git |
| 150 | +cd module_tty |
| 151 | +./bootstrap.sh |
| 152 | +autoreconf -i -f |
| 153 | +mkdir build && cd build |
| 154 | +../configure |
| 155 | +make |
| 156 | +sudo make install |
| 157 | +``` |
| 158 | + |
| 159 | +--- |
| 160 | + |
| 161 | +## 🧪 Testing |
| 162 | + |
| 163 | +```bash |
| 164 | +TODO |
| 165 | +``` |
| 166 | + |
| 167 | +Use `socat` or virtual PTYs to simulate devices if physical serial ports are unavailable: |
| 168 | + |
| 169 | +```bash |
| 170 | +socat -d -d pty,raw,echo=0 pty,raw,echo=0 |
| 171 | +``` |
| 172 | + |
| 173 | +--- |
| 174 | + |
| 175 | +## 🤝 Contributing |
| 176 | + |
| 177 | +Contributions welcome! Please ensure: |
| 178 | + |
| 179 | +- No compiler warnings |
| 180 | +- Code follows robotkernel coding rules |
| 181 | +- Tests included for new features |
| 182 | + |
| 183 | +--- |
| 184 | + |
| 185 | +## 📄 License |
| 186 | + |
| 187 | +Licensed under the **LGPL-V3 License**. See the [LICENSE](LICENSE) file. |
| 188 | + |
| 189 | +--- |
| 190 | + |
| 191 | +**Robotkernel HAL Project** – powering real-time robotics infrastructure with modular, modern C++ |
| 192 | + |
0 commit comments