42#include <yarp/os/Network.h>
43#include <yarp/os/Property.h>
44#include <yarp/os/Time.h>
46#include <yarp/dev/PolyDriver.h>
47#include <yarp/dev/IControlMode.h>
48#include <yarp/dev/IEncodersTimed.h>
49#include <yarp/dev/IPositionControl.h>
50#include <yarp/dev/IVelocityControl.h>
52int main(
int argc,
char *argv[])
54 std::printf(
"INFO: requires a running robot counterpart.\n");
55 yarp::os::Network yarp;
57 if (!yarp::os::Network::checkNetwork())
59 std::printf(
"Please start a yarp name server first\n");
63 yarp::os::Property options;
64 options.put(
"device",
"remote_controlboard");
65 options.put(
"remote",
"/robot/limb");
66 options.put(
"local",
"/local");
68 yarp::dev::PolyDriver dd(options);
72 std::printf(
"Device not available.\n");
76 yarp::dev::IPositionControl *pos;
77 yarp::dev::IVelocityControl *vel;
78 yarp::dev::IEncodersTimed *enc;
79 yarp::dev::IControlMode *mode;
89 std::printf(
"ERROR: Problems acquiring robot interface\n");
93 std::printf(
"SUCCESS: Acquired robot interface\n");
98 std::vector<int> posModes(axes, VOCAB_CM_POSITION);
99 mode->setControlModes(posModes.data());
101 std::printf(
"test positionMove(1, 35.0)\n");
102 pos->positionMove(1, 35.0);
104 std::printf(
"Delaying 5 seconds...\n");
105 yarp::os::Time::delay(5.0);
107 std::vector<int> velModes(axes, VOCAB_CM_VELOCITY);
108 mode->setControlModes(velModes.data());
110 std::printf(
"test velocityMove(0, 10.0)\n");
111 vel->velocityMove(0, 10.0);
113 std::printf(
"Delaying 5 seconds...\n");
114 yarp::os::Time::delay(5.0);
116 vel->velocityMove(0, 0.0);