Closed PeterBowman closed 4 years ago
A standard-compliant and perhaps more feature-attractive alternative exists: CSV (cyclic synchronous velocity) mode. It is achieved in CSP mode (cyclic synchronous position, see https://github.com/roboticslab-uc3m/yarp-devices/issues/222) with relative positioning. See iPOS CANopen user manual (2019), section 10.1.1, Controlword in Cyclic Synchronous Position mode (CSP):
In absolute position mode, the drive will always travel to the absolute position given to object 607Ah. This is the standard mode.
In relative position mode, the drive will add to its current position the value received in object 607Ah. By sending this value periodically and setting the correct interpolation period time in object 60C2h, it will be like working in Cyclic Synchronous Velocity mode (CSV).
It is achieved in CSP mode (cyclic synchronous position, see #222) with relative positioning.
Disclaimer, to be honest: this is not velocity control per se. We are going to mask velocity commands passing through yarp::dev::IVelocityControl
into relative position targets, that is, there will always be a position control loop under the hood. Spoken with @jgvictores and @smcdiaz.
Disclaimer, to be honest: this is not velocity control per se.
In addition, the velocity profile mode of operation (iPOS) adheres best to yarp::dev::IVelocityControl
commands, note the acceleration-related methods. We discarded this iPOS mode due to previous failures in movl
commands via BasicCartesianControl. Today, however, we tried again and succeeded: motion followed a nice linear path with a SYNC/command period of 30 milliseconds and a 0.5 gain. In fact, we were able to extend TEO's right arm even with a 1 kg load attached to it, ultimately achieving millimeter precision. We just had to switch back to position control mode in order to avoid the arm falling down on motion completion: https://github.com/roboticslab-uc3m/kinematics-dynamics/commit/d5f6ebd9c24d39ac8049d28ba394dd9644d8a15f.
I'm happily closing this as WONTFIX.
ASWJ we'd like to allow users to enter into CSV mode at will via IRemoteVariables
, i.e. change the internal mapping for IVelocityControl
commands (default: velocity profile mode).
Proposed protocol: https://github.com/roboticslab-uc3m/yarp-devices/issues/222#issuecomment-575095243.
Implemented at https://github.com/roboticslab-uc3m/yarp-devices/commit/a5f2c7a253f25ee7bcf415bd7cd30177a5ebfbdc and ultimately ready at https://github.com/roboticslab-uc3m/yarp-devices/commit/d747bb092bb59ef8e888bb11234a7e7037e547db after a thorough improvement of the IRemoteVariables
interface. To expand on https://github.com/roboticslab-uc3m/yarp-devices/issues/222#issuecomment-575095243:
getRemoteVariablesList
Lists all CAN node IDs prepended with "id", e.g. (id15 id16 ...)
.
[get] [ivar] [lvar]
(id15 id16 id17 id18 id19 id20)
getRemoteVariable
Retrieves all available key-value pairs for the selected node. Calls getRemoteVariablesListRaw
to get raw keys and then iterates on getRemoteVariableRaw
.
[get] [ivar] [mvar] id15
(id15 (linInterp ((enable 0))) (csv (enable 0)))
If key
equals all
, it returns remote vars for all available CAN nodes.
[get] [ivar] [mvar] all
((id15 (linInterp ((enable 0))) (csv (enable 0))) (id16 (linInterp ((enable 0))) (csv (enable 0))) (id17 (linInterp ((enable 0))) (csv (enable 0))) (id18 (linInterp ((enable 0))) (csv (enable 0))) (id19 (linInterp ((enable 0))) (csv (enable 0))) (id20 (linInterp ((enable 0))) (csv (enable 0))))
setRemoteVariable
Requires a key-value two-element bottle, value is a nested list.
[set] [ivar] [mvar] id15 (linInterp ((enable 1) (mode pt) (bufferSize 1)))
Multiple keys can be bound per call, just nest them within an additional layer of bottles.
[set] [ivar] [mvar] id15 ((linInterp ((enable 1) (mode pt) (bufferSize 1))) (csv (enable 1)))
Same strategy works if you want to set the exact same remote variable (or variables) for all available nodes, just use all
as key.
[set] [ivar] [mvar] all (linInterp ((enable 1) (mode pt) (bufferSize 1)))
[set] [ivar] [mvar] all ((linInterp ((enable 1) (mode pt) (bufferSize 1))) (csv (enable 1)))
It is also possible to target multiple nodes in a single call, and set one or more remote variables at once. Use multi
as key.
[set] [ivar] [mvar] multi ((id15 (csv (enable 1))) (id17 (csv (enable 0))))
[set] [ivar] [mvar] multi ((id16 ((linInterp ((enable 0))) (csv (enable 1)))) (id20 (csv (enable 1))))
Yes, the more you look at it, the more Lispy it feels: https://xkcd.com/297/.
Commit https://github.com/roboticslab-uc3m/yarp-devices/commit/66afe3fb8dc61b022561a9570187d7195152b310 adds an enable
option that reflects and controls internal state of both linInterp
and csv
raw variables. I reflected it in the above comment. Note we get and set a dictionary in linInterp
, whereas csv
is happy with a bare list.
I might revisit and vastly change this remote-vars interface at https://github.com/roboticslab-uc3m/yarp-devices/issues/260.
Edit: done, see README.
Our
yarp::dev::IVelocityControl
implementation uses Technosoft's Profile Velocity mode of operation. This mode implies a known acceleration ramp (given byIVelocityControl::setRefAcceleration
, also available in theIPositionControl
interface), that is, the drive will never command the motor to achieve the desired velocity instantaneously. On the other hand, in external reference speed mode it is assumed that the acceleration is not limited given the default configuration:We might want to check this mode out in the context of a velocity-controlled application.