7#include <geometry_msgs/PoseStamped.h>
8#include <tf/transform_datatypes.h>
9#include <angles/angles.h>
13 geometry_msgs::PoseStamped
makePureSpinningSubPlan(
const geometry_msgs::PoseStamped& start,
double dstRads, std::vector<geometry_msgs::PoseStamped>& plan,
double puresSpinningRadStep=1000)
15 double startYaw = tf::getYaw(start.pose.orientation);
20 double goalAngleOffset = angles::shortest_angular_distance(startYaw, dstRads);
23 double radstep = 0.005;
25 if( goalAngleOffset>=0)
29 for(
double dangle = 0; dangle <= goalAngleOffset;dangle+=radstep )
31 geometry_msgs::PoseStamped p= start;
32 double yaw = startYaw+ dangle;
34 p.pose.orientation = tf::createQuaternionMsgFromYaw(yaw);
42 for(
double dangle = 0; dangle >= goalAngleOffset;dangle-=radstep )
45 geometry_msgs::PoseStamped p= start;
46 double yaw = startYaw+ dangle;
48 p.pose.orientation = tf::createQuaternionMsgFromYaw(yaw);
54 geometry_msgs::PoseStamped end= start;
55 end.pose.orientation = tf::createQuaternionMsgFromYaw(dstRads);
62 const geometry_msgs::Point& goal,
64 std::vector<geometry_msgs::PoseStamped>& plan)
67 double steps = length /dx;
68 double dt = 1.0/steps;
73 plan.push_back(startOrientedPose);
76 for(
double t=0; t <=1.0; t+=dt)
78 geometry_msgs::PoseStamped p = startOrientedPose;
80 p.pose.position.x = startOrientedPose.pose.position.x *(1 - t) + goal.x * t;
81 p.pose.position.y = startOrientedPose.pose.position.y *(1 - t) + goal.y * t;
82 p.pose.orientation = startOrientedPose.pose.orientation;
geometry_msgs::PoseStamped makePureStraightSubPlan(const geometry_msgs::PoseStamped &startOrientedPose, const geometry_msgs::Point &goal, double length, std::vector< geometry_msgs::PoseStamped > &plan)
geometry_msgs::PoseStamped makePureSpinningSubPlan(const geometry_msgs::PoseStamped &start, double dstRads, std::vector< geometry_msgs::PoseStamped > &plan, double puresSpinningRadStep=1000)