|
16 | 16 |
|
17 | 17 | #include"FastPlannerOctomap/Map.h"
|
18 | 18 |
|
19 |
| -#include"FastPlannerOctomap/edtDistribution.h" |
20 |
| - |
21 | 19 | #include"std_msgs/Float64.h"
|
22 | 20 |
|
23 | 21 | #include <math.h>
|
@@ -56,10 +54,6 @@ std::vector<Eigen::Vector3d> prevTraj;
|
56 | 54 | /** Cost Map visualization **/
|
57 | 55 | visualization_msgs::MarkerArray costMap_vis;
|
58 | 56 |
|
59 |
| -ros::Publisher queryPointEdt; |
60 |
| -octomap::point3d qPt; |
61 |
| -bool queryPtUpdated = false; |
62 |
| - |
63 | 57 | /**********************************************************************************************************************************************************
|
64 | 58 | * -------------------------------------------------------------------Callbacks---------------------------------------------------------------------------*
|
65 | 59 | ***********************************************************************************************************************************************************/
|
@@ -100,40 +94,10 @@ void goal_pose_cb(const geometry_msgs::PoseStamped pose)
|
100 | 94 | std::cout<<"\n";
|
101 | 95 | }
|
102 | 96 |
|
103 |
| -/** query edt for any published point **/ |
104 |
| -void edt_cb(const geometry_msgs::PoseStamped msg) |
105 |
| -{ |
106 |
| - octomap::point3d queryPt(msg.pose.position.x, msg.pose.position.y, msg.pose.position.z); |
107 |
| - |
108 |
| - std::cout<<"Here "<<std::endl; |
109 |
| - qPt = queryPt; |
110 |
| - queryPtUpdated = true; |
111 |
| - DynamicEDTOctomap costMap(5.0, costMap3D.tree, costMap3D.start, costMap3D.end, false); |
112 |
| - |
113 |
| - // check if the point is in the map |
114 |
| - std_msgs::Float64 edt; |
115 |
| - if(costMap3D.isInMap(queryPt)) |
116 |
| - { |
117 |
| - std::cout<<costMap3D.start<<" "<<costMap3D.end<<std::endl; |
118 |
| - std::cout<<"Inside Map"<<std::endl; |
119 |
| - std::cout<<queryPt<<std::endl; |
120 |
| - float dist = costMap.getDistance(queryPt); |
121 |
| - std::cout<<"Distance of queried point "<<queryPt<<" is :-> "<<dist<<std::endl; |
122 |
| - |
123 |
| - edt.data = dist; |
124 |
| - } |
125 |
| - |
126 |
| - else |
127 |
| - { |
128 |
| - edt.data = 1000; |
129 |
| - } |
130 |
| - queryPointEdt.publish(edt); |
131 |
| - |
132 |
| -} |
133 | 97 |
|
134 | 98 | ///////////////////////////////////////////////////////////////////
|
135 | 99 | /** Plan the path until goal is reached **/
|
136 |
| -void plan(ros::Publisher path, ros::Publisher map, ros::Publisher pathEDT) |
| 100 | +void plan(ros::Publisher path, ros::Publisher map) |
137 | 101 | {
|
138 | 102 | while(!DESTINATION_REACHED || ros::ok()) /** until the goal is reached or the node is killed, keep running the process **/
|
139 | 103 | {
|
@@ -184,23 +148,9 @@ void plan(ros::Publisher path, ros::Publisher map, ros::Publisher pathEDT)
|
184 | 148 | DynamicEDTOctomap DistMap(5.0, costMap3D.tree, costMap3D.start, costMap3D.end, false); // take unknwon region as unoccupied
|
185 | 149 | DistMap.update();
|
186 | 150 |
|
187 |
| - octomap::point3d qp(24.23, 0.0 ,1.25); |
188 |
| - |
189 |
| - |
190 | 151 | // set this as the costMap in the costMap3D object
|
191 | 152 | costMap3D.costMap = &DistMap;
|
192 | 153 |
|
193 |
| - if(queryPtUpdated) |
194 |
| - {std::cout<<"--------------------------------------------------------------- Distance is "<<costMap3D.costMap->getDistance(qp)<<std::endl; |
195 |
| - std_msgs::Float64 edt; |
196 |
| - edt.data = costMap3D.costMap->getDistance(qPt); |
197 |
| - queryPointEdt.publish(edt); |
198 |
| - queryPtUpdated = false; |
199 |
| - |
200 |
| - } |
201 |
| - |
202 |
| - |
203 |
| - |
204 | 154 | // set planning range and pass cost map to planner
|
205 | 155 | kAstar.init(costMap3D.start, costMap3D.end, currPose);
|
206 | 156 | kAstar.setEnvironment(&DistMap);
|
@@ -257,19 +207,6 @@ void plan(ros::Publisher path, ros::Publisher map, ros::Publisher pathEDT)
|
257 | 207 | Eigen::Vector3d pos = *i;
|
258 | 208 | Eigen::Vector3d pos_next;
|
259 | 209 |
|
260 |
| - // store the distance to nearest obstacle for each wayoint |
261 |
| - octomap::point3d pt_(pos(0), pos(1), pos(2)); |
262 |
| - octomap::point3d ptObs; |
263 |
| - |
264 |
| - float dist; |
265 |
| - DistMap.getDistanceAndClosestObstacle(pt_, dist, ptObs); |
266 |
| - pEdt.pose.position.x = ptObs.x(); |
267 |
| - pEdt.pose.position.y = ptObs.y(); |
268 |
| - pEdt.pose.position.z = ptObs.z(); |
269 |
| - |
270 |
| - generatedPathEDT.header.stamp = ros::Time::now(); |
271 |
| - generatedPathEDT.header.frame_id = "map"; |
272 |
| - generatedPathEDT.poses.push_back(pEdt); |
273 | 210 |
|
274 | 211 | // std::cout<<"Waypoint in current trajectory ..."<<pos<<std::endl;
|
275 | 212 |
|
@@ -303,8 +240,6 @@ void plan(ros::Publisher path, ros::Publisher map, ros::Publisher pathEDT)
|
303 | 240 | // publish the path
|
304 | 241 | path.publish(generatedPath);
|
305 | 242 |
|
306 |
| - // publish the EDT data for the path |
307 |
| - pathEDT.publish(generatedPathEDT); |
308 | 243 |
|
309 | 244 | // insert this in the global trajectory
|
310 | 245 | trajectory.insert(trajectory.end(), currTraj.begin(), currTraj.end());
|
@@ -354,11 +289,6 @@ int main(int argc, char **argv)
|
354 | 289 | /** Publishers **/
|
355 | 290 | ros::Publisher path = n.advertise<nav_msgs::Path>("/fastPlanner_path",1);
|
356 | 291 | ros::Publisher map = n.advertise<visualization_msgs::MarkerArray>("/costMap_marker_array",1); // one at a time
|
357 |
| - ros::Publisher pathEDT = n.advertise<nav_msgs::Path>("/fastPlanner_path_EDT",1); |
358 |
| - |
359 |
| - /** EDT Subscriber and distance publisher **/ |
360 |
| - ros::Subscriber queryPoint = n.subscribe<geometry_msgs::PoseStamped>("/query_point_topic", 1, edt_cb); |
361 |
| - queryPointEdt = n.advertise<std_msgs::Float64>("/query_point_distance", 1); |
362 | 292 |
|
363 | 293 | ros::Rate rate(20);
|
364 | 294 |
|
@@ -391,7 +321,7 @@ int main(int argc, char **argv)
|
391 | 321 |
|
392 | 322 | kAstar.setParam(n); // set the fast planner parameters
|
393 | 323 |
|
394 |
| - plan(path, map, pathEDT); |
| 324 | + plan(path, map); |
395 | 325 | }
|
396 | 326 |
|
397 | 327 | return 0;
|
|
0 commit comments