Example #1
0
int main(int argc, char *argv[]) 
{
    Network yarp;

    ResourceFinder rf;
    rf.setVerbose(false);
    rf.setDefaultContext("controlBoardDumper");
    rf.setDefaultConfigFile("controlBoardDumper.ini");

    rf.setDefault("part","head");
    rf.setDefault("robot","icub");
    rf.setDefault("rate","500");
    rf.setDefault("joints","(0)");
    rf.setDefault("dataToDump","(getEncoders getEncoderSpeeds getEncoderAccelerations getPositionErrors getOutputs getCurrents getTorques getTorqueErrors)");    
    rf.configure(argc,argv);

    if (rf.check("help"))
    {
        printf ("\ncontrolBoardDumper usage:\n");
        printf ("1) controlBoardDumper --robot icub --part left_arm --rate 10  --joints \"(0 1 2)\" \n");
        printf ("   All data from the controlBoarWrapper will be dumped, except for advanced debugInterface (default).\n");
        printf ("\n2) controlBoardDumper --robot icub --part left_arm --rate 10  --joints \"(0 1 2)\" --dataToDump \"(xxx xxx)\"\n");
        printf (" where xxx can be uset to select one (or more) from the following:\n");
        printf (" getEncoders             (joint position)\n");
        printf (" getEncoderSpeeds        (joint velocity)\n");
        printf (" getEncoderAccelerations (joint acceleration)\n");
        printf (" getPositionErrors       (difference between desired and actual position)\n");
        printf (" getTorqueErrors         (difference between desired and measured torque, if available)\n");
        printf (" getOutputs              (Position Pid output)\n");
        printf (" getCurrents             (current given to the motor)\n");
        printf (" getTorques              (joint torques, if available)\n");
        printf (" getPosPidReferences     (last position referenece)\n");
        printf (" getTrqPidReferences     (last torque reference)\n");
        printf (" getMotorEncoders              (motor encoder position)\n");
        printf (" getMotorEncoderSpeeds         (motor encoder velocity)\n");
        printf (" getMotorEncoderAccelerations  (motor encoder acceleration\n");
        printf (" getMotorsPwm             (voltage (PWM) given to the motor)\n");
        printf (" getControlModes         (joint control mode)\n");
        printf (" getInteractionModes     (joint interaction mode)\n");
        printf (" getTemperatures         (motor temperatures)\n");
        printf ("\n3) controlBoardDumper --robot icub --part left_arm --rate 10  --joints \"(0 1 2)\" --dataToDumpAll\n");
        printf ("   All data from the controlBoarWrapper will be dumped, including data from the debugInterface (getRotorxxx).\n");
        printf ("\n --logToFile can be used to create log files storing the data\n\n");

        return 0;
    }

    if (!yarp.checkNetwork())
    {
        yError()<<"YARP server not available!";
        return 1;
    }

    DumpModule mod;
    return mod.runModule(rf);
}
Example #2
0
int main(int argc, char *argv[]) 
{
    YARP_REGISTER_DEVICES(icubmod)

    Network::init();
    ResourceFinder rf;

    rf.setVerbose(true);
    rf.setDefaultContext("controlBoardDumper");
    rf.setDefaultConfigFile("controlBoardDumper.ini");

    rf.setDefault("part", "head");
    rf.setDefault("robot", "icub");
    rf.configure(argc, argv);

    Property p;
    DumpModule mod;
    p.fromString(rf.toString());

    if (!p.check("rate"))
        p.put("rate", 500);
    if (!p.check("joints"))
        {
            Value v;
            v.fromString("(0 1)");
            p.put("joints", v);
        }
    if (!p.check("dataToDump"))
        {
            Value v;
            v.fromString("(getEncoders getEncoderSpeeds getEncoderAccelerations getPositionErrors getOutputs getCurrents getTorques getTorqueErrors getPidReferences)");
            p.put("dataToDump", v);
        }

    fprintf(stderr, "Current configuration is: %s\n", p.toString().c_str());
    if (mod.open(p))
        return mod.runModule();
    else 
        return 0;

    Network::fini();
}
Example #3
0
int main(int argc, char *argv[])
{
    Network yarp;

    ResourceFinder rf;
    rf.setVerbose(true);
    rf.configure(argc,argv);

    if (rf.check("help"))
    {
        yInfo() << "Options:";
        yInfo() << "\t--name       port: service port name (default: /dump)";
        yInfo() << "\t--connect    port: name of the port to connect the dumper to at launch time";
        yInfo() << "\t--dir        name: provide explicit name of storage directory";
        yInfo() << "\t--overwrite      : overwrite pre-existing storage directory";
    #ifdef ADD_VIDEO
        yInfo() << "\t--type       type: type of the data to be dumped [bottle(default), image, image_jpg, video]";
        yInfo() << "\t--addVideo       : produce video as well (if image is selected)";
        yInfo() << "\t--videoType   ext: produce video of specified container type [mkv(default), avi]";
    #else
        yInfo() << "\t--type       type: type of the data to be dumped [bottle(default), image, image_jpg]";
    #endif
        yInfo() << "\t--downsample    n: downsample rate (default: 1 => downsample disabled)";
        yInfo() << "\t--rxTime         : dump the receiver time instead of the sender time";
        yInfo() << "\t--txTime         : dump the sender time straightaway";
        yInfo();

        return 0;
    }

    if (!yarp.checkNetwork())
    {
        yError()<<"YARP server not available!";
        return 1;
    }

    DumpModule mod;
    return mod.runModule(rf);
}
Example #4
0
int main(int argc, char *argv[]) 
{
    YARP_REGISTER_DEVICES(icubmod)

    Network::init();
    ResourceFinder rf;

    rf.setVerbose(true);
    rf.setDefaultContext("controlBoardDumper");
    rf.setDefaultConfigFile("controlBoardDumper.ini");

    rf.setDefault("part", "head");
    rf.setDefault("robot", "icub");
    rf.configure(argc, argv);

    Property p;
    DumpModule mod;
    p.fromString(rf.toString());

    if (!p.check("rate"))
    {
        p.put("rate", 500);
    }
    if (!p.check("joints"))
    {
        Value v;
        v.fromString("(0)");
        p.put("joints", v);
    }
    if (!p.check("dataToDump"))
    {
        Value v;
        v.fromString("(getEncoders getEncoderSpeeds getEncoderAccelerations getPositionErrors getOutputs getCurrents getTorques getTorqueErrors getPidReferences)");
        p.put("dataToDump", v);
    }
    if (p.check("dataToDumpAll"))
    {
        Value v;
        v.fromString("(getEncoders getEncoderSpeeds getEncoderAccelerations getPositionErrors getOutputs getCurrents getTorques getTorqueErrors getPidReferences getRotorPositions getRotorSpeeds getRotorAccelerations)");
        p.put("dataToDump", v);
    }
    if (p.check("help"))
    {
        printf ("controlBoardDumper usage:\n");
        printf ("1) controlBoardDumper --robot icub --part left_arm --rate 10  --joints \"(0 1 2)\" --dataToDump \"(xxx)\"\n");
        printf (" where xxx can be one of the following:\n");
        printf (" getEncoders             (joint position)\n");
        printf (" getEncoderSpeeds        (joint velocity)\n");
        printf (" getEncoderAccelerations (joint acceleration)\n");
        printf (" getPositionErrors       (difference between desired and actual position)\n");
        printf (" getTorqueErrors         (difference between desired and measured torque, if available)\n");
        printf (" getOutputs              (voltage (PWM) given to the motor)\n");
        printf (" getCurrents             (current given to the motor)\n");
        printf (" getTorques              (joint torques, if available)\n");
        printf (" getRotorPositions       (hi-res rotor position, if available)\n");
        printf (" getRotorSpeeds          (hi-res rotor velocity, if available)\n");
        printf (" getRotorAccelerations   (hi-res rotor acceleration, if available)\n");
        printf ("\n2) controlBoardDumper --robot icub --part left_arm --rate 10  --joints \"(0 1 2)\" --dataToDumpAll\n");

        return 0;
    }

    fprintf(stderr, "Current configuration is: %s\n", p.toString().c_str());
    if (mod.open(p))
        return mod.runModule();
    else 
        return 0;

    Network::fini();
}