Skip to content

Commit 5007c66

Browse files
jmirabelolivier-stasse
authored andcommitted
Add param /geometric_simu/paused to pause SoT
1 parent 8eeebe9 commit 5007c66

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/sot_loader.cpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,22 @@ void workThreadLoader(SotLoader *aSotLoader)
8686
}
8787

8888
struct timeval start, stop;
89+
ros::NodeHandle nh ("/geometric_simu");
90+
bool paused;
91+
unsigned long long dt;
8992
while(!aSotLoader->isDynamicGraphStopped())
9093
{
91-
gettimeofday(&start,0);
92-
aSotLoader->oneIteration();
93-
gettimeofday(&stop,0);
94+
nh.param<bool> ("paused", paused, false);
9495

95-
unsigned long long dt = 1000000 * (stop.tv_sec - start.tv_sec) + (stop.tv_usec - start.tv_usec);
96-
dataToLog.record ((double)dt * 1e-6);
96+
if (!paused) {
97+
gettimeofday(&start,0);
98+
aSotLoader->oneIteration();
99+
gettimeofday(&stop,0);
100+
101+
dt = 1000000 * (stop.tv_sec - start.tv_sec) + (stop.tv_usec - start.tv_usec);
102+
dataToLog.record ((double)dt * 1e-6);
103+
} else
104+
dt = 0;
97105
if (period > dt) {
98106
usleep(period - (unsigned)dt);
99107
}

0 commit comments

Comments
 (0)