@@ -259,7 +259,7 @@ void CorrectionController::extendConnectToModel(Model& model)
259259
260260 for (int i=0 ; i<cs.getSize (); i++) {
261261 const Coordinate& coord = cs[i];
262- std::string name = coord.getName () + " _corrector" ;
262+ const std::string name = coord.getName () + " _corrector" ;
263263
264264 CoordinateActuator* actuator = nullptr ;
265265
@@ -271,10 +271,7 @@ void CorrectionController::extendConnectToModel(Model& model)
271271 }
272272
273273 if (!actuator) {
274- std::cout << " CorrectionController::extendConnectToModel(): "
275- << coord.getName () + " _corrector" << " added "
276- << std::endl;
277-
274+ // create the corrector actuator if it doe not already exist
278275 actuator = new CoordinateActuator ();
279276 actuator->setCoordinate (&cs.get (i));
280277 actuator->setName (name);
@@ -283,11 +280,15 @@ void CorrectionController::extendConnectToModel(Model& model)
283280 // the controller is removed, so are all the actuators it added.
284281 adoptSubcomponent (actuator);
285282 setNextSubcomponentInSystem (*actuator);
283+
284+ std::cout << " CorrectionController::extendConnectToModel(): "
285+ << name << " added " << std::endl;
286286
287287 actuator->setOptimalForce (1.0 );
288- // Add to the Controller's list of Actuators (no ownership).
289- addActuator (*actuator);
290288 }
289+
290+ // Add to the Controller's list of Actuators (no ownership).
291+ addActuator (*actuator);
291292 }
292293
293294 setNumControls (getActuatorSet ().getSize ());
0 commit comments