Aikido
TSR.hpp
Go to the documentation of this file.
1 #ifndef AIKIDO_CONSTRAINT_DART_TSR_HPP_
2 #define AIKIDO_CONSTRAINT_DART_TSR_HPP_
3 
4 #include <Eigen/Dense>
5 #include <dart/math/MathTypes.hpp>
6 
12 
13 namespace aikido {
14 namespace constraint {
15 namespace dart {
16 
18 
19 class TSR
30  : public Sampleable
31  , public Differentiable
32  , public Testable
33  , public Projectable
34 {
35 public:
36  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
37 
39 
49  TSR(std::unique_ptr<common::RNG> _rng,
50  const Eigen::Isometry3d& _T0_w = Eigen::Isometry3d::Identity(),
51  const Eigen::Matrix<double, 6, 2>& _Bw
52  = Eigen::Matrix<double, 6, 2>::Zero(),
53  const Eigen::Isometry3d& _Tw_e = Eigen::Isometry3d::Identity(),
54  double _testableTolerance = 1e-6);
55 
64  TSR(const Eigen::Isometry3d& _T0_w = Eigen::Isometry3d::Identity(),
65  const Eigen::Matrix<double, 6, 2>& _Bw
66  = Eigen::Matrix<double, 6, 2>::Zero(),
67  const Eigen::Isometry3d& _Tw_e = Eigen::Isometry3d::Identity(),
68  double _testableTolerance = 1e-6);
69 
70  TSR(const TSR& other);
71  TSR(TSR&& other);
72 
73  TSR& operator=(const TSR& other);
74  TSR& operator=(TSR&& other);
75 
76  virtual ~TSR() = default;
77 
78  // Documentation inherited.
80 
82  std::shared_ptr<statespace::SE3> getSE3() const;
83 
84  // Documentation inherited.
85  std::unique_ptr<SampleGenerator> createSampleGenerator() const override;
86 
87  // Documentation inherited.
88  bool isSatisfied(
90  TestableOutcome* outcome = nullptr) const override;
91 
94  std::unique_ptr<TestableOutcome> createOutcome() const override;
95 
98  void validate() const;
99 
101  void setRNG(std::unique_ptr<common::RNG> rng);
102 
103  // Documentation inherited.
104  std::size_t getConstraintDimension() const override;
105 
106  // Documentation inherited.
107  void getValue(const statespace::StateSpace::State* _s, Eigen::VectorXd& _out)
108  const override;
109 
117  void getJacobian(
119  Eigen::MatrixXd& _out) const override;
120 
121  // Documentation inherited.
122  std::vector<ConstraintType> getConstraintTypes() const override;
123 
124  // Documentation inherited.
125  bool project(
127  statespace::StateSpace::State* _out) const override;
128 
130  double getTestableTolerance();
131 
134  void setTestableTolerance(double _testableTolerance);
135 
139  Eigen::Isometry3d mT0_w;
140 
142  Eigen::Matrix<double, 6, 2> mBw;
143 
146  Eigen::Isometry3d mTw_e;
147 
148 private:
151  std::unique_ptr<common::RNG> mRng;
152  std::shared_ptr<statespace::SE3> mStateSpace;
153 };
154 
155 } // namespace dart
156 } // namespace constraint
157 } // namespace aikido
158 
159 #endif // AIKIDO_CONSTRAINT_DART_TSR_HPP_
aikido::constraint::dart::TSR::validate
void validate() const
Throws an invalid_argument exception if this TSR is invalid.
aikido::constraint::dart::TSR::getConstraintDimension
std::size_t getConstraintDimension() const override
Size of constraints.
aikido::constraint::Differentiable
A differentiable constraint.
Definition: Differentiable.hpp:27
aikido::constraint::dart::TSR::mTestableTolerance
double mTestableTolerance
Tolerance used in isSatisfied as a testable.
Definition: TSR.hpp:150
aikido::constraint::dart::TSR::getStateSpace
statespace::ConstStateSpacePtr getStateSpace() const override
Gets the StateSpace that this constraint operates on.
aikido::constraint::dart::TSR::getValue
void getValue(const statespace::StateSpace::State *_s, Eigen::VectorXd &_out) const override
Get the value of constraints at _s.
aikido
Format of serialized trajectory in YAML.
Definition: algorithm.hpp:4
Differentiable.hpp
aikido::constraint::Testable
Constraint which can be tested.
Definition: Testable.hpp:17
aikido::constraint::dart::TSR::getTestableTolerance
double getTestableTolerance()
Get the testable tolerance used in isSatisfiable.
aikido::statespace::ConstStateSpacePtr
std::shared_ptr< const StateSpace > ConstStateSpacePtr
Definition: StateSpace.hpp:15
aikido::constraint::dart::TSR::setTestableTolerance
void setTestableTolerance(double _testableTolerance)
Set the testable tolerance used in isSatisfiable.
aikido::constraint::Sampleable
Constraint that may be sampled from.
Definition: Sampleable.hpp:27
aikido::constraint::dart::TSR::TSR
TSR(std::unique_ptr< common::RNG > _rng, const Eigen::Isometry3d &_T0_w=Eigen::Isometry3d::Identity(), const Eigen::Matrix< double, 6, 2 > &_Bw=Eigen::Matrix< double, 6, 2 >::Zero(), const Eigen::Isometry3d &_Tw_e=Eigen::Isometry3d::Identity(), double _testableTolerance=1e-6)
Constructor.
aikido::constraint::dart::TSR::createSampleGenerator
std::unique_ptr< SampleGenerator > createSampleGenerator() const override
Creates a SampleGenerator for sampling from this constraint.
aikido::constraint::dart::TSR::mStateSpace
std::shared_ptr< statespace::SE3 > mStateSpace
Definition: TSR.hpp:152
aikido::constraint::Projectable
A projectable constraint.
Definition: Projectable.hpp:12
aikido::constraint::dart::TSR::isSatisfied
bool isSatisfied(const statespace::StateSpace::State *_s, TestableOutcome *outcome=nullptr) const override
Returns true if state satisfies this constraint.
Sampleable.hpp
aikido::constraint::dart::TSR::getSE3
std::shared_ptr< statespace::SE3 > getSE3() const
Returns the SE3 which this TSR operates in.
Projectable.hpp
aikido::constraint::dart::TSR::mTw_e
Eigen::Isometry3d mTw_e
Transformation from "w" frame into end frame.
Definition: TSR.hpp:146
aikido::constraint::dart::TSR
TSRs describe end-effector constraint sets as subsets of SE(3).
Definition: TSR.hpp:29
aikido::constraint::dart::TSR::getConstraintTypes
std::vector< ConstraintType > getConstraintTypes() const override
Returns a vector of constraints' types, i-th element correspoinding to the type of i-th constraint.
aikido::constraint::dart::TSR::mRng
std::unique_ptr< common::RNG > mRng
Definition: TSR.hpp:151
aikido::constraint::TestableOutcome
Base class for constraint outcomes.
Definition: TestableOutcome.hpp:13
aikido::constraint::dart::TSR::setRNG
void setRNG(std::unique_ptr< common::RNG > rng)
Set the random number generator used by SampleGenerators for this TSR.
aikido::constraint::dart::TSR::~TSR
virtual ~TSR()=default
aikido::constraint::dart::TSR::project
bool project(const statespace::StateSpace::State *_s, statespace::StateSpace::State *_out) const override
Projection _s to _out.
Testable.hpp
aikido::constraint::dart::TSR::mBw
Eigen::Matrix< double, 6, 2 > mBw
Bounds on "wiggling" in x, y, z, roll, pitch, yaw.
Definition: TSR.hpp:142
aikido::constraint::Differentiable::getValueAndJacobian
virtual void getValueAndJacobian(const statespace::StateSpace::State *_s, Eigen::VectorXd &_val, Eigen::MatrixXd &_jac) const
Get both Value and Jacobian.
aikido::constraint::dart::TSR::operator=
TSR & operator=(const TSR &other)
aikido::constraint::dart::TSR::getJacobian
void getJacobian(const statespace::StateSpace::State *_s, Eigen::MatrixXd &_out) const override
Jacobian of TSR with respect to the se(3) tangent vector of _s.
aikido::statespace::StateSpace::State
Definition: StateSpace.hpp:167
aikido::constraint::dart::TSR::createOutcome
std::unique_ptr< TestableOutcome > createOutcome() const override
Return an instance of DefaultTestableOutcome, since this class doesn't have a more specialized Testab...
dart
Definition: FrameMarker.hpp:11
aikido::constraint::dart::TSR::mT0_w
Eigen::Isometry3d mT0_w
Transformation from origin frame into the TSR frame "w".
Definition: TSR.hpp:139
AIKIDO_DECLARE_POINTERS
#define AIKIDO_DECLARE_POINTERS(X)
Definition: pointers.hpp:21
SE3.hpp