Skip to content

Commit b3661c8

Browse files
Set the signal values AFTER the integration
1 parent 79035ac commit b3661c8

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/tools/device.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ setStateSize( const unsigned int& size )
217217

218218
void Device::
219219
setVelocitySize( const unsigned int& size )
220-
{
220+
{
221221
velocity_.resize(size);
222222
velocity_.fill(.0);
223223
velocitySOUT.setConstant( velocity_ );
@@ -270,19 +270,6 @@ increment( const double & dt )
270270
int time = stateSOUT.getTime();
271271
sotDEBUG(25) << "Time : " << time << std::endl;
272272

273-
/* Position the signals corresponding to sensors. */
274-
stateSOUT .setConstant( state_ ); stateSOUT.setTime( time+1 );
275-
if( secondOrderIntegration_ )
276-
{
277-
velocitySOUT.setConstant( velocity_ );
278-
velocitySOUT.setTime( time+1 );
279-
}
280-
for( int i=0;i<4;++i ){
281-
if( !withForceSignals[i] ) forcesSOUT[i]->setConstant(forceZero6);
282-
}
283-
ml::Vector zmp(3); zmp.fill( .0 );
284-
ZMPPreviousControllerSOUT .setConstant( zmp );
285-
286273
// Run Synchronous commands and evaluate signals outside the main
287274
// connected component of the graph.
288275
try
@@ -342,14 +329,27 @@ increment( const double & dt )
342329
<< " running periodical commands (after)" << std::endl;
343330
}
344331

332+
/* Position the signals corresponding to sensors. */
333+
stateSOUT .setConstant( state_ ); stateSOUT.setTime( time+1 );
334+
if( secondOrderIntegration_ )
335+
{
336+
velocitySOUT.setConstant( velocity_ );
337+
velocitySOUT.setTime( time+1 );
338+
}
339+
for( int i=0;i<4;++i ){
340+
if( !withForceSignals[i] ) forcesSOUT[i]->setConstant(forceZero6);
341+
}
342+
ml::Vector zmp(3); zmp.fill( .0 );
343+
ZMPPreviousControllerSOUT .setConstant( zmp );
344+
345345
// Others signals.
346346
motorcontrolSOUT .setConstant( state_ );
347347
}
348348

349349
void Device::integrate( const double & dt )
350350
{
351351
const ml::Vector & control = controlSIN.accessCopy();
352-
352+
353353
if( !vel_controlInit_ )
354354
{
355355
vel_control_ = ml::Vector(control.size());
@@ -362,7 +362,7 @@ void Device::integrate( const double & dt )
362362
// freedom as a translation and roll pitch yaw.
363363
unsigned int offset = 6;
364364

365-
365+
366366

367367
if (secondOrderIntegration_)
368368
{
@@ -382,7 +382,7 @@ void Device::integrate( const double & dt )
382382
offset = 0;
383383
integrateRollPitchYaw(state_, vel_control_, dt);
384384
}
385-
385+
386386
for( unsigned int i=6;i<state_.size();++i )
387387
{ state_(i) += (vel_control_(i-offset)*dt); }
388388
}

0 commit comments

Comments
 (0)