59 config.sim_granularity,
60 config.angular_sim_granularity,
88 int vx_samp, vy_samp, vth_samp;
89 vx_samp = config.vx_samples;
90 vy_samp = config.vy_samples;
91 vth_samp = config.vth_samples;
94 ROS_WARN(
"You've specified that you don't want any samples in the x dimension. We'll at least assume that you want to sample one value... so we're going to set vx_samples to 1 instead");
96 config.vx_samples = vx_samp;
100 ROS_WARN(
"You've specified that you don't want any samples in the y dimension. We'll at least assume that you want to sample one value... so we're going to set vy_samples to 1 instead");
102 config.vy_samples = vy_samp;
106 ROS_WARN(
"You've specified that you don't want any samples in the th dimension. We'll at least assume that you want to sample one value... so we're going to set vth_samples to 1 instead");
108 config.vth_samples = vth_samp;
122 goal_costs_(planner_util->getCostmap(), 0.0, 0.0, true),
134 std::string controller_frequency_param_name;
135 if(!private_nh.
searchParam(
"controller_frequency", controller_frequency_param_name)) {
138 double controller_frequency = 0;
139 private_nh.
param(controller_frequency_param_name, controller_frequency, 20.0);
140 if(controller_frequency > 0) {
143 ROS_WARN(
"A controller_frequency less than 0 has been set. Ignoring the parameter, assuming a rate of 20Hz");
152 private_nh.
param(
"sum_scores", sum_scores,
false);
159 std::string frame_id;
160 private_nh.
param(
"global_frame_id", frame_id, std::string(
"odom"));
162 traj_cloud_ =
new pcl::PointCloud<base_local_planner::MapGridCostPoint>;
169 std::vector<base_local_planner::TrajectoryCostFunction*> critics;
179 std::vector<base_local_planner::TrajectorySampleGenerator*> generator_list;
219 Eigen::Vector3f vel_samples){
222 geometry_msgs::PoseStamped goal_pose =
global_plan_.back();
223 Eigen::Vector3f goal(goal_pose.pose.position.x, goal_pose.pose.position.y,
tf::getYaw(goal_pose.pose.orientation));
236 ROS_WARN(
"Invalid Trajectory %f, %f, %f, cost: %f", vel_samples[0], vel_samples[1], vel_samples[2], cost);
245 const std::vector<geometry_msgs::PoseStamped>& new_plan,
246 const std::vector<geometry_msgs::Point>& footprint_spec) {
248 for (
unsigned int i = 0; i < new_plan.size(); ++i) {
261 geometry_msgs::PoseStamped goal_pose =
global_plan_.back();
263 Eigen::Vector3f pos(global_pose.getOrigin().getX(), global_pose.getOrigin().getY(),
tf::getYaw(global_pose.getRotation()));
265 (pos[0] - goal_pose.pose.position.x) * (pos[0] - goal_pose.pose.position.x) +
266 (pos[1] - goal_pose.pose.position.y) * (pos[1] - goal_pose.pose.position.y);
273 std::vector<geometry_msgs::PoseStamped> front_global_plan =
global_plan_;
274 double angle_to_goal =
atan2(goal_pose.pose.position.y - pos[1], goal_pose.pose.position.x - pos[0]);
275 front_global_plan.back().pose.position.x = front_global_plan.back().pose.position.x +
277 front_global_plan.back().pose.position.y = front_global_plan.back().pose.position.y +
forward_point_distance_ *
306 Eigen::Vector3f pos(global_pose.getOrigin().getX(), global_pose.getOrigin().getY(),
tf::getYaw(global_pose.getRotation()));
307 Eigen::Vector3f vel(global_vel.getOrigin().getX(), global_vel.getOrigin().getY(),
tf::getYaw(global_vel.getRotation()));
308 geometry_msgs::PoseStamped goal_pose =
global_plan_.back();
309 Eigen::Vector3f goal(goal_pose.pose.position.x, goal_pose.pose.position.y,
tf::getYaw(goal_pose.pose.orientation));
321 std::vector<base_local_planner::Trajectory> all_explored;
330 std_msgs::Header header;
334 for(std::vector<base_local_planner::Trajectory>::iterator
t=all_explored.begin();
t != all_explored.end(); ++
t)
339 for(
unsigned int i = 0; i <
t->getPointsSize(); ++i) {
340 double p_x, p_y, p_th;
341 t->getPoint(i, p_x, p_y, p_th);
364 drive_velocities.setIdentity();
367 drive_velocities.setOrigin(start);
370 drive_velocities.setBasis(matrix);
void initialise(const Eigen::Vector3f &pos, const Eigen::Vector3f &vel, const Eigen::Vector3f &goal, base_local_planner::LocalPlannerLimits *limits, const Eigen::Vector3f &vsamples, std::vector< Eigen::Vector3f > additional_samples, bool discretize_by_time=false)
void setFootprint(std::vector< geometry_msgs::Point > footprint_spec)
void reconfigure(DWAPlannerConfig &cfg)
Reconfigures the trajectory planner.
std::string getGlobalFrame()
pcl_ros::Publisher< base_local_planner::MapGridCostPoint > traj_cloud_pub_
bool setPlan(const std::vector< geometry_msgs::PoseStamped > &orig_global_plan)
bool generateTrajectory(Eigen::Vector3f pos, Eigen::Vector3f vel, Eigen::Vector3f sample_target_vel, base_local_planner::Trajectory &traj)
base_local_planner::MapGridCostFunction goal_front_costs_
void publishCostCloud(const costmap_2d::Costmap2D *costmap_p_)
base_local_planner::MapGridCostFunction goal_costs_
double sim_period_
The number of seconds to use to compute max/min vels for dwa.
static double getYaw(const Quaternion &bt_q)
costmap_2d::Costmap2D * getCostmap()
void resetOscillationFlags()
base_local_planner::OscillationCostFunction oscillation_costs_
base_local_planner::LocalPlannerUtil * planner_util_
bool publish_cost_grid_pc_
Whether or not to build and publish a PointCloud.
double unreachableCellCosts()
bool getCellCosts(int cx, int cy, float &path_cost, float &goal_cost, float &occ_cost, float &total_cost)
Compute the components and total cost for a map grid cell.
void initialize(const std::string &name, std::string frame, boost::function< bool(int cx, int cy, float &path_cost, float &goal_cost, float &occ_cost, float &total_cost)> cost_function)
base_local_planner::TwirlingCostFunction twirling_costs_
geometry_msgs::TransformStamped t
std::vector< geometry_msgs::PoseStamped > global_plan_
pcl::PointCloud< base_local_planner::MapGridCostPoint > * traj_cloud_
double scoreTrajectory(Trajectory &traj, double best_traj_cost)
void setStopOnFailure(bool stop_on_failure)
void setRotation(const Quaternion &q)
base_local_planner::MapGridCostFunction alignment_costs_
DWAPlanner(std::string name, base_local_planner::LocalPlannerUtil *planner_util)
Constructor for the planner.
void setSumScores(bool score_sums)
boost::mutex configuration_mutex_
base_local_planner::SimpleScoredSamplingPlanner scored_sampling_planner_
bool findBestTrajectory(Trajectory &traj, std::vector< Trajectory > *all_explored=0)
void fromPCL(const pcl::uint64_t &pcl_stamp, ros::Time &stamp)
Eigen::Vector3f vsamples_
unsigned char getCost(unsigned int mx, unsigned int my) const
static const unsigned char INSCRIBED_INFLATED_OBSTACLE
static Quaternion createQuaternionFromYaw(double yaw)
base_local_planner::ObstacleCostFunction obstacle_costs_
base_local_planner::MapGridVisualizer map_viz_
The map grid visualizer for outputting the potential field generated by the cost function.
bool searchParam(const std::string &key, std::string &result) const
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
LocalPlannerLimits getCurrentLimits()
void publish(const boost::shared_ptr< const pcl::PointCloud< PointT > > &point_cloud) const
base_local_planner::MapGridCostFunction path_costs_
void updatePlanAndLocalCosts(tf::Stamped< tf::Pose > global_pose, const std::vector< geometry_msgs::PoseStamped > &new_plan, const std::vector< geometry_msgs::Point > &footprint_spec)
Update the cost functions before planning.
void setParameters(double sim_time, double sim_granularity, double angular_sim_granularity, bool use_dwa=false, double sim_period=0.0)
bool setPlan(const std::vector< geometry_msgs::PoseStamped > &orig_global_plan)
base_local_planner::Trajectory findBestPath(tf::Stamped< tf::Pose > global_pose, tf::Stamped< tf::Pose > global_vel, tf::Stamped< tf::Pose > &drive_velocities)
Given the current position and velocity of the robot, find the best trajectory to exectue...
double forward_point_distance_
void setParams(double max_trans_vel, double max_scaling_factor, double scaling_speed)
INLINE Rall1d< T, V, S > atan2(const Rall1d< T, V, S > &y, const Rall1d< T, V, S > &x)
void setTargetPoses(std::vector< geometry_msgs::PoseStamped > target_poses)
base_local_planner::Trajectory result_traj_
base_local_planner::SimpleTrajectoryGenerator generator_
double stop_time_buffer_
How long before hitting something we're going to enforce that the robot stop.
double getCellCosts(unsigned int cx, unsigned int cy)
INLINE Rall1d< T, V, S > cos(const Rall1d< T, V, S > &arg)
double getResolution() const
void setScale(double scale)
void setXShift(double xshift)
INLINE Rall1d< T, V, S > sin(const Rall1d< T, V, S > &arg)
void advertise(ros::NodeHandle &nh, const std::string &topic, uint32_t queue_size)
void toPCL(const ros::Time &stamp, pcl::uint64_t &pcl_stamp)
void updateOscillationFlags(Eigen::Vector3f pos, base_local_planner::Trajectory *traj, double min_vel_trans)
void setOscillationResetDist(double dist, double angle)
bool checkTrajectory(const Eigen::Vector3f pos, const Eigen::Vector3f vel, const Eigen::Vector3f vel_samples)
Check if a trajectory is legal for a position/velocity pair.