@@ -217,7 +217,7 @@ setStateSize( const unsigned int& size )
217
217
218
218
void Device::
219
219
setVelocitySize ( const unsigned int & size )
220
- {
220
+ {
221
221
velocity_.resize (size);
222
222
velocity_.fill (.0 );
223
223
velocitySOUT.setConstant ( velocity_ );
@@ -270,19 +270,6 @@ increment( const double & dt )
270
270
int time = stateSOUT.getTime ();
271
271
sotDEBUG (25 ) << " Time : " << time << std::endl;
272
272
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
-
286
273
// Run Synchronous commands and evaluate signals outside the main
287
274
// connected component of the graph.
288
275
try
@@ -342,14 +329,27 @@ increment( const double & dt )
342
329
<< " running periodical commands (after)" << std::endl;
343
330
}
344
331
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
+
345
345
// Others signals.
346
346
motorcontrolSOUT .setConstant ( state_ );
347
347
}
348
348
349
349
void Device::integrate ( const double & dt )
350
350
{
351
351
const ml::Vector & control = controlSIN.accessCopy ();
352
-
352
+
353
353
if ( !vel_controlInit_ )
354
354
{
355
355
vel_control_ = ml::Vector (control.size ());
@@ -362,7 +362,7 @@ void Device::integrate( const double & dt )
362
362
// freedom as a translation and roll pitch yaw.
363
363
unsigned int offset = 6 ;
364
364
365
-
365
+
366
366
367
367
if (secondOrderIntegration_)
368
368
{
@@ -382,7 +382,7 @@ void Device::integrate( const double & dt )
382
382
offset = 0 ;
383
383
integrateRollPitchYaw (state_, vel_control_, dt);
384
384
}
385
-
385
+
386
386
for ( unsigned int i=6 ;i<state_.size ();++i )
387
387
{ state_ (i) += (vel_control_ (i-offset)*dt); }
388
388
}
0 commit comments