diff --git a/doc/additionalDoc/tracerdoc.h b/doc/additionalDoc/tracerdoc.h index 4490d446a5b22c68832df4231f132a15b46acbe2..e2a0ee6e65730ed814d5cb27653429db1c0e4b3f 100644 --- a/doc/additionalDoc/tracerdoc.h +++ b/doc/additionalDoc/tracerdoc.h @@ -23,22 +23,15 @@ code documentation of the dynamicgraph::Tracer class. \n\n \section tracerdoc_sample Sample usage -The following code creates a TracerRealTime entity, then sets the tracing buffer -size to 10MB. It then tells the tracer to create files with names of the form: -jl_XXX.dat where XXX is the signal name, and adds a few signals after -clearing the traces; +The following code creates a TracerRealTime entity and sets the tracing buffer +size to 80MB. It then tells the tracer to create files with names of the form: +/tmp/dg_XXX.dat where XXX is the signal name, and call the signal +after the device has evaluated the control law: \code -new TracerRealTime tr -tr.bufferSize 10485760 - -tr.open ${TRACE_REPOSITORY} jl_ .dat -OpenHRP.periodicCall addSignal tr.triger -(...) -# --- TRACE --- -tr.clear -tr.add OpenHRP.forceRARM -tr.add dyn.0 -tr.add jgain.gain +robot.tracer = TracerRealTime("com_tracer") +robot.tracer.setBufferSize(80*(2**20)) +robot.tracer.open('/tmp','dg_','.dat') +robot.device.after.addSignal('{0}.triger'.format(robot.tracer.name)) \endcode \section tracerdoc_addi Additional information diff --git a/tests/debug-tracer.cpp b/tests/debug-tracer.cpp index 082f883042271d24d0a65eed3154508b1fe767a0..738fcbfe12e24f30bf6c593213d4800b6b897e6d 100644 --- a/tests/debug-tracer.cpp +++ b/tests/debug-tracer.cpp @@ -66,6 +66,13 @@ BOOST_AUTO_TEST_CASE(test_tracer) { *dynamicgraph::FactoryStorage::getInstance()->newEntity("MyEntity", "my-entity"); + std::string rootdir("/tmp"); + std::string basename("my-tracer"); + std::string suffix(".dat"); + + /// Test openfiles + atracer.openFiles(rootdir, basename, suffix); + /// Add trace by name atracer.addSignalToTraceByName("my-entity.out_double", "output"); @@ -80,13 +87,6 @@ BOOST_AUTO_TEST_CASE(test_tracer) { aSignalInt.setConstant(1.5); - std::string rootdir("/tmp"); - std::string basename("my-tracer"); - std::string suffix(".dat"); - - /// Test openfiles - atracer.openFiles(rootdir, basename, suffix); - atracer.start(); for (int i = 0; i < 1000; i++) { @@ -96,6 +96,8 @@ BOOST_AUTO_TEST_CASE(test_tracer) { } atracer.stop(); - + atracer.clearSignalToTrace(); atracer.closeFiles(); + + atracer.record(); }