Skip to content

Commit

Permalink
Merge pull request #1151 from cmastalli/topic/fix-cppadcg
Browse files Browse the repository at this point in the history
  • Loading branch information
cmastalli authored Jul 31, 2023
2 parents 7f480e3 + 30ddd92 commit 828a556
Show file tree
Hide file tree
Showing 53 changed files with 2,068 additions and 3,230 deletions.
230 changes: 15 additions & 215 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -194,221 +194,21 @@ if(Boost_VERSION GREATER 107299)
add_definitions(-DBOOST_BIND_GLOBAL_PLACEHOLDERS)
endif()

# Main library
set(${PROJECT_NAME}_SOURCES
src/core/solver-base.cpp
src/core/solvers/box-ddp.cpp
src/core/solvers/box-fddp.cpp
src/core/solvers/box-qp.cpp
src/core/solvers/ddp.cpp
src/core/solvers/fddp.cpp
src/core/solvers/intro.cpp
src/core/solvers/ipopt.cpp
src/core/solvers/ipopt/ipopt-iface.cpp
src/core/solvers/kkt.cpp
src/core/utils/callbacks.cpp
src/core/utils/exception.cpp
src/core/utils/stop-watch.cpp
src/multibody/utils/quadruped-gaits.cpp)

set(${PROJECT_NAME}_HEADERS
include/crocoddyl/core/action-base.hpp
include/crocoddyl/core/action-base.hxx
include/crocoddyl/core/actions/diff-lqr.hpp
include/crocoddyl/core/actions/diff-lqr.hxx
include/crocoddyl/core/actions/lqr.hpp
include/crocoddyl/core/actions/lqr.hxx
include/crocoddyl/core/actions/unicycle.hpp
include/crocoddyl/core/actions/unicycle.hxx
include/crocoddyl/core/activation-base.hpp
include/crocoddyl/core/activations/2norm-barrier.hpp
include/crocoddyl/core/activations/quadratic-barrier.hpp
include/crocoddyl/core/activations/quadratic-flat-exp.hpp
include/crocoddyl/core/activations/quadratic-flat-log.hpp
include/crocoddyl/core/activations/quadratic.hpp
include/crocoddyl/core/activations/smooth-1norm.hpp
include/crocoddyl/core/activations/smooth-2norm.hpp
include/crocoddyl/core/activations/smooth-abs.hpp
include/crocoddyl/core/activations/weighted-quadratic-barrier.hpp
include/crocoddyl/core/activations/weighted-quadratic.hpp
include/crocoddyl/core/actuation/actuation-squashing.hpp
include/crocoddyl/core/actuation-base.hpp
include/crocoddyl/core/actuation-base.hxx
include/crocoddyl/core/actuation/squashing-base.hpp
include/crocoddyl/core/actuation/squashing/smooth-sat.hpp
include/crocoddyl/core/codegen/action-base.hpp
include/crocoddyl/core/constraint-base.hpp
include/crocoddyl/core/constraint-base.hxx
include/crocoddyl/core/constraints/constraint-manager.hpp
include/crocoddyl/core/constraints/constraint-manager.hxx
include/crocoddyl/core/constraints/residual.hpp
include/crocoddyl/core/constraints/residual.hxx
include/crocoddyl/core/control-base.hpp
include/crocoddyl/core/control-base.hxx
include/crocoddyl/core/controls/poly-one.hpp
include/crocoddyl/core/controls/poly-one.hxx
include/crocoddyl/core/controls/poly-two-rk.hpp
include/crocoddyl/core/controls/poly-two-rk.hxx
include/crocoddyl/core/controls/poly-zero.hpp
include/crocoddyl/core/controls/poly-zero.hxx
include/crocoddyl/core/cost-base.hpp
include/crocoddyl/core/cost-base.hxx
include/crocoddyl/core/costs/cost-sum.hpp
include/crocoddyl/core/costs/cost-sum.hxx
include/crocoddyl/core/costs/residual.hpp
include/crocoddyl/core/costs/residual.hxx
include/crocoddyl/core/data/actuation.hpp
include/crocoddyl/core/data-collector-base.hpp
include/crocoddyl/core/data/joint.hpp
include/crocoddyl/core/diff-action-base.hpp
include/crocoddyl/core/diff-action-base.hxx
include/crocoddyl/core/fwd.hpp
include/crocoddyl/core/integ-action-base.hpp
include/crocoddyl/core/integ-action-base.hxx
include/crocoddyl/core/integrator/euler.hpp
include/crocoddyl/core/integrator/euler.hxx
include/crocoddyl/core/integrator/rk4.hpp
include/crocoddyl/core/integrator/rk4.hxx
include/crocoddyl/core/integrator/rk.hpp
include/crocoddyl/core/integrator/rk.hxx
include/crocoddyl/core/mathbase.hpp
include/crocoddyl/core/numdiff/action.hpp
include/crocoddyl/core/numdiff/action.hxx
include/crocoddyl/core/numdiff/activation.hpp
include/crocoddyl/core/numdiff/activation.hxx
include/crocoddyl/core/numdiff/actuation.hpp
include/crocoddyl/core/numdiff/actuation.hxx
include/crocoddyl/core/numdiff/constraint.hpp
include/crocoddyl/core/numdiff/constraint.hxx
include/crocoddyl/core/numdiff/control.hpp
include/crocoddyl/core/numdiff/control.hxx
include/crocoddyl/core/numdiff/cost.hpp
include/crocoddyl/core/numdiff/cost.hxx
include/crocoddyl/core/numdiff/diff-action.hpp
include/crocoddyl/core/numdiff/diff-action.hxx
include/crocoddyl/core/numdiff/residual.hpp
include/crocoddyl/core/numdiff/residual.hxx
include/crocoddyl/core/numdiff/state.hpp
include/crocoddyl/core/numdiff/state.hxx
include/crocoddyl/core/optctrl/shooting.hpp
include/crocoddyl/core/optctrl/shooting.hxx
include/crocoddyl/core/residual-base.hpp
include/crocoddyl/core/residual-base.hxx
include/crocoddyl/core/residuals/control.hpp
include/crocoddyl/core/residuals/control.hxx
include/crocoddyl/core/residuals/joint-acceleration.hpp
include/crocoddyl/core/residuals/joint-acceleration.hxx
include/crocoddyl/core/residuals/joint-effort.hpp
include/crocoddyl/core/residuals/joint-effort.hxx
include/crocoddyl/core/solver-base.hpp
include/crocoddyl/core/solvers/box-ddp.hpp
include/crocoddyl/core/solvers/box-fddp.hpp
include/crocoddyl/core/solvers/box-kkt.hpp
include/crocoddyl/core/solvers/box-qp.hpp
include/crocoddyl/core/solvers/ddp.hpp
include/crocoddyl/core/solvers/fddp.hpp
include/crocoddyl/core/solvers/intro.hpp
include/crocoddyl/core/solvers/ipopt.hpp
include/crocoddyl/core/solvers/ipopt/ipopt-iface.hpp
include/crocoddyl/core/solvers/kkt.hpp
include/crocoddyl/core/state-base.hpp
include/crocoddyl/core/state-base.hxx
include/crocoddyl/core/states/euclidean.hpp
include/crocoddyl/core/states/euclidean.hxx
include/crocoddyl/core/utils/callbacks.hpp
include/crocoddyl/core/utils/deprecate.hpp
include/crocoddyl/core/utils/exception.hpp
include/crocoddyl/core/utils/file-io.hpp
include/crocoddyl/core/utils/math.hpp
include/crocoddyl/core/utils/motion-display.hpp
include/crocoddyl/core/utils/robot-loader.hpp
include/crocoddyl/core/utils/solution-plot.hpp
include/crocoddyl/core/utils/stop-watch.hpp
include/crocoddyl/core/utils/timer.hpp
include/crocoddyl/core/utils/version.hpp
include/crocoddyl/multibody/actions/contact-fwddyn.hpp
include/crocoddyl/multibody/actions/contact-fwddyn.hxx
include/crocoddyl/multibody/actions/contact-invdyn.hpp
include/crocoddyl/multibody/actions/contact-invdyn.hxx
include/crocoddyl/multibody/actions/free-fwddyn.hpp
include/crocoddyl/multibody/actions/free-fwddyn.hxx
include/crocoddyl/multibody/actions/free-invdyn.hpp
include/crocoddyl/multibody/actions/free-invdyn.hxx
include/crocoddyl/multibody/actions/impulse-fwddyn.hpp
include/crocoddyl/multibody/actions/impulse-fwddyn.hxx
include/crocoddyl/multibody/actuations/floating-base.hpp
include/crocoddyl/multibody/actuations/full.hpp
include/crocoddyl/multibody/actuations/multicopter-base.hpp
include/crocoddyl/multibody/contact-base.hpp
include/crocoddyl/multibody/contact-base.hxx
include/crocoddyl/multibody/contacts/contact-1d.hpp
include/crocoddyl/multibody/contacts/contact-1d.hxx
include/crocoddyl/multibody/contacts/contact-2d.hpp
include/crocoddyl/multibody/contacts/contact-2d.hxx
include/crocoddyl/multibody/contacts/contact-3d.hpp
include/crocoddyl/multibody/contacts/contact-3d.hxx
include/crocoddyl/multibody/contacts/contact-6d.hpp
include/crocoddyl/multibody/contacts/contact-6d.hxx
include/crocoddyl/multibody/contacts/multiple-contacts.hpp
include/crocoddyl/multibody/contacts/multiple-contacts.hxx
include/crocoddyl/multibody/cop-support.hpp
include/crocoddyl/multibody/cop-support.hxx
include/crocoddyl/multibody/cost-base.hpp
include/crocoddyl/multibody/data/contacts.hpp
include/crocoddyl/multibody/data/impulses.hpp
include/crocoddyl/multibody/data/multibody.hpp
include/crocoddyl/multibody/force-base.hpp
include/crocoddyl/multibody/frames-deprecated.hpp
include/crocoddyl/multibody/frames.hpp
include/crocoddyl/multibody/friction-cone.hpp
include/crocoddyl/multibody/friction-cone.hxx
include/crocoddyl/multibody/fwd.hpp
include/crocoddyl/multibody/impulse-base.hpp
include/crocoddyl/multibody/impulse-base.hxx
include/crocoddyl/multibody/impulses/impulse-3d.hpp
include/crocoddyl/multibody/impulses/impulse-3d.hxx
include/crocoddyl/multibody/impulses/impulse-6d.hpp
include/crocoddyl/multibody/impulses/impulse-6d.hxx
include/crocoddyl/multibody/impulses/multiple-impulses.hpp
include/crocoddyl/multibody/impulses/multiple-impulses.hxx
include/crocoddyl/multibody/numdiff/contact.hpp
include/crocoddyl/multibody/numdiff/contact.hxx
include/crocoddyl/multibody/numdiff/cost.hpp
include/crocoddyl/multibody/residuals/centroidal-momentum.hpp
include/crocoddyl/multibody/residuals/centroidal-momentum.hxx
include/crocoddyl/multibody/residuals/com-position.hpp
include/crocoddyl/multibody/residuals/com-position.hxx
include/crocoddyl/multibody/residuals/contact-control-gravity.hpp
include/crocoddyl/multibody/residuals/contact-control-gravity.hxx
include/crocoddyl/multibody/residuals/contact-cop-position.hpp
include/crocoddyl/multibody/residuals/contact-cop-position.hxx
include/crocoddyl/multibody/residuals/contact-force.hpp
include/crocoddyl/multibody/residuals/contact-force.hxx
include/crocoddyl/multibody/residuals/contact-friction-cone.hpp
include/crocoddyl/multibody/residuals/contact-friction-cone.hxx
include/crocoddyl/multibody/residuals/contact-wrench-cone.hpp
include/crocoddyl/multibody/residuals/contact-wrench-cone.hxx
include/crocoddyl/multibody/residuals/control-gravity.hpp
include/crocoddyl/multibody/residuals/control-gravity.hxx
include/crocoddyl/multibody/residuals/frame-placement.hpp
include/crocoddyl/multibody/residuals/frame-placement.hxx
include/crocoddyl/multibody/residuals/frame-rotation.hpp
include/crocoddyl/multibody/residuals/frame-rotation.hxx
include/crocoddyl/multibody/residuals/frame-translation.hpp
include/crocoddyl/multibody/residuals/frame-translation.hxx
include/crocoddyl/multibody/residuals/frame-velocity.hpp
include/crocoddyl/multibody/residuals/frame-velocity.hxx
include/crocoddyl/multibody/residuals/impulse-com.hpp
include/crocoddyl/multibody/residuals/impulse-com.hxx
include/crocoddyl/multibody/residuals/pair-collision.hpp
include/crocoddyl/multibody/residuals/pair-collision.hxx
include/crocoddyl/multibody/residuals/state.hpp
include/crocoddyl/multibody/residuals/state.hxx
include/crocoddyl/multibody/states/multibody.hpp
include/crocoddyl/multibody/states/multibody.hxx
include/crocoddyl/multibody/utils/quadruped-gaits.hpp
include/crocoddyl/multibody/wrench-cone.hpp
include/crocoddyl/multibody/wrench-cone.hxx)
# Include header and source files
file(GLOB_RECURSE ${PROJECT_NAME}_SOURCES ${PROJECT_SOURCE_DIR}/src/*.cpp)
file(GLOB_RECURSE ${PROJECT_NAME}_HEADERS ${PROJECT_SOURCE_DIR}/include/*.hpp
${PROJECT_SOURCE_DIR}/include/*.hxx)
# Remove header and source files that we want to build
if(NOT BUILD_WITH_IPOPT OR (NOT IPOPT_FOUND))
list(REMOVE_ITEM ${PROJECT_NAME}_HEADERS
${PROJECT_SOURCE_DIR}/include/core/solvers/ipopt/ipopt-iface.cpp
${PROJECT_SOURCE_DIR}/include/core/solvers/ipopt.cpp)
endif()
if(NOT BUILD_WITH_IPOPT OR (NOT IPOPT_FOUND))
list(REMOVE_ITEM ${PROJECT_NAME}_SOURCES
${PROJECT_SOURCE_DIR}/src/core/solvers/ipopt/ipopt-iface.cpp
${PROJECT_SOURCE_DIR}/src/core/solvers/ipopt.cpp)
endif()

if(UNIX)
# Build options We'd like to deactivate sign conversion since we frequently
Expand Down
3 changes: 1 addition & 2 deletions bindings/python/crocoddyl/core/action-base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,11 @@ void exposeActionAbstract() {
bp::make_function(&ActionModelAbstract_wrap::get_u_ub,
bp::return_internal_reference<>()),
&ActionModelAbstract_wrap::set_u_ub, "upper control limits")
.def(CopyableVisitor<ActionModelAbstract_wrap>())
.def(PrintableVisitor<ActionModelAbstract>());

bp::register_ptr_to_python<boost::shared_ptr<ActionDataAbstract> >();

bp::class_<ActionDataAbstract, boost::noncopyable>(
bp::class_<ActionDataAbstract>(
"ActionDataAbstract",
"Abstract class for action data.\n\n"
"In crocoddyl, an action data contains all the required information for "
Expand Down
3 changes: 1 addition & 2 deletions bindings/python/crocoddyl/core/activation-base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,11 @@ void exposeActivationAbstract() {
.add_property("nr",
bp::make_function(&ActivationModelAbstract_wrap::get_nr),
"dimension of cost-residual vector")
.def(CopyableVisitor<ActivationModelAbstract_wrap>())
.def(PrintableVisitor<ActivationModelAbstract>());

bp::register_ptr_to_python<boost::shared_ptr<ActivationDataAbstract> >();

bp::class_<ActivationDataAbstract, boost::noncopyable>(
bp::class_<ActivationDataAbstract>(
"ActivationDataAbstract", "Abstract class for activation data.\n\n",
bp::init<ActivationModelAbstract*>(
bp::args("self", "model"),
Expand Down
5 changes: 2 additions & 3 deletions bindings/python/crocoddyl/core/actuation-base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,11 @@ void exposeActuationAbstract() {
"state",
bp::make_function(&ActuationModelAbstract_wrap::get_state,
bp::return_value_policy<bp::return_by_value>()),
"state")
.def(CopyableVisitor<ActuationModelAbstract_wrap>());
"state");

bp::register_ptr_to_python<boost::shared_ptr<ActuationDataAbstract> >();

bp::class_<ActuationDataAbstract, boost::noncopyable>(
bp::class_<ActuationDataAbstract>(
"ActuationDataAbstract",
"Abstract class for actuation datas.\n\n"
"An actuation data contains all the required information for processing "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void exposeSquashingAbstract() {

bp::register_ptr_to_python<boost::shared_ptr<SquashingDataAbstract> >();

bp::class_<SquashingDataAbstract, boost::noncopyable>(
bp::class_<SquashingDataAbstract>(
"SquashingDataAbstract",
"Abstract class for squashing datas. \n\n"
"In crocoddyl, an squashing data contains all the required information "
Expand Down
3 changes: 1 addition & 2 deletions bindings/python/crocoddyl/core/constraint-base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,11 @@ void exposeConstraintAbstract() {
.add_property("nh",
bp::make_function(&ConstraintModelAbstract_wrap::get_nh),
"number of equality constraints")
.def(CopyableVisitor<ConstraintModelAbstract_wrap>())
.def(PrintableVisitor<ConstraintModelAbstract>());

bp::register_ptr_to_python<boost::shared_ptr<ConstraintDataAbstract> >();

bp::class_<ConstraintDataAbstract, boost::noncopyable>(
bp::class_<ConstraintDataAbstract>(
"ConstraintDataAbstract", "Abstract class for constraint data.\n\n",
bp::init<ConstraintModelAbstract*, DataCollectorAbstract*>(
bp::args("self", "model", "data"),
Expand Down
5 changes: 2 additions & 3 deletions bindings/python/crocoddyl/core/control-base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,12 @@ void exposeControlParametrizationAbstract() {
.add_property(
"nu",
bp::make_function(&ControlParametrizationModelAbstract_wrap::get_nu),
"dimension of the control parameters")
.def(CopyableVisitor<ControlParametrizationModelAbstract_wrap>());
"dimension of the control parameters");

bp::register_ptr_to_python<
boost::shared_ptr<ControlParametrizationDataAbstract> >();

bp::class_<ControlParametrizationDataAbstract, boost::noncopyable>(
bp::class_<ControlParametrizationDataAbstract>(
"ControlParametrizationDataAbstract",
"Abstract class for control parametrization data.\n",
bp::init<ControlParametrizationModelAbstract*>(
Expand Down
3 changes: 1 addition & 2 deletions bindings/python/crocoddyl/core/cost-base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,11 @@ void exposeCostAbstract() {
"residual model")
.add_property("nu", bp::make_function(&CostModelAbstract_wrap::get_nu),
"dimension of control vector")
.def(CopyableVisitor<CostModelAbstract_wrap>())
.def(PrintableVisitor<CostModelAbstract>());

bp::register_ptr_to_python<boost::shared_ptr<CostDataAbstract> >();

bp::class_<CostDataAbstract, boost::noncopyable>(
bp::class_<CostDataAbstract>(
"CostDataAbstract", "Abstract class for cost data.\n\n",
bp::init<CostModelAbstract*, DataCollectorAbstract*>(
bp::args("self", "model", "data"),
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/crocoddyl/core/data-collector-base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace crocoddyl {
namespace python {

void exposeDataCollector() {
bp::class_<DataCollectorAbstract, boost::noncopyable>(
bp::class_<DataCollectorAbstract>(
"DataCollectorAbstract",
"Abstract class for common collection of data used in different objects "
"in action model.\n\n",
Expand Down
5 changes: 3 additions & 2 deletions bindings/python/crocoddyl/core/data/joint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace python {
void exposeDataCollectorJoint() {
bp::register_ptr_to_python<boost::shared_ptr<JointDataAbstract> >();

bp::class_<JointDataAbstract, boost::noncopyable>(
bp::class_<JointDataAbstract>(
"JointDataAbstract",
"Abstract class for joint datas.\n\n"
"A joint data contains all the required information about joint efforts "
Expand Down Expand Up @@ -77,7 +77,8 @@ void exposeDataCollectorJoint() {
"joint",
bp::make_getter(&DataCollectorJoint::joint,
bp::return_value_policy<bp::return_by_value>()),
"joint data");
"joint data")
.def(CopyableVisitor<DataCollectorJoint>());

bp::class_<DataCollectorJointActuation, bp::bases<DataCollectorActuation> >(
"DataCollectorJointActuation", "Joint-actuation data collector.\n\n",
Expand Down
3 changes: 1 addition & 2 deletions bindings/python/crocoddyl/core/diff-action-base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,12 @@ void exposeDifferentialActionAbstract() {
bp::return_value_policy<bp::return_by_value>()),
&DifferentialActionModelAbstract_wrap::set_u_ub,
"upper control limits")
.def(CopyableVisitor<DifferentialActionModelAbstract_wrap>())
.def(PrintableVisitor<DifferentialActionModelAbstract>());

bp::register_ptr_to_python<
boost::shared_ptr<DifferentialActionDataAbstract> >();

bp::class_<DifferentialActionDataAbstract, boost::noncopyable>(
bp::class_<DifferentialActionDataAbstract>(
"DifferentialActionDataAbstract",
"Abstract class for differential action data.\n\n"
"In crocoddyl, an action data contains all the required information for "
Expand Down
1 change: 0 additions & 1 deletion bindings/python/crocoddyl/core/integ-action-base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ void exposeIntegratedActionAbstract() {
bp::make_function(&IntegratedActionModelAbstract::get_dt,
bp::return_value_policy<bp::return_by_value>()),
&IntegratedActionModelAbstract::set_dt, "step time")
.def(CopyableVisitor<IntegratedActionModelAbstract_wrap>())
.def(PrintableVisitor<IntegratedActionModelAbstract>());

bp::register_ptr_to_python<
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/crocoddyl/core/optctrl/shooting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void exposeShootingProblem() {

bp::register_ptr_to_python<boost::shared_ptr<ShootingProblem> >();

bp::class_<ShootingProblem, boost::noncopyable>(
bp::class_<ShootingProblem>(
"ShootingProblem",
"Declare a shooting problem.\n\n"
"A shooting problem declares the initial state, a set of running action "
Expand Down
Loading

0 comments on commit 828a556

Please sign in to comment.