Skip to content

Commit b2cbb0e

Browse files
committed
Merge branch 'release/6.0.0' of github.com:robotkernel-hal/module_dsp402 into release/6.0.0
2 parents 9193379 + 49dbe9c commit b2cbb0e

1 file changed

Lines changed: 153 additions & 6 deletions

File tree

README.md

Lines changed: 153 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,43 @@
11
# module_dsp402
22

3-
This module implements the CiA DSP 402 state machine. Therefore it takes an input and output process data with the statusword and the controlword and exports new process data to control the state machine in an easier way.
3+
[![Build and Publish Debian Package](https://github.com/robotkernel-hal/module_dsp402/actions/workflows/build-deb.yaml/badge.svg)](https://github.com/robotkernel-hal/module_dsp402/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-
# DSP402 control state machine module
9+
**Robotkernel‑5 handler module for implementing the CiA DSP‑402 state machine per axis**
10+
11+
This module wraps the **DSP‑402** drive-control state machine (CiA 402) to simplify interaction with EtherCAT-connected axes using `Controlword` / `Statusword`. It synchronizes drive commands and states via Robotkernel triggers and axis-level abstraction.
12+
13+
---
14+
15+
## ✨ Features
16+
17+
- Implements full CiA DSP‑402 drive state transitions
18+
- Maps EtherCAT PDO process data (`Statusword`/`Controlword`) to axis logic
19+
- Flexible YAML configuration via named devices or class‑instance templates
20+
- Trigger‑based synchronization on inputs and outputs
21+
- Supports multiple axes neatly handled via loop or templates
22+
23+
---
24+
25+
## 🧠 Typical Use Case
26+
27+
The module is used in systems with drives/axes that support CiA DSP402 (e.g., Beckhoff AX5000, Elmo, Kollmorgen), enabling the host to easily control the drive's state machine without manually encoding complex Controlword sequences.
28+
29+
---
30+
31+
## 🔌 Dependencies
32+
33+
- [module_ethercat](https::/github.com/robotkernel-hal/module_ethercat.git) or another process data source
34+
- Real-time capable host for cycle-exact communication (recommended)
35+
36+
---
37+
38+
## 🧩 Configuration
39+
40+
### Simple Single-Axis Setup
641

742
```yaml
843
- name: dsp402
@@ -20,12 +55,14 @@ This module implements the CiA DSP 402 state machine. Therefore it takes an inpu
2055
depends: [ ecat ]
2156
```
2257
58+
### Axis Template with Multiple Instances
59+
2360
```yaml
2461
- name: dsp402
2562
so_file: libmodule_dsp402.so
2663
config:
2764
classes:
28-
my_axis:
65+
axis_template:
2966
name: ($axis_name)
3067
pdin: ($inputs_name).pd
3168
pdin_trigger: ($inputs_name).trigger
@@ -34,13 +71,14 @@ This module implements the CiA DSP 402 state machine. Therefore it takes an inpu
3471
status_word_name: Statusword
3572
control_word_name: Controlword
3673
instances:
37-
- { use_class: my_axis, axis_name: axis_1, inputs_name: ecat.slave_1.inputs, outputs_name: ecat.slave_1.outputs }
38-
- { use_class: my_axis, axis_name: axis_2, inputs_name: ecat.slave_2.inputs, outputs_name: ecat.slave_2.outputs }
39-
- { use_class: my_axis, axis_name: axis_3, inputs_name: ecat.slave_3.inputs, outputs_name: ecat.slave_3.outputs }
74+
- { use_class: axis_template, axis_name: axis_1, inputs_name: ecat.slave_1.inputs, outputs_name: ecat.slave_1.outputs }
75+
- { use_class: axis_template, axis_name: axis_2, inputs_name: ecat.slave_2.inputs, outputs_name: ecat.slave_2.outputs }
4076
power_up: op
4177
depends: [ ecat ]
4278
```
4379
80+
### Complete Template
81+
4482
```yaml
4583
# Configuration file for PULSAR DSP402 module.
4684
#
@@ -78,3 +116,112 @@ devices:
78116
# Name of the Control Word in <pdout>
79117
control_word_name: Controlword
80118
```
119+
120+
121+
---
122+
123+
## ⚙️ Mapping and Behavior
124+
125+
- **`pdin` / `pdin_trigger`**: Input PDO device and its associated trigger signal
126+
- **`pdout` / `pdout_trigger`**: Output PDO device and its trigger
127+
- **`status_word_name`**, **`control_word_name`**: Field names within the PDO frames for DSP‑402 state logic
128+
- The module processes each axis individually, driving transitions based on received `Statusword` and desired states.
129+
130+
---
131+
132+
## 🔄 Runtime Behavior
133+
134+
The module:
135+
136+
1. Reads Statusword from input PDOs.
137+
2. Applies internal DSP402 state logic.
138+
3. Outputs an appropriate Controlword to guide the drive into desired states (e.g. Switch On, Enable Operation).
139+
140+
It simplifies FSM control typically required for enabling axes in automation systems.
141+
142+
---
143+
144+
## 🔍 Debugging Tips
145+
146+
- Ensure that pdin and pdout references are correct and that they map to real EtherCAT slave PDOs.
147+
- Use status_word_name and control_word_name strings that match exactly with your PDO definitions (as per SDO configuration or ESI files).
148+
149+
---
150+
151+
## 🖼️ State Machine Diagram
152+
153+
```mermaid
154+
stateDiagram-v2
155+
[*] --> NotReadyToSwitchOn
156+
NotReadyToSwitchOn --> SwitchOnDisabled : Power On
157+
SwitchOnDisabled --> ReadyToSwitchOn : Initialized
158+
ReadyToSwitchOn --> SwitchedOn : Switch On
159+
SwitchedOn --> OperationEnabled : Enable Operation
160+
OperationEnabled --> QuickStopActive : Quick Stop
161+
QuickStopActive --> OperationEnabled : Quick Stop Released
162+
OperationEnabled --> Fault : Fault Detected
163+
Fault --> FaultReactionActive : Fault Reaction
164+
FaultReactionActive --> Fault : Restart
165+
Fault --> SwitchOnDisabled : Fault Reset
166+
```
167+
168+
---
169+
170+
## 🔧 Tips & Best Practices
171+
172+
- Align `pdin_trigger` and `pdout_trigger` with Robotkernel’s cycle to ensure proper axis timing.
173+
- One `Statusword`/`Controlword` pair per axis only.
174+
- Confirm each EtherCAT slave is in **Operational** mode for DSP‑402 behavior to be valid.
175+
176+
---
177+
178+
## 📦 Build & Installation
179+
180+
Please make sure that the prerequisites are installed. These are:
181+
182+
robotkernel
183+
184+
Then you should be able to build module_dsp402 with:
185+
186+
```bash
187+
git clone https://github.com/robotkernel-hal/module_dsp402.git
188+
cd module_dsp402
189+
./bootstrap.sh
190+
autoreconf -i -f
191+
mkdir build && cd build
192+
../configure
193+
make
194+
sudo make install
195+
```
196+
197+
---
198+
199+
## 🧪 Testing
200+
201+
```bash
202+
ctest
203+
```
204+
205+
Use Robotkernel runtime with simulated or real EtherCAT PDO frames for validation.
206+
207+
---
208+
209+
## 🤝 Contributing
210+
211+
Contributions welcome! Please ensure:
212+
213+
- Consistent builds using autotools
214+
- No compiler warnings
215+
- Code follows robotkernel coding rules
216+
- New features accompanied by tests
217+
- CI workflows pass successfully before submitting PR
218+
219+
---
220+
221+
## 📄 License
222+
223+
Licensed under the **LGPL-V3 License**. See the [LICENSE](LICENSE) file.
224+
225+
---
226+
227+
**Robotkernel HAL Project** – powering real-time robotics infrastructure with modular, modern C++

0 commit comments

Comments
 (0)