From 77bd735716eae2301697c08d9fbe3782709a9b21 Mon Sep 17 00:00:00 2001 From: Olivier Stasse <ostasse@laas.fr> Date: Thu, 17 Oct 2019 17:10:29 -0400 Subject: [PATCH] Improve doc. Fix debug-tracer.cpp --- doc/additionalDoc/tracerdoc.h | 23 ++++++++--------------- tests/debug-tracer.cpp | 18 ++++++++++-------- 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/doc/additionalDoc/tracerdoc.h b/doc/additionalDoc/tracerdoc.h index 4490d44..e2a0ee6 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 082f883..738fcbf 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(); } -- GitLab