43 double distance_offset)
const 47 double dx = end.position.x - start.position.x, dy = end.position.y - start.position.y;
48 double d = sqrt(dx * dx + dy * dy);
49 double ux = dx / d, uy = dy / d;
51 double l = distance_offset;
54 pose.
setXYZ(start.position.x + ux * l, start.position.y + uy * l, 0);
55 pose.
setRPY(0, 0, atan2(uy, ux));
56 poses.push_back(pose.
create());
57 l += distance_resolution;
59 distance_offset = l - d;
63 static const double LEFT = -1.;
64 static const double RIGHT = +1.;
65 double direction = LEFT;
73 double dx0 = start.position.x - center.position.x, dy0 = start.position.y - center.position.y;
74 double a0 = atan2(dy0, dx0);
75 double radius = sqrt(dx0 * dx0 + dy0 * dy0);
76 double dx1 = end.position.x - center.position.x, dy1 = end.position.y - center.position.y;
77 double a1 = atan2(dy1, dx1);
79 double da = atan2(sin(a0 - a1), cos(a0 - a1));
80 if (direction == RIGHT)
82 da = da < 0 ? da : da - 2 * M_PI;
86 da = da >= 0 ? da : da + 2 * M_PI;
88 double d = fabs(da) * radius;
91 double l = distance_offset;
94 double a = a0 + l / radius * direction;
95 pose.
setXYZ(center.position.x + cos(a) * radius, center.position.y + sin(a) * radius, 0);
96 pose.
setRPY(0, 0, a + (M_PI / 2. * direction));
97 poses.push_back(pose.
create());
98 l += distance_resolution;
100 distance_offset = l - d;
102 return distance_offset;
106 double distance_offset)
const 110 double radius =
tuw::Distance(start.position, center.position);
111 double distance_resolution = angle_resolution * radius;
116 double distance_resolution =
tuw::Distance(start.position, end.position);
static const unsigned int ARC
double Distance(const geometry_msgs::Point &a, const geometry_msgs::Point &b)
static const unsigned int COUNTER_CLOCKWISE
static const unsigned int LINE
double sample_equal_angle(std::vector< geometry_msgs::PosePtr > &poses, double angle, double distance_offset) const
double sample_equal_distance(std::vector< geometry_msgs::PosePtr > &poses, double distance, double distance_offset) const
Pose & setXYZ(double x, double y, double z)
Pose & setRPY(double roll, double pitch, double yaw)
static const unsigned int CLOCKWISE
geometry_msgs::PosePtr create()