63 dwb_msgs::GenerateTwists::Response &res)
70 dwb_msgs::GenerateTrajectory::Response &res)
72 res.traj =
traj_generator_->generateTrajectory(req.start_pose, req.start_vel, req.cmd_vel);
77 dwb_msgs::ScoreTrajectory::Response &res)
79 if (req.goal.header.frame_id !=
"")
81 if (req.global_plan.poses.size() > 0)
84 prepare(req.pose, req.velocity);
93 if (critic->getName() == name)
100 dwb_msgs::GetCriticScore::Response &res)
103 if (critic ==
nullptr)
105 ROS_WARN_NAMED(
"DebugDWBLocalPlanner",
"Critic %s not found!", req.critic_name.c_str());
108 if (req.goal.header.frame_id !=
"")
110 if (req.global_plan.poses.size() > 0)
114 prepare(req.pose, req.velocity);
116 res.score.raw_score = critic->scoreTrajectory(req.traj);
117 res.score.scale = critic->getScale();
118 res.score.name = req.critic_name;
126 dwb_msgs::DebugLocalPlan::Response &res)
128 if (req.goal.header.frame_id !=
"")
130 if (req.global_plan.poses.size() > 0)
132 std::shared_ptr<dwb_msgs::LocalPlanEvaluation> results = std::make_shared<dwb_msgs::LocalPlanEvaluation>();
136 res.results = *results;
141 ROS_ERROR_NAMED(
"DebugDWBLocalPlanner",
"Exception in computeVelocityCommands: %s", e.what());
bool generateTwistsService(dwb_msgs::GenerateTwists::Request &req, dwb_msgs::GenerateTwists::Response &res)
bool generateTrajectoryService(dwb_msgs::GenerateTrajectory::Request &req, dwb_msgs::GenerateTrajectory::Response &res)
void publishCostGrid(const nav_core2::Costmap::Ptr costmap, const std::vector< TrajectoryCritic::Ptr > critics)
TrajectoryCritic::Ptr getCritic(std::string name)
ros::ServiceServer critic_service_
ros::ServiceServer score_service_
#define ROS_WARN_NAMED(name,...)
std::shared_ptr< dwb_local_planner::TrajectoryCritic > Ptr
nav_core2::Costmap::Ptr costmap_
TrajectoryGenerator::Ptr traj_generator_
virtual void prepare(const nav_2d_msgs::Pose2DStamped &pose, const nav_2d_msgs::Twist2D &velocity)
Helper method for preparing for the core scoring algorithm.
ServiceServer advertiseService(const std::string &service, bool(T::*srv_func)(MReq &, MRes &), T *obj)
ros::ServiceServer generate_traj_service_
bool scoreTrajectoryService(dwb_msgs::ScoreTrajectory::Request &req, dwb_msgs::ScoreTrajectory::Response &res)
ros::ServiceServer debug_service_
void initialize(const ros::NodeHandle &parent, const std::string &name, TFListenerPtr tf, nav_core2::Costmap::Ptr costmap) override
nav_core2 initialization
nav_2d_msgs::Twist2DStamped computeVelocityCommands(const nav_2d_msgs::Pose2DStamped &pose, const nav_2d_msgs::Twist2D &velocity) override
nav_core2 computeVelocityCommands - calculates the best command given the current pose and velocity ...
bool debugLocalPlanService(dwb_msgs::DebugLocalPlan::Request &req, dwb_msgs::DebugLocalPlan::Response &res)
bool getCriticScoreService(dwb_msgs::GetCriticScore::Request &req, dwb_msgs::GetCriticScore::Response &res)
void setPlan(const nav_2d_msgs::Path2D &path) override
nav_core2 setPlan - Sets the global plan
ros::ServiceServer twist_gen_service_
void initialize(const ros::NodeHandle &parent, const std::string &name, TFListenerPtr tf, nav_core2::Costmap::Ptr costmap) override
Override the DWB constructor to also advertise the services.
#define ROS_ERROR_NAMED(name,...)
A version of DWBLocalPlanner with ROS services for the major components.
std::vector< TrajectoryCritic::Ptr > critics_
std::shared_ptr< Costmap > Ptr
std::shared_ptr< tf::TransformListener > TFListenerPtr
ros::NodeHandle planner_nh_
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)
virtual dwb_msgs::TrajectoryScore scoreTrajectory(const dwb_msgs::Trajectory2D &traj, double best_score=-1)
Score a given command. Can be used for testing.
void setGoalPose(const nav_2d_msgs::Pose2DStamped &goal_pose) override
nav_core2 setGoalPose - Sets the global goal pose