You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The plugin requires a configuration file defining the EtherCAT network and device parameters. An example can be found at: [`config/robot/adj8/config.xml`](config/robot/adj8/config.xml)
53
+
The plugin requires a configuration file defining the EtherCAT network and device parameters. An example can be found at: [`config/robot/template_1_motor/config.xml`](config/robot/template_1_motor/config.xml)
54
54
55
55
### Setting Up `yarprobotinterface` 🛠️
56
56
To ensure that the `yarprobotinterface` binary has the correct permissions and can locate its dependencies, execute:
@@ -71,10 +71,12 @@ This plugin has been primarily tested with Synapticon drives. While it may be co
71
71
72
72
If you're looking to adapt the plugin for different hardware, we encourage you to open an issue or contribute improvements.
73
73
74
-
### Note on PDO Mapping 📝
75
-
The plugin includes a custom mapping of the **Safe Torque Off (STO)** and **Safe Brake Control (SBC)** signals into PDOs. This design choice enables the EtherCAT master to access real-time data on these critical safety features, enhancing runtime monitoring and safety state management.
74
+
### Additional notes 📝
75
+
For more details, see:
76
+
- Protocol map — PDOs, SDOs, and conversion formulas: [doc/protocol_map.md](./doc/protocol_map.md)
77
+
- Modes and setpoints — available control modes and targets: [doc/modes_and_setpoints.md](./doc/modes_and_setpoints.md)
78
+
- Dual encoder handling — mounts, sources, and transformations: [doc/dual_encoder_handling.md](./doc/dual_encoder_handling.md)
76
79
77
-
Although this approach diverges from strict CiA402 compliance, it brings practical advantages: improved fault detection, smoother safety transitions, and more robust motion control. The mapping is handled by the `configurePDOMapping` method in the `EthercatManager` class, ensuring that STO and SBC statuses are continuously updated and readily available for real-time decision-making.
78
80
79
81
## License 📜
80
82
This project is licensed under the BSD-3-Clause License. See the [`LICENSE`](LICENSE) file for details.
This document describes how **`CiA402MotionControl`** and **`EthercatManager`** manage dual encoders per axis, how EtherCAT PDOs are mapped, and how values are converted into YARP’s expected units.
4
-
It is intended as a **developer guide to the code**, with emphasis on configuration, feedback/command pipelines, and validation logic.
3
+
## Summary
4
+
How the driver uses two encoders per axis: mounting semantics, loop sources, feedback selection, shaft transforms, and data pipelines.
5
5
6
-
---
7
6
8
-
## 1) EtherCAT PDO mapping
9
-
10
-
PDO mapping is configured in `EthercatManager::configurePDOMapping`.
11
-
12
-
### RxPDO 0x1600 (Master → Slave, fixed)
13
-
14
-
| Object | Index | Size | Standard / Vendor | Notes |
| Motor velocity |`velocity_feedback_motor`|`"606C"`, `"enc1"`, `"enc2"`|
24
+
## Drive loop sources
25
+
The drive’s control loops run off an internal source selection for position and velocity. The driver reads the “position loop source” and “velocity loop source” SDOs (indices listed in protocol_map.md) to interpret what `6064/606C` refer to. If a loop source is unknown, a conservative fallback is used (prefer Enc1 if mounted, else Enc2).
81
26
82
-
**Validation (`open()`):**
27
+
## Feedback source selection
28
+
Validation performed during `open()`:
29
+
- If `position/velocity_feedback_*` is `enc1`/`enc2`, that encoder must be mounted and present in the PDO map, otherwise configuration fails.
30
+
- If the source is `6064/606C`, values are interpreted in the context of the loop source selection above.
83
31
84
-
* If a source = `enc1`/`enc2`, then:
85
-
86
-
* That encoder must be **mounted** and
87
-
* Its PDO entry must be **mapped**.
88
-
Otherwise: `invalid config: encX not mounted/mapped`.
89
-
* If a source = `6064`/`606C`, values are interpreted according to `posLoopSrc` / `velLoopSrc`.
90
-
If loop source is `Unknown`, fallback = Enc1 if present, else Enc2.
***Error:**`invalid config: encX not mounted/mapped`
248
-
→ Config requested an encoder not present in PDOs. Fix XML mapping or mounts.
249
-
***Joint/motor look identical**
250
-
→ Check gear ratio values; or both encoders are on same shaft.
251
-
***6064/606C look wrong**
252
-
→ Verify loop source SDOs 0x2012:09 / 0x2011:05.
76
+
- Unknown loop source → prefer Enc1 if mounted.
77
+
- Accelerations → always `0.0`.
78
+
- Safety/timestamp PDOs are handled when present.
79
+
80
+
## Command pipeline (overview)
81
+
- Velocity mode (CSV): joint deg/s are transformed to the loop shaft and converted to rpm, then written to the velocity target. A first‑cycle latch suppresses non‑zero output.
82
+
- Torque/Current mode (CST):
83
+
- Torque path: joint Nm → motor Nm → per‑thousand of rated motor torque (see protocol_map.md for formulas and rated‑torque SDO).
84
+
- Current path: A → motor Nm via torque constant → per‑thousand (see protocol_map.md).
85
+
- On mode or CST‑flavor change, set‑points/latches are cleared to avoid stale outputs.
86
+
87
+
## Valid config examples
88
+
1) Motor encoder only
89
+
- enc1_mount=motor, enc2_mount=none
90
+
- joint feedback derived from Enc1 with gear ratio inversion.
91
+
92
+
2) Joint encoder only
93
+
- enc1_mount=none, enc2_mount=joint
94
+
- motor feedback derived via gear ratio.
95
+
96
+
3) Dual (classical)
97
+
- enc1_mount=motor, enc2_mount=joint
98
+
- position_joint=enc2, position_motor=enc1
99
+
- velocity_joint=606C (if vel loop source = Enc2), velocity_motor=606C or enc1.
100
+
101
+
4) Redundant/diagnostic
102
+
- both mounted; expose 6064/606C for drive loops, plus direct enc1/enc2 for cross‑checks.
103
+
104
+
## Edge cases & notes
105
+
- gearRatio=0 → invalid; conversions return 0.
106
+
- Sign conventions must be consistent externally if mounts imply inversion.
107
+
- Backlash detection (motor vs joint encoder) is out of scope.
108
+
- PDO rollover is handled; always check presence before reading optional entries.
109
+
110
+
## Troubleshooting
111
+
- Error: invalid config (encX not mounted/mapped) → Fix XML mapping or mounts.
112
+
- Joint/motor look identical → Check gear ratio; or both encoders are on the same shaft.
0 commit comments