@@ -12,7 +12,12 @@ namespace crocoddyl {
1212template <typename Scalar>
1313ActuationModelAbstractTpl<Scalar>::ActuationModelAbstractTpl(
1414 std::shared_ptr<StateAbstract> state, const std::size_t nu)
15- : nu_(nu), state_(state) {}
15+ : nu_(nu),
16+ state_ (state),
17+ u_lb_(MathBase::VectorXs::Constant(
18+ nu, -std::numeric_limits<Scalar>::infinity())),
19+ u_ub_(MathBase::VectorXs::Constant(
20+ nu, std::numeric_limits<Scalar>::infinity())) {}
1621
1722template <typename Scalar>
1823std::shared_ptr<ActuationDataAbstractTpl<Scalar> >
@@ -61,6 +66,48 @@ ActuationModelAbstractTpl<Scalar>::get_state() const {
6166 return state_;
6267}
6368
69+ template <typename Scalar>
70+ const typename MathBaseTpl<Scalar>::VectorXs&
71+ ActuationModelAbstractTpl<Scalar>::get_u_lb() const {
72+ return u_lb_;
73+ }
74+
75+ template <typename Scalar>
76+ const typename MathBaseTpl<Scalar>::VectorXs&
77+ ActuationModelAbstractTpl<Scalar>::get_u_ub() const {
78+ return u_ub_;
79+ }
80+
81+ template <typename Scalar>
82+ void ActuationModelAbstractTpl<Scalar>::set_u_lb(const VectorXs& u_lb) {
83+ if (static_cast <std::size_t >(u_lb.size ()) != nu_) {
84+ throw_pretty (" Invalid argument: "
85+ << " control lower bound has wrong dimension (it should be " +
86+ std::to_string (nu_) + " )" );
87+ }
88+ u_lb_ = u_lb;
89+ for (std::size_t i = 0 ; i < nu_; ++i) {
90+ if (u_lb_[i] <= -std::numeric_limits<Scalar>::max ()) {
91+ u_lb_[i] = -std::numeric_limits<Scalar>::infinity ();
92+ }
93+ }
94+ }
95+
96+ template <typename Scalar>
97+ void ActuationModelAbstractTpl<Scalar>::set_u_ub(const VectorXs& u_ub) {
98+ if (static_cast <std::size_t >(u_ub.size ()) != nu_) {
99+ throw_pretty (" Invalid argument: "
100+ << " control upper bound has wrong dimension (it should be " +
101+ std::to_string (nu_) + " )" );
102+ }
103+ u_ub_ = u_ub;
104+ for (std::size_t i = 0 ; i < nu_; ++i) {
105+ if (u_ub_[i] >= std::numeric_limits<Scalar>::max ()) {
106+ u_ub_[i] = std::numeric_limits<Scalar>::infinity ();
107+ }
108+ }
109+ }
110+
64111template <typename Scalar>
65112std::ostream& operator <<(std::ostream& os,
66113 const ActuationModelAbstractTpl<Scalar>& model) {
0 commit comments