9#include <sleipnir/autodiff/variable.hpp>
10#include <sleipnir/optimization/problem.hpp>
12#include "trajopt/geometry/pose2.hpp"
13#include "trajopt/geometry/translation2.hpp"
14#include "trajopt/util/symbol_exports.hpp"
30 double heading_tolerance,
bool flip =
false)
31 : m_field_point{std::move(field_point)},
32 m_heading_tolerance{heading_tolerance},
34 assert(m_heading_tolerance >= 0.0);
46 slp::Problem<double>& problem,
const Pose2v<double>& pose,
47 [[maybe_unused]]
const Translation2v<double>& linear_velocity,
48 [[maybe_unused]]
const slp::Variable<double>& angular_velocity,
49 [[maybe_unused]]
const Translation2v<double>& linear_acceleration,
50 [[maybe_unused]]
const slp::Variable<double>& angular_acceleration) {
58 auto dx = m_field_point.x() - pose.
x();
59 auto dy = m_field_point.y() - pose.
y();
63 problem.subject_to(dot >=
64 std::cos(m_heading_tolerance) * slp::hypot(dx, dy));
67 problem.subject_to(dot <=
68 -std::cos(m_heading_tolerance) * slp::hypot(dx, dy));
73 Translation2d m_field_point;
74 double m_heading_tolerance;
void apply(slp::Problem< double > &problem, const Pose2v< double > &pose, const Translation2v< double > &linear_velocity, const slp::Variable< double > &angular_velocity, const Translation2v< double > &linear_acceleration, const slp::Variable< double > &angular_acceleration)
Definition point_at_constraint.hpp:45
PointAtConstraint(Translation2d field_point, double heading_tolerance, bool flip=false)
Definition point_at_constraint.hpp:29
constexpr const Rotation2< T > & rotation() const
Definition pose2.hpp:66
constexpr const T & x() const
Definition pose2.hpp:56
constexpr const T & y() const
Definition pose2.hpp:61
constexpr const T & cos() const
Definition rotation2.hpp:122
constexpr const T & sin() const
Definition rotation2.hpp:127