roboticslab-uc3m / yarp-devices

A place for YARP devices
https://robots.uc3m.es/yarp-devices/
9 stars 7 forks source link

Prepare alternative (external) PID controller implementation #262

Closed PeterBowman closed 1 year ago

PeterBowman commented 1 year ago

I was wondering if moving the position/velocity control loops out of the embedded iPOS firmware would be both possible and beneficial, mostly in terms of things we cannot achieve today (i.e. impedance control and compliance). It is my guess that the "slow" iPOS control loops, i.e. 0.5-1 ms, are probably fast enough for our needs. For this new implementation, I am considering a 5 ms comms/control loop basing on available CAN bandwidth. Torque/current control shall remain handled by the embedded "fast" loop (0.05-0.1 ms).

Related issues:

New interface implementations are expected for:

Additional tools should be developed for obtaining friction and PID parameters. If done right, perhaps the simulator could yield similar results in case testing on the real joints renders difficult.

PeterBowman commented 1 year ago

Regarding trajectory generation, I think I will go with a simple trapezoidal one. See gazebo-yarp implementation (https://github.com/robotology/gazebo-yarp-plugins/pull/527):

Some info on minimum jerk trajectory generators:

PeterBowman commented 1 year ago

I am introducing a buffer class for storing high-frequency commands. This will be an intermediate layer between the commands sent to the robot through the YARP network ("slow" pace) and the commands sent to the iPOS via CAN bus ("fast" pace), using linear interpolation to ensure certain degree of smoothness (cf. https://github.com/roboticslab-uc3m/yarp-devices/issues/254). In the embedded PID implementation, this need not to pose any difference as users may still adjust the sender's period to the internal preconfigured --syncPeriod, which will bypass any interpolation and buffering. In the external PID implementation, though, control loops are always expected to run fast according to the selected --syncPeriod, while incoming commands need not to stick to it, and will commonly arrive at a slower rate. Said rate doesn't need any preconfiguration and, though not recommended, may vary. The buffer helps therefore to decouple the strictly regular CAN transmit rate imposed by --syncPeriod from any external source of command targets arriving at a (usually) different pace.

PeterBowman commented 1 year ago

I am introducing a buffer class for storing high-frequency commands.

Implemented and backported to master at https://github.com/roboticslab-uc3m/yarp-devices/commit/3a8f15beb8ee2debda76f15be2cfce5747597de4, also documented at https://github.com/roboticslab-uc3m/teo-developer-manual/commit/8e31a1129a3ee35b0505719dbe949ee4b0d6acc7.

PeterBowman commented 1 year ago

Done at https://github.com/roboticslab-uc3m/yarp-devices/commit/f5009c62a74574e7e4e75aa8aef00fcf71c4070e. A few thing I'd like to check next: