Skip to content

Commit a9ff339

Browse files
Merge pull request #25 from mehdi-benallegue/master
Make the velocity signal available even when the robot is not controlled...
2 parents c1078f7 + 1a0c641 commit a9ff339

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/tools/device.cpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,15 @@ Device( const std::string& n )
141141
forcesSOUT[3] =
142142
new Signal<ml::Vector, int>("OpenHRP::output(vector6)::forceLARM");
143143

144-
signalRegistration( controlSIN<<stateSOUT<<attitudeSOUT<<attitudeSIN<<zmpSIN
145-
<<*forcesSOUT[0]<<*forcesSOUT[1]<<*forcesSOUT[2]<<*forcesSOUT[3]
146-
<<previousControlSOUT <<pseudoTorqueSOUT
147-
<< motorcontrolSOUT << ZMPPreviousControllerSOUT );
144+
signalRegistration( controlSIN<<stateSOUT<<velocitySOUT<<attitudeSOUT
145+
<<attitudeSIN<<zmpSIN <<*forcesSOUT[0]<<*forcesSOUT[1]
146+
<<*forcesSOUT[2]<<*forcesSOUT[3] <<previousControlSOUT
147+
<<pseudoTorqueSOUT << motorcontrolSOUT << ZMPPreviousControllerSOUT );
148148
state_.fill(.0); stateSOUT.setConstant( state_ );
149149

150+
velocity_.resize(state_.size()); velocity_.setZero();
151+
velocitySOUT.setConstant( velocity_ );
152+
150153
/* --- Commands --- */
151154
{
152155
std::string docstring;
@@ -258,7 +261,6 @@ void Device::
258261
setSecondOrderIntegration()
259262
{
260263
secondOrderIntegration_ = true;
261-
signalRegistration( velocitySOUT );
262264
velocity_.resize(state_.size());
263265
velocity_.setZero();
264266
velocitySOUT.setConstant( velocity_ );
@@ -306,11 +308,17 @@ increment( const double & dt )
306308

307309
/* Position the signals corresponding to sensors. */
308310
stateSOUT .setConstant( state_ ); stateSOUT.setTime( time+1 );
311+
//computation of the velocity signal
309312
if( secondOrderIntegration_ )
310313
{
311314
velocitySOUT.setConstant( velocity_ );
312315
velocitySOUT.setTime( time+1 );
313316
}
317+
else
318+
{
319+
velocitySOUT.setConstant( controlSIN.accessCopy() );
320+
velocitySOUT.setTime( time+1 );
321+
}
314322
for( int i=0;i<4;++i ){
315323
if( !withForceSignals[i] ) forcesSOUT[i]->setConstant(forceZero6);
316324
}

0 commit comments

Comments
 (0)