aikido
StateSpace.hpp
1 #ifndef AIKIDO_STATESPACE_STATESPACE_HPP_
2 #define AIKIDO_STATESPACE_STATESPACE_HPP_
3 
4 #include <memory>
5 
6 #include <Eigen/Dense>
7 
8 #include "aikido/common/RNG.hpp"
9 #include "aikido/common/pointers.hpp"
10 #include "aikido/statespace/ScopedState.hpp"
11 
12 namespace aikido {
13 namespace statespace {
14 
15 AIKIDO_DECLARE_POINTERS(StateSpace)
16 
17 class StateSpace
34 {
35 public:
37  class State;
38 
39  using StateHandle = statespace::StateHandle<StateSpace, State>;
40  using StateHandleConst = statespace::StateHandle<StateSpace, const State>;
41 
42  using ScopedState = statespace::ScopedState<StateHandle>;
43  using ScopedStateConst = statespace::ScopedState<StateHandleConst>;
44 
45  virtual ~StateSpace() = default;
46 
50  ScopedState createState() const;
51 
53  ScopedState cloneState(const State* stateIn) const;
54 
60  virtual State* allocateState() const;
61 
66  virtual void freeState(State* _state) const;
67 
71  virtual std::size_t getStateSizeInBytes() const = 0;
72 
79  virtual State* allocateStateInBuffer(void* _buffer) const = 0;
80 
85  virtual void freeStateInBuffer(State* _state) const = 0;
86 
93  virtual void compose(
94  const State* _state1, const State* _state2, State* _out) const = 0;
95 
105  virtual void compose(State* _state1, const State* _state2) const;
106 
113  virtual void getIdentity(State* _out) const = 0;
114 
123  virtual void getInverse(const State* _state, State* _out) const = 0;
124 
129  virtual void getInverse(State* _state) const;
130 
135  virtual std::size_t getDimension() const = 0;
136 
141  virtual void copyState(
142  const StateSpace::State* _source,
143  StateSpace::State* _destination) const = 0;
144 
151  virtual void expMap(const Eigen::VectorXd& _tangent, State* _out) const = 0;
152 
159  virtual void logMap(const State* _in, Eigen::VectorXd& _tangent) const = 0;
160 
164  virtual void print(const State* _state, std::ostream& _os) const = 0;
165 };
166 
168 {
169 protected:
171  State() = default;
172 
176  ~State() = default;
177 };
178 
179 } // namespace statespace
180 } // namespace aikido
181 
182 #endif // ifndef AIKIDO_STATESPACE_STATESPACE_HPP_
StateSpace of a DART MetaSkeleton.
Definition: MetaSkeletonStateSpace.hpp:26
Format of serialized trajectory in YAML.
Definition: algorithm.hpp:4
A tuple of states where the i-th state is from the i-th subspace.
Definition: CartesianProduct.hpp:162
Definition: StateSpace.hpp:167