2 #include <ros/subscriber.h>
3 #include <ros/publisher.h>
4 #include <sensor_msgs/PointCloud2.h>
5 #include <nav_msgs/Path.h>
6 #include <geometry_msgs/PoseStamped.h>
9 #include <geometry_msgs/PoseStamped.h>
10 #include <tf/transform_datatypes.h>
12 #include <pcl_conversions/pcl_conversions.h>
14 #include <igvc_msgs/action_path.h>
38 tf::quaternionMsgToTF(msg->pose.orientation, q);
49 int main(
int argc,
char** argv)
51 ros::init(argc, argv,
"pathplanner");
55 ros::Subscriber map_sub = nh.subscribe(
"/map", 1,
map_callback);
57 ros::Subscriber pose_sub = nh.subscribe(
"/robot_pose_ekf/odom_combined", 1,
position_callback);
61 disp_path_pub = nh.advertise<nav_msgs::Path>(
"/path_display", 1);
63 act_path_pub = nh.advertise<igvc_msgs::action_path>(
"/path", 1);
65 double baseline = 0.7275;
67 search_problem.
Map = pcl::PointCloud<pcl::PointXYZ>::Ptr(
new pcl::PointCloud<pcl::PointXYZ>());
92 nav_msgs::Path disp_path_msg;
93 disp_path_msg.header.stamp = ros::Time::now();
94 disp_path_msg.header.frame_id =
"map";
95 for(
auto loc : *(
path.getStates()))
97 geometry_msgs::PoseStamped pose;
98 pose.header.stamp = disp_path_msg.header.stamp;
99 pose.header.frame_id = disp_path_msg.header.frame_id;
100 pose.pose.position.x = loc.x;
101 pose.pose.position.y = loc.y;
102 disp_path_msg.poses.push_back(pose);
106 igvc_msgs::action_path act_path_msg;
107 act_path_msg.header.stamp = ros::Time::now();
108 act_path_msg.header.frame_id =
"map";
109 for(
auto action : *(
path.getActions()))
111 igvc_msgs::velocity_pair vels;
112 vels.header.stamp = act_path_msg.header.stamp;
113 vels.header.frame_id = act_path_msg.header.frame_id;
114 double radius = action.V / action.W;
115 vels.left_velocity = (radius - baseline/2.) * action.W;
116 vels.right_velocity = (radius + baseline/2.) * action.W;
117 vels.duration = action.DeltaT;
118 act_path_msg.actions.push_back(vels);
120 act_path_pub.publish(act_path_msg);
pcl::PointCloud< pcl::PointXYZ >::Ptr Map
ros::Publisher act_path_pub
float distTo(SearchLocation other)
static Path< StateType, ActionType > AStar(SearchProblem< StateType, ActionType > &problem)
IGVCSearchProblem search_problem
void map_callback(const sensor_msgs::PointCloud2ConstPtr &msg)
void position_callback(const geometry_msgs::PoseStampedConstPtr &msg)
int main(int argc, char **argv)
ros::Publisher disp_path_pub
void waypoint_callback(const geometry_msgs::PointStampedConstPtr &msg)