17int main(
int argc,
char *argv[])
22 params.fromCommand(argc, argv);
24 if (!params.check(
"robot"))
26 fprintf(stderr,
"Please specify the name of the robot\n");
27 fprintf(stderr,
"--robot name (e.g. icub)\n");
30 std::string robotName=params.find(
"robot").asString();
31 std::string remotePorts=
"/";
32 remotePorts+=robotName;
33 remotePorts+=
"/right_arm";
35 std::string localPorts=
"/test/client";
38 options.put(
"device",
"remote_controlboard");
39 options.put(
"local", localPorts);
40 options.put(
"remote", remotePorts);
43 PolyDriver robotDevice(options);
44 if (!robotDevice.isValid()) {
45 printf(
"Device not available. Here are the known devices:\n");
46 printf(
"%s", Drivers::factory().toString().c_str());
50 IPositionControl *pos;
54 ok = robotDevice.view(pos);
55 ok =
ok && robotDevice.view(encs);
58 printf(
"Problems acquiring interfaces\n");
72 for (i = 0; i < nj; i++) {
75 pos->setRefAccelerations(tmp.data());
77 for (i = 0; i < nj; i++) {
79 pos->setRefSpeed(i, tmp[i]);
86 printf(
"waiting for encoders");
87 while(!encs->getEncoders(encoders.data()))
100 pos->positionMove(command.data());
106 pos->checkMotionDone(&
done);
129 pos->positionMove(command.data());
135 bool ret=encs->getEncoders(encoders.data());
139 fprintf(stderr,
"Error receiving encoders, check connectivity with the robot\n");
143 printf(
"%.1lf %.1lf %.1lf %.1lf\n", encoders[0], encoders[1], encoders[2], encoders[3]);