Skip to content

Commit 77bd735

Browse files
Improve doc.
Fix debug-tracer.cpp
1 parent 7002bb1 commit 77bd735

File tree

2 files changed

+18
-23
lines changed

2 files changed

+18
-23
lines changed

doc/additionalDoc/tracerdoc.h

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,15 @@ code documentation of the dynamicgraph::Tracer class.
2323
\n\n
2424
2525
\section tracerdoc_sample Sample usage
26-
The following code creates a TracerRealTime entity, then sets the tracing buffer
27-
size to 10MB. It then tells the tracer to create files with names of the form:
28-
jl_XXX.dat where XXX is the signal name, and adds a few signals after
29-
clearing the traces;
26+
The following code creates a TracerRealTime entity and sets the tracing buffer
27+
size to 80MB. It then tells the tracer to create files with names of the form:
28+
/tmp/dg_XXX.dat where XXX is the signal name, and call the signal
29+
after the device has evaluated the control law:
3030
\code
31-
new TracerRealTime tr
32-
tr.bufferSize 10485760
33-
34-
tr.open ${TRACE_REPOSITORY} jl_ .dat
35-
OpenHRP.periodicCall addSignal tr.triger
36-
(...)
37-
# --- TRACE ---
38-
tr.clear
39-
tr.add OpenHRP.forceRARM
40-
tr.add dyn.0
41-
tr.add jgain.gain
31+
robot.tracer = TracerRealTime("com_tracer")
32+
robot.tracer.setBufferSize(80*(2**20))
33+
robot.tracer.open('/tmp','dg_','.dat')
34+
robot.device.after.addSignal('{0}.triger'.format(robot.tracer.name))
4235
\endcode
4336
4437
\section tracerdoc_addi Additional information

tests/debug-tracer.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,13 @@ BOOST_AUTO_TEST_CASE(test_tracer) {
6666
*dynamicgraph::FactoryStorage::getInstance()->newEntity("MyEntity",
6767
"my-entity");
6868

69+
std::string rootdir("/tmp");
70+
std::string basename("my-tracer");
71+
std::string suffix(".dat");
72+
73+
/// Test openfiles
74+
atracer.openFiles(rootdir, basename, suffix);
75+
6976
/// Add trace by name
7077
atracer.addSignalToTraceByName("my-entity.out_double", "output");
7178

@@ -80,13 +87,6 @@ BOOST_AUTO_TEST_CASE(test_tracer) {
8087

8188
aSignalInt.setConstant(1.5);
8289

83-
std::string rootdir("/tmp");
84-
std::string basename("my-tracer");
85-
std::string suffix(".dat");
86-
87-
/// Test openfiles
88-
atracer.openFiles(rootdir, basename, suffix);
89-
9090
atracer.start();
9191

9292
for (int i = 0; i < 1000; i++) {
@@ -96,6 +96,8 @@ BOOST_AUTO_TEST_CASE(test_tracer) {
9696
}
9797

9898
atracer.stop();
99-
99+
atracer.clearSignalToTrace();
100100
atracer.closeFiles();
101+
102+
atracer.record();
101103
}

0 commit comments

Comments
 (0)