DataRecorder

  • Hi People,


    few weeks ago i started to work with Sunrise Workbench. Currently I'm trying to apply the function of the Datarecorder, but I'm not abel to use it....i just added
    DataRecorder rec_1 = new DataRecorder("Recording_1.log", 5,TimeUnit.SECONDS, 100);
    but it is not giving something out...there is no file (Recording_1.log) on my iiwa.


    Do you have any hints for me?


    Best,
    Beginner

  • Hello Beginner,


    please have a look into the Help of the Sunrise Workbench -> Chapter 15.24



    DrG
    PS: Sorry - not more time for Details...

  • Hi Beginner,

    Code
    I did it and just copied the example :-) but it did not write anything out...


    That does not Sound cool...
    ... hm... the example at the end of the chapter 15.24 (short before 15.25) should work - I had a quick glance on it.


    Q: Where did you look for the datafiles?


    For troubleshooting, you can "manually" force start/stop recording by calling directly "rec.startRecording()" <> "rec.stopRecording()".
    AKA: Bypass the StartRecordingAction mechanism.



    DrG

  • It is selected at station....cat and i always looking for it on my krc (\\172.31.1.148\krc\Roboter\log\DataRecorder)
    It is still not working...
    do i have to create a class or import something? i feel pretty stupid..
    package application;



    //import java.util.concurrent.TimeUnit;


    //import java.util.concurrent.TimeUnit;


    import javax.inject.Inject;
    import com.kuka.roboticsAPI.applicationModel.RoboticsAPIApplication;
    import static com.kuka.roboticsAPI.motionModel.BasicMotions.*;
    import com.kuka.roboticsAPI.deviceModel.LBR;
    //import com.sun.org.omg.CORBA.InitializerHelper;


    /**
    * Implementation of a robot application.
    * <p>
    * The application provides a {@link RoboticsAPITask#initialize()} and a
    * {@link RoboticsAPITask#run()} method, which will be called successively in
    * the application lifecycle. The application will terminate automatically after
    * the {@link RoboticsAPITask#run()} method has finished or after stopping the
    * task. The {@link RoboticsAPITask#dispose()} method will be called, even if an
    * exception is thrown during initialization or run.
    * <p>
    * <b>It is imperative to call <code>super.dispose()</code> when overriding the
    * {@link RoboticsAPITask#dispose()} method.</b>
    *
    * @see UseRoboticsAPIContext
    * @see #initialize()
    * @see #run()
    * @see #dispose()
    */
    public class DataRecorder extends RoboticsAPIApplication {
    @Inject
    private LBR lBR_iiwa_14_R820_1;


    //private rec_1;


    @Override
    public void initialize() {
    // initialize your application here
    }


    @Override
    public void run() {
    // your application execution starts here
    lBR_iiwa_14_R820_1.move(ptpHome());

    lBR_iiwa_14_R820_1.move(ptp(0,Math.toRadians(15),0,Math.toRadians(15),Math.toRadians(15),0,0).setJointVelocityRel(0.2));
    DataRecorder rec = new DataRecorder();
    // ...
    rec.enable();
    rec.startRecording();


    lBR_iiwa_14_R820_1.move(ptp(0,Math.toRadians(5),0,Math.toRadians(15),Math.toRadians(7),0,0).setJointVelocityRel(0.2));


    //rec.setFileName("Recording.log");
    //rec.setFileName("Recording.log");
    //rec.setSampleRate(10);
    //rec.addExternalJointTorque(lBR_iiwa_14_R820_1);
    //StartRecordingAction startAction =new StartRecordingAction(rec);

    lBR_iiwa_14_R820_1.move(ptpHome());


    }
    }


    here is my code for the pre last one...

  • Hi, sorry for a silly question, but have you called a stopRecording() method at the end?
    I guess the log file creation should be done inside of this method which means you won't get any unless you call it.

  • Hi Beginner,

    Quote

    Seulki:: but have you called a stopRecording() method at the end?


    Seulki is right...


    you Need somehow to finish/stop the recording (refer e.g. to Section 15.24.4 in the Manual).


    Either you call it manually: "stopRecording()"
    or you Trigger it via the Actions
    or you finish the application
    or the tracing depth of the Recorder is reached.


    See also Section 15.26.6 - Example for datarecording.
    There the "rec.stopRecording()" is called
    AND the application is synchronized (rec.awaitFileEnable()).
    Note: This helps especially for Trouble Shooting...
    Further hints for Trouble Shooting: Inquire the state of the Recorder by calling "rec.isXXX" - isEnabled; isRecording; isFileAvailable


    DrG

  • package application;



    import javax.inject.Inject;
    import com.kuka.roboticsAPI.applicationModel.RoboticsAPIApplication;
    import static com.kuka.roboticsAPI.motionModel.BasicMotions.*;
    import com.kuka.roboticsAPI.deviceModel.LBR;
    import com.kuka.roboticsAPI.sensorModel.DataRecorder;
    import com.kuka.roboticsAPI.sensorModel.DataRecorder.AngleUnit;


    /**
    * Implementation of a robot application.
    * <p>
    * The application provides a {@link RoboticsAPITask#initialize()} and a
    * {@link RoboticsAPITask#run()} method, which will be called successively in
    * the application lifecycle. The application will terminate automatically after
    * the {@link RoboticsAPITask#run()} method has finished or after stopping the
    * task. The {@link RoboticsAPITask#dispose()} method will be called, even if an
    * exception is thrown during initialization or run.
    * <p>
    * <b>It is imperative to call <code>super.dispose()</code> when overriding the
    * {@link RoboticsAPITask#dispose()} method.</b>
    *
    * @see UseRoboticsAPIContext
    * @see #initialize()
    * @see #run()
    * @see #dispose()
    */
    public class DataExport extends RoboticsAPIApplication {
    @Inject
    private LBR lBR_iiwa_14_R820_1;

    //@Override
    //public void initialize() {
    // initialize your application here
    // }

    //@Override
    public void run() {
    DataRecorder(); {
    }
    DataRecorder rec = new DataRecorder();
    rec.setFileName("DataExport.log");
    rec.setSampleInterval(10);
    rec.addExternalJointTorque(lBR_iiwa_14_R820_1);
    rec.addCurrentJointPosition(lBR_iiwa_14_R820_1, AngleUnit.Degree);
    rec.addInternalJointTorque(lBR_iiwa_14_R820_1);
    rec.enable();
    rec.startRecording();
    // your application execution starts here
    lBR_iiwa_14_R820_1.move(ptpHome());
    lBR_iiwa_14_R820_1.move(ptp(getFrame("/P12")));
    rec.stopRecording();


    }


    private void DataRecorder() {
    // TODO

    }
    }


    -> This code is working, just for the next people with such issue :smiling_face:

Advertising from our partners