Difference between revisions of "Motor control"

From Wiki for iCub and Friends
Jump to: navigation, search
(Motor control in Yarp, a brief tutorial)
Line 7: Line 7:
 
   Property options;
 
   Property options;
 
   options.put("robot", "icub"); // typically from the command line.
 
   options.put("robot", "icub"); // typically from the command line.
   options.put("device", "remote_controlboard");
+
   options.put("device", "remote_controlboard"); \
 
+
\
 
   Value& robotname = options.find("robot");
 
   Value& robotname = options.find("robot");
 
   yarp::String s("/");
 
   yarp::String s("/");

Revision as of 19:00, 25 July 2006

Motor control in Yarp, a brief tutorial

Motor control in Yarp is done through a device driver. For more documentation please see: Yarp on SF and the related classes. The project on the iCub repository under src/simple_headcontrol is a good example to start playing with motor control. This example uses a remoted device driver which exports exactly the same interfaces of the actual device driver (initialization is different). Clearly, the main difference between the two is in terms of efficiency, if you're developing a low-level control loop you might want to be local, on the other hand a simple sporadic position control can be effected through the remote device driver. Let's assume we have started the server side already (e.g. using yarpdev).

In practice, we start by preparing a set of configuration parameters:

 Property options;
 options.put("robot", "icub"); // typically from the command line.
 options.put("device", "remote_controlboard"); \

\

 Value& robotname = options.find("robot");
 yarp::String s("/");
 s += robotname.asString();
 s += "/head/control";
 options.put("local", s.c_str());
 s.clear();
 s += "/";
 s += robotname.asString();
 s += "/head";
 options.put("remote", s.c_str());

where the local and remote parameters are used to set the port names for the connection to the server side.