19#include <yarp/os/Network.h> 
   20#include <yarp/os/Time.h> 
   21#include <yarp/os/Log.h> 
   22#include <yarp/os/LogStream.h> 
   23#include <yarp/os/BufferedPort.h> 
   24#include <yarp/sig/Vector.h> 
   25#include <yarp/math/Math.h> 
   27#include <yarp/dev/ControlBoardInterfaces.h> 
   28#include <yarp/dev/PolyDriver.h> 
   29#include <yarp/os/PeriodicThread.h> 
   30#include <yarp/os/Thread.h> 
   40using namespace yarp::os;
 
   41using namespace yarp::sig;
 
   43using namespace yarp::math;
 
   58    for (
int i=0; i<N_JOINTS; i++) 
q_joints[i]=0.0;
 
 
   64    N_JOINTS = as.N_JOINTS;
 
   69    for (
int i=0; i< N_JOINTS; i++)
 
 
   79    N_JOINTS = as.N_JOINTS;
 
   84    for (
int i=0; i< N_JOINTS; i++)
 
 
  118        for (
int i=0; i< 
action_it->get_n_joints(); i++)
 
 
  128    data_file = fopen(filename.c_str(),
"r");
 
  135            char command_line[1024];
 
  136            bb = fgets (command_line, 1024, data_file);
 
  142                    yError (
"error parsing file, line %d\n", line);
 
  153        yError(
"unable to find file\n");
 
 
  161    static int count = 0;
 
  162    static double time =0.0;
 
  165    tmp_action.
counter = count; count = count + 1;
 
  169    size_t ss = strlen(command_line);
 
  170    char* cline = 
new char [ss];
 
  171    strcpy(cline,command_line);
 
  172    tok = strtok (cline,
" ");
 
  174    int joints_count = 0;
 
  175    while (tok != 0 && joints_count < n_joints)
 
  177        sscanf(tok, 
"%lf", &tmp_action.
q_joints[i++]);
 
  178        tok = strtok (NULL,
" ");
 
 
  207    char command_line_format [1000];
 
  208    sprintf(command_line_format, 
"%%d %%lf    ");
 
  209    for (
int i = 0; i < n_joints; i++)
 
  211        size_t off = strlen(command_line_format);
 
  212        sprintf(command_line_format+off, 
"%%lf ");
 
  215    int ret = sscanf(command_line, 
"%d %lf    %lf %lf %lf %lf %lf %lf", 
 
  227    if (ret == n_joints+2) 
 
 
  243    drvOptions_ll.clear();
 
 
  259    Property &options=
const_cast<Property &
> (copt);
 
  261    drvOptions_ll.put(
"device",
"remote_controlboard");
 
  263    if (!options.check(
"robot")) { yError() << 
"Missing robot parameter"; 
return false; }
 
  264    if (!options.check(
"part")) { yError() << 
"Missing part parameter"; 
return false; }
 
  268    remote_ll = string(
"/") + string(options.find(
"robot").asString()) + string(
"/") +string(options.find(
"part").asString());
 
  269    local_ll  = string(
"/") + string(
"trajectoryPlayer") + string(
"/") + string(options.find(
"part").asString());
 
  270    drvOptions_ll.put(
"remote",remote_ll.c_str());
 
  271    drvOptions_ll.put(
"local",local_ll.c_str());
 
  275        yDebug() << 
"driver options:\n" << drvOptions_ll.toString().c_str();
 
 
  283    drv_ll=
new PolyDriver(drvOptions_ll);
 
  285    if (drv_ll->isValid())
 
  286        drv_connected = drv_ll->view(ipos_ll) && drv_ll->view(iposdir_ll) && drv_ll->view(ienc_ll) && drv_ll->view(ipid_ll) && drv_ll->view(imotenc_ll) && drv_ll->view(icmd_ll);
 
  304    double* speeds = 
new double [
n_joints];
 
  305    for (
int i=0; i<
n_joints; i++) speeds[i] = 20.0;
 
  306    ipos_ll->setRefSpeeds(speeds);
 
  309    return drv_connected;
 
 
  323    if (!icmd_ll) 
return false;
 
  324    return icmd_ll->setControlMode(
joints_map[j], mode);
 
 
  329    if (!iposdir_ll) 
return false;
 
  330    return iposdir_ll->setPosition(
joints_map[j], ref);
 
 
  335    if (!ienc_ll) 
return false;
 
 
  341    if (!ipos_ll) 
return false;
 
  342    return ipos_ll->positionMove(
joints_map[j], v);
 
 
std::deque< action_struct >::iterator action_it
 
bool parseCommandLineFixTime(const char *command_line, int line, double fixTime, int n_joints)
 
bool parseCommandLine(const char *command_line, int line, int n_joints)
 
std::deque< action_struct > action_vector
 
bool openFile(string filename, int n_joints)
 
action_struct & operator=(const action_struct &as)
 
std::map< int, int > joints_map
 
bool setPosition(int j, double ref)
 
bool setControlMode(const int j, const int mode)
 
bool getEncoder(int j, double *v)
 
bool configure(const Property &copt)
 
bool positionMove(int j, double ref)