@@ -69,12 +69,18 @@ NLOCBackendBase<STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR, CONTINUOUS>::NLOCB
69
69
70
70
// if the optimal problem has constraints, change
71
71
if (systemInterface_->getOptConProblem ().getInputBoxConstraints ())
72
+ {
72
73
changeInputBoxConstraints (systemInterface_->getOptConProblem ().getInputBoxConstraints ());
74
+ }
73
75
if (systemInterface_->getOptConProblem ().getStateBoxConstraints ())
76
+ {
74
77
changeStateBoxConstraints (systemInterface_->getOptConProblem ().getStateBoxConstraints ());
78
+ }
75
79
76
80
if (systemInterface_->getOptConProblem ().getGeneralConstraints ())
81
+ {
77
82
changeGeneralConstraints (systemInterface_->getOptConProblem ().getGeneralConstraints ());
83
+ }
78
84
}
79
85
80
86
template <size_t STATE_DIM, size_t CONTROL_DIM, size_t P_DIM, size_t V_DIM, typename SCALAR, bool CONTINUOUS>
@@ -287,8 +293,6 @@ void NLOCBackendBase<STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR, CONTINUOUS>::
287
293
computeBoxConstraintErrorOfTrajectory (settings_.nThreads , x_, u_ff_, e_box_norm_);
288
294
289
295
setInputBoxConstraintsForLQOCProblem ();
290
- lqocSolver_->configureInputBoxConstraints (lqocProblem_);
291
- lqocSolver_->initializeAndAllocate (); // todo - this is not nice
292
296
}
293
297
294
298
template <size_t STATE_DIM, size_t CONTROL_DIM, size_t P_DIM, size_t V_DIM, typename SCALAR, bool CONTINUOUS>
@@ -311,8 +315,6 @@ void NLOCBackendBase<STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR, CONTINUOUS>::
311
315
computeBoxConstraintErrorOfTrajectory (settings_.nThreads , x_, u_ff_, e_box_norm_);
312
316
313
317
setStateBoxConstraintsForLQOCProblem ();
314
- lqocSolver_->configureStateBoxConstraints (lqocProblem_);
315
- lqocSolver_->initializeAndAllocate (); // todo - this is not nice
316
318
}
317
319
318
320
@@ -352,8 +354,6 @@ void NLOCBackendBase<STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR, CONTINUOUS>::
352
354
lqocProblem_->d_ub_ [K_].resize (lqocProblem_->ng_ [K_], 1 );
353
355
354
356
lqocSolver_->setProblem (lqocProblem_);
355
- lqocSolver_->configureGeneralConstraints (lqocProblem_);
356
- lqocSolver_->initializeAndAllocate ();
357
357
358
358
// TODO can we do this multi-threaded?
359
359
if (iteration_ > 0 && (settings_.lineSearchSettings .type != LineSearchSettings::TYPE::NONE))
@@ -803,7 +803,6 @@ void NLOCBackendBase<STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR, CONTINUOUS>::
803
803
p.ng_ [k] = generalConstraints_[threadId]->getIntermediateConstraintsCount ();
804
804
if (p.ng_ [k] > 0 )
805
805
{
806
- p.hasGenConstraints_ = true ;
807
806
p.C_ [k] = generalConstraints_[threadId]->jacobianStateIntermediate ();
808
807
p.D_ [k] = generalConstraints_[threadId]->jacobianInputIntermediate ();
809
808
@@ -835,7 +834,6 @@ void NLOCBackendBase<STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR, CONTINUOUS>::
835
834
p.ng_ [K_] = generalConstraints_[settings_.nThreads ]->getTerminalConstraintsCount ();
836
835
if (p.ng_ [K_] > 0 )
837
836
{
838
- p.hasGenConstraints_ = true ;
839
837
p.C_ [K_] = generalConstraints_[settings_.nThreads ]->jacobianStateTerminal ();
840
838
p.D_ [K_] = generalConstraints_[settings_.nThreads ]->jacobianInputTerminal ();
841
839
@@ -1284,7 +1282,10 @@ void NLOCBackendBase<STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR, CONTINUOUS>::
1284
1282
lqpCounter_++;
1285
1283
1286
1284
// if solver is HPIPM, there's nothing to prepare
1287
- if (settings_.lqocp_solver == Settings_t::LQOCP_SOLVER::HPIPM_SOLVER) {}
1285
+ if (settings_.lqocp_solver == Settings_t::LQOCP_SOLVER::HPIPM_SOLVER)
1286
+ {
1287
+ // do nothing
1288
+ }
1288
1289
// if solver is GNRiccati - we iterate backward up to the first stage
1289
1290
else if (settings_.lqocp_solver == Settings_t::LQOCP_SOLVER::GNRICCATI_SOLVER)
1290
1291
{
@@ -1328,28 +1329,6 @@ void NLOCBackendBase<STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR, CONTINUOUS>::
1328
1329
{
1329
1330
lqpCounter_++;
1330
1331
1331
- if (lqocProblem_->isInputBoxConstrained ())
1332
- {
1333
- if (settings_.debugPrint )
1334
- std::cout << " LQ Problem has input box constraints. Configuring box constraints now. " << std::endl;
1335
-
1336
- lqocSolver_->configureInputBoxConstraints (lqocProblem_);
1337
- }
1338
- if (lqocProblem_->isStateBoxConstrained ())
1339
- {
1340
- if (settings_.debugPrint )
1341
- std::cout << " LQ Problem has state box constraints. Configuring box constraints now. " << std::endl;
1342
-
1343
- lqocSolver_->configureStateBoxConstraints (lqocProblem_);
1344
- }
1345
- if (lqocProblem_->isGeneralConstrained ())
1346
- {
1347
- if (settings_.debugPrint )
1348
- std::cout << " LQ Problem has general constraints. Configuring general constraints now. " << std::endl;
1349
-
1350
- lqocSolver_->configureGeneralConstraints (lqocProblem_);
1351
- }
1352
-
1353
1332
lqocSolver_->setProblem (lqocProblem_);
1354
1333
1355
1334
lqocSolver_->solve ();
@@ -1633,7 +1612,7 @@ std::vector<typename NLOCBackendBase<STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALA
1633
1612
ConstraintPtr_t>&
1634
1613
NLOCBackendBase<STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR, CONTINUOUS>::getStateBoxConstraintsInstances()
1635
1614
{
1636
- return inputBoxConstraints_ ;
1615
+ return stateBoxConstraints_ ;
1637
1616
}
1638
1617
1639
1618
0 commit comments