se2ez
projection.cpp
Go to the documentation of this file.
1 /* Author: Zachary Kingston */
2 
3 #include <se2ez/core/log.h>
4 #include <se2ez/core/math.h>
5 #include <se2ez/core/robot.h>
6 #include <se2ez/core/state.h>
7 
8 #include <se2ez/plan/space.h>
10 
11 using namespace se2ez;
12 
14  : ompl::base::ProjectionEvaluator(ss), robot_(ss->getRobot()), frame_(frame)
15 {
16 }
17 
18 Eigen::Isometry2d plan::Projection::getPose(const ompl::base::State *state) const
19 {
20  auto *as = const_cast<StateSpace::StateType *>(state->as<StateSpace::StateType>());
21  return as->state->getPose(robot_, frame_);
22 }
23 
25 {
26  cellSizes_.resize(getDimension());
27  for (unsigned int i = 0; i < getDimension(); ++i)
28  cellSizes_[i] = 0.1;
29 }
30 
32 {
33 }
34 
36 {
37  return 2;
38 }
39 
40 void plan::R2Projection::project(const ompl::base::State *state, Eigen::Ref<Eigen::VectorXd> projection) const
41 {
42  projection = tf::flattenIsometry(getPose(state)).head(2);
43 }
44 
46  : Projection(ss, frame)
47 {
48 }
49 
51 {
52  return 3;
53 }
54 
55 void plan::SE2Projection::project(const ompl::base::State *state,
56  Eigen::Ref<Eigen::VectorXd> projection) const
57 {
58  projection = tf::flattenIsometry(getPose(state));
59 }
const std::string frame_
Definition: projection.h:36
Eigen::Vector3d flattenIsometry(const Eigen::Isometry2d &frame)
Converts a transformation frame into a vector [x, y, t] composed of a translation (x...
Definition: math.cpp:30
Projection(const plan::StateSpace *ss, const std::string &frame)
Definition: projection.cpp:13
void defaultCellSizes() override
Definition: projection.cpp:24
R2Projection(const plan::StateSpace *ss, const std::string &frame)
Definition: projection.cpp:31
const RobotPtr robot_
Definition: projection.h:35
Definition: goals.h:10
unsigned int getDimension() const override
Definition: projection.cpp:50
void project(const ompl::base::State *state, Eigen::Ref< Eigen::VectorXd > projection) const override
Definition: projection.cpp:55
Main namespace.
Definition: collision.h:11
Eigen::Isometry2d getPose(const ompl::base::State *state) const
Definition: projection.cpp:18
void project(const ompl::base::State *state, Eigen::Ref< Eigen::VectorXd > projection) const override
Definition: projection.cpp:40
unsigned int getDimension() const override
Definition: projection.cpp:35
SE2Projection(const plan::StateSpace *ss, const std::string &frame)
Definition: projection.cpp:45