hybrid costs added
parent
ec6a0c4406
commit
203220501a
|
@ -65,6 +65,7 @@ planning:
|
||||||
state_weights: [2.0, 2.0, 2.0]
|
state_weights: [2.0, 2.0, 2.0]
|
||||||
control_weights: [1.0, 1.0]
|
control_weights: [1.0, 1.0]
|
||||||
integral_form: False
|
integral_form: False
|
||||||
|
hybrid_cost_minimum_time: False
|
||||||
minimum_time_via_points:
|
minimum_time_via_points:
|
||||||
position_weight: 8.0
|
position_weight: 8.0
|
||||||
orientation_weight: 0.0
|
orientation_weight: 0.0
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include <mpc_local_planner/controller.h>
|
#include <mpc_local_planner/controller.h>
|
||||||
|
|
||||||
|
#include <corbo-optimal-control/functions/hybrid_cost.h>
|
||||||
#include <corbo-optimal-control/functions/minimum_time.h>
|
#include <corbo-optimal-control/functions/minimum_time.h>
|
||||||
#include <corbo-optimal-control/functions/quadratic_control_cost.h>
|
#include <corbo-optimal-control/functions/quadratic_control_cost.h>
|
||||||
#include <corbo-optimal-control/structured_ocp/discretization_grids/finite_differences_variable_grid.h>
|
#include <corbo-optimal-control/structured_ocp/discretization_grids/finite_differences_variable_grid.h>
|
||||||
|
@ -591,14 +592,36 @@ corbo::StructuredOptimalControlProblem::Ptr Controller::configureOcp(const ros::
|
||||||
}
|
}
|
||||||
bool integral_form = false;
|
bool integral_form = false;
|
||||||
nh.param("planning/objective/quadratic_form/integral_form", integral_form, integral_form);
|
nh.param("planning/objective/quadratic_form/integral_form", integral_form, integral_form);
|
||||||
|
bool hybrid_cost_minimum_time = false;
|
||||||
|
nh.param("planning/objective/quadratic_form/hybrid_cost_minimum_time", hybrid_cost_minimum_time, hybrid_cost_minimum_time);
|
||||||
|
|
||||||
bool q_zero = Q.isZero();
|
bool q_zero = Q.isZero();
|
||||||
bool r_zero = R.isZero();
|
bool r_zero = R.isZero();
|
||||||
if (!q_zero && !r_zero)
|
if (!q_zero && !r_zero)
|
||||||
|
{
|
||||||
|
PRINT_ERROR_COND(hybrid_cost_minimum_time,
|
||||||
|
"Hybrid minimum time and quadratic form cost is currently only supported for non-zero control weights only. Falling "
|
||||||
|
"back to quadratic form.");
|
||||||
ocp->setStageCost(std::make_shared<QuadraticFormCostSE2>(Q, R, integral_form, lsq_solver));
|
ocp->setStageCost(std::make_shared<QuadraticFormCostSE2>(Q, R, integral_form, lsq_solver));
|
||||||
|
}
|
||||||
else if (!q_zero && r_zero)
|
else if (!q_zero && r_zero)
|
||||||
|
{
|
||||||
|
PRINT_ERROR_COND(hybrid_cost_minimum_time,
|
||||||
|
"Hybrid minimum time and quadratic form cost is currently only supported for non-zero control weights only. Falling "
|
||||||
|
"back to only quadratic state cost.");
|
||||||
ocp->setStageCost(std::make_shared<QuadraticStateCostSE2>(Q, integral_form, lsq_solver));
|
ocp->setStageCost(std::make_shared<QuadraticStateCostSE2>(Q, integral_form, lsq_solver));
|
||||||
|
}
|
||||||
else if (q_zero && !r_zero)
|
else if (q_zero && !r_zero)
|
||||||
ocp->setStageCost(std::make_shared<corbo::QuadraticControlCost>(R, integral_form, lsq_solver));
|
{
|
||||||
|
if (hybrid_cost_minimum_time)
|
||||||
|
{
|
||||||
|
ocp->setStageCost(std::make_shared<corbo::MinTimeQuadraticControls>(R, integral_form, lsq_solver));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ocp->setStageCost(std::make_shared<corbo::QuadraticControlCost>(R, integral_form, lsq_solver));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (objective_type == "minimum_time_via_points")
|
else if (objective_type == "minimum_time_via_points")
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue