Tutorial: Motor Control#
Throughout this section, refer to the Joint Indexes (YARP ports) diagram to see port names and joint indexes, as well as the Joint Directions of Rotation diagram.
Directly talking to ports#
Recall that this is hackish and subject to change. From a terminal, connect to the limb you prefer (substitute leftArm
following the above mentioned diagram):
yarp rpc /teoSim/leftArm/rpc:i
From within this, we can send joint space movements, read encoders, etc. For instance, send an absolute joint position command, to joint 0, setting the target to -25 degrees:
set pos 0 -25
You should in turn receive should get some kind of feedback, such as:
Response: [ok]
In line with the hacks mentioned above, refer to a more exhaustive list at: yarp-tricks: remote_controlboard (from developer-manual)
Via GUIs#
Two options to launch the YARP motor GUI for teoSim
:
-
Via terminal:
yarpmotorgui --from yarpmotorgui/teoSim.ini
-
Via the application manager (better practice): Navigate through
Applications
>teoSimTools_App
> right-click onyarpmotorgui
>Run
Any of the two options, and clicking OK
(ignore the current warnings regarding hands for now) should get you a window similar to the one depicted below.
Via APIs#
The preferred approach, using the APIs provided by YARP within our programs and scripts.
- APIs
- The YARP motor control interfaces
- yarp::dev::IPositionControl
- yarp::dev::IVelocityControl
- yarp::dev::ITorqueControl
- yarp::dev::IEncoders
- Implementation in simulator
- Implementation in real robot
- Examples (in the
remote
line, switch to/teoSim/leftArm
or the limb of your selection) - C++
- MATLAB
- Python