Example #1
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 #2
0
int main(int argc, char *argv[]) 
{
    Network::init();
    ResourceFinder rf;

    rf.setVerbose(false);
    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)");
        p.put("dataToDump", v);
    }
    if (p.check("dataToDumpAll"))
    {
        Value v;
      v.fromString("(getEncoders getEncoderSpeeds getEncoderAccelerations getPositionErrors getOutputs getCurrents getTorques getTorqueErrors getPosPidReferences getTrqPidReferences getMotorEncoders getMotorEncoderSpeeds getMotorEncoderAccelerations getControlModes getInteractionModes getTemperatures)");
    //    v.fromString("(getControlModes getInteractionModes)");
        
        p.put("dataToDump", v);
    }
    if (p.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              (voltage (PWM) given to the motor)\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 (" 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 (mod.open(p))
        return mod.runModule();
    else 
        return 0;

    Network::fini();
}
Example #3
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();
}