6 #ifndef CT_OPTCON_CONSTRAINT_TERM_CONSTRAINT_OBSTACLE_IMPL_HPP_ 7 #define CT_OPTCON_CONSTRAINT_TERM_CONSTRAINT_OBSTACLE_IMPL_HPP_ 13 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR>
17 std::function<
void(
const state_vector_t&, Eigen::Matrix<SCALAR, 3, STATE_DIM>&)> getJacobian)
18 : obstacle_(obstacle), xFun_(getPosition), dXFun_(getJacobian)
23 this->
ub_(0) = std::numeric_limits<SCALAR>::max();
26 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR>
31 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR>
37 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR>
39 :
Base(arg), obstacle_(arg.obstacle_), xFun_(arg.xFun_), dXFun_(arg.dXFun_)
43 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR>
49 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR>
57 val_(0) = obstacle_->insideEllipsoid(xRef);
61 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR>
68 Eigen::Matrix<SCALAR, 3, STATE_DIM> dXRef;
71 VectorXs dist = xRef - obstacle_->x0();
72 jac_ = 2 * dist.transpose() * obstacle_->S() * obstacle_->A().transpose() * obstacle_->A() *
73 obstacle_->S().transpose() * dXRef;
77 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR>
83 return Eigen::Matrix<SCALAR, 1, CONTROL_DIM>::Zero();
90 #endif //CT_OPTCON_CONSTRAINT_TERM_CONSTRAINT_OBSTACLE_IMPL_HPP_
ct::core::ControlVector< control_dim > u
Definition: LoadFromFileTest.cpp:21
virtual MatrixXs jacobianState(const state_vector_t &x, const control_vector_t &u, const SCALAR t) override
Returns the constraint jacobian wrt state.
Definition: ObstacleConstraint-impl.h:63
Class for obstacle constraint.
Definition: ObstacleConstraint.h:19
Eigen::Matrix< SCALAR, Eigen::Dynamic, 1 > VectorXs
Definition: ConstraintBase.h:31
clear all close all load ct GNMSLog0 mat reformat t
Definition: gnmsPlot.m:6
CppAD::AD< CppAD::cg::CG< double > > SCALAR
virtual ~ObstacleConstraint()
Definition: ObstacleConstraint-impl.h:27
VectorXs ub_
lower bound on the constraints
Definition: ConstraintBase.h:203
ct::core::StateVector< state_dim > x
Definition: LoadFromFileTest.cpp:20
VectorXs lb_
Definition: ConstraintBase.h:202
virtual Eigen::Matrix< SCALAR, Eigen::Dynamic, 1 > evaluate(const state_vector_t &x, const control_vector_t &u, const SCALAR t) override
The evaluation of the constraint violation. Note this method is SCALAR typed.
Definition: ObstacleConstraint-impl.h:50
ObstacleConstraint(std::shared_ptr< ct::core::tpl::Ellipsoid< SCALAR >> obstacle, std::function< void(const state_vector_t &, Vector3s &)> getPosition, std::function< void(const state_vector_t &, Eigen::Matrix< SCALAR, 3, STATE_DIM > &)> getJacobian)
Definition: ObstacleConstraint-impl.h:14
virtual MatrixXs jacobianInput(const state_vector_t &x, const control_vector_t &u, const SCALAR t) override
Returns the constraint jacobian wrt input.
Definition: ObstacleConstraint-impl.h:79
Eigen::Matrix< SCALAR, 3, 1 > Vector3s
Definition: ObstacleConstraint.h:33
virtual size_t getConstraintSize() const override
The evaluate method used for jit compilation in constraint container ad.
Definition: ObstacleConstraint-impl.h:44
virtual ObstacleConstraint< STATE_DIM, CONTROL_DIM, SCALAR > * clone() const override
Creates a new instance of the object with same properties than original.
Definition: ObstacleConstraint-impl.h:32
Base class for the constraints used in this toolbox.
Definition: ConstraintBase.h:21
Eigen::Matrix< SCALAR, Eigen::Dynamic, Eigen::Dynamic > MatrixXs
Definition: ObstacleConstraint.h:31