37 #ifndef PLANAR_MANIPULATOR_POLY_WORLD_H_
38 #define PLANAR_MANIPULATOR_POLY_WORLD_H_
40 #include "PolyWorld.h"
41 #include <Eigen/Dense>
47 PolyWorld createCorridorProblem(
int n, Eigen::Affine2d &basePose, Eigen::Affine2d &goalPose)
50 const double minX = 0;
51 const double minY = 0;
52 const double maxX = 1.25;
53 const double maxY = 1.25;
54 PolyWorld world(
"corridor", {minX, maxX}, {minY, maxY});
56 const double len = 1.0 / n;
57 const double gap = len * (1.1 * M_PI +
log(n) / (double)n);
59 std::vector<Point> pts(4);
62 const double w = ((maxX - minX) * 0.50) - gap;
63 const double h1 = minY + gap;
64 const double h2 = maxY - gap;
66 pts[0] = std::make_pair(minX, h1);
67 pts[1] = std::make_pair(minX + w, h1);
68 pts[2] = std::make_pair(minX + w, h2);
69 pts[3] = std::make_pair(minX, h2);
72 pts[0] = std::make_pair(minX + w + gap, h1);
73 pts[1] = std::make_pair(maxX, h1);
74 pts[2] = std::make_pair(maxX, h2);
75 pts[3] = std::make_pair(minX + w + gap, h2);
78 world.addObstacle(left_obj);
79 world.addObstacle(right_obj);
82 basePose = Eigen::Affine2d::Identity();
83 basePose.translation()(1) = gap / 2.0;
86 goalPose = Eigen::Affine2d::Identity();
87 goalPose.translation()(0) = (w + gap) * 0.95;
88 goalPose.translation()(1) = std::min(4.0 * gap, 0.50);
99 PolyWorld createConstrictedProblem(
int n, Eigen::Affine2d &basePose, Eigen::Affine2d &goalPose)
101 const double minX = 0;
102 const double minY = 0;
103 const double maxX = 1.25;
104 const double maxY = 1.25;
105 PolyWorld world(
"constricted", {minX, maxX}, {minY, maxY});
107 const double gap = (log10(n) / (double)n) * 2.0;
111 const double inner_gap = 1.0 / n;
114 const double robot_y = 0.5;
115 const double ymax = 1.25;
117 std::vector<Point> pts(4);
120 const double lower_interior_y = robot_y - inner_gap;
121 const double upper_interior_y = robot_y + inner_gap;
124 pts[0] = std::make_pair(0, 0);
125 pts[1] = std::make_pair(0.5, 0);
126 pts[2] = std::make_pair(0.5, lower_interior_y);
127 pts[3] = std::make_pair(0, lower_interior_y);
129 world.addObstacle(lower);
134 pts[0] = std::make_pair(0, upper_interior_y);
135 pts[1] = std::make_pair(0.5, upper_interior_y);
136 pts[2] = std::make_pair(0.5, ymax);
137 pts[3] = std::make_pair(0, ymax);
139 world.addObstacle(upper);
144 pts[0] = std::make_pair(0.5 + gap, 0.5 + (gap / 2.0));
145 pts[1] = std::make_pair(1.0, 0.5 + (gap / 2.0));
146 pts[2] = std::make_pair(1.0, 0.5 + gap);
147 pts[3] = std::make_pair(0.5 + gap, 0.5 + gap);
149 world.addObstacle(right);
152 basePose = Eigen::Affine2d::Identity();
153 basePose.translation()(1) = robot_y;
155 goalPose = Eigen::Affine2d::Identity();
156 goalPose.translation()(0) = 0.75;
157 goalPose.translation()(1) = 0.5 + 1.5 * gap;
158 goalPose.rotate(0.0);