Skip to content

Commit f0ac032

Browse files
committed
Removed edt distribution stuff
1 parent 8cf4564 commit f0ac032

File tree

2 files changed

+2
-180
lines changed

2 files changed

+2
-180
lines changed

include/FastPlannerOctomap/edtDistribution.h

-108
This file was deleted.

src/Planner.cpp

+2-72
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
#include"FastPlannerOctomap/Map.h"
1818

19-
#include"FastPlannerOctomap/edtDistribution.h"
20-
2119
#include"std_msgs/Float64.h"
2220

2321
#include <math.h>
@@ -56,10 +54,6 @@ std::vector<Eigen::Vector3d> prevTraj;
5654
/** Cost Map visualization **/
5755
visualization_msgs::MarkerArray costMap_vis;
5856

59-
ros::Publisher queryPointEdt;
60-
octomap::point3d qPt;
61-
bool queryPtUpdated = false;
62-
6357
/**********************************************************************************************************************************************************
6458
* -------------------------------------------------------------------Callbacks---------------------------------------------------------------------------*
6559
***********************************************************************************************************************************************************/
@@ -100,40 +94,10 @@ void goal_pose_cb(const geometry_msgs::PoseStamped pose)
10094
std::cout<<"\n";
10195
}
10296

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-
}
13397

13498
///////////////////////////////////////////////////////////////////
13599
/** 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)
137101
{
138102
while(!DESTINATION_REACHED || ros::ok()) /** until the goal is reached or the node is killed, keep running the process **/
139103
{
@@ -184,23 +148,9 @@ void plan(ros::Publisher path, ros::Publisher map, ros::Publisher pathEDT)
184148
DynamicEDTOctomap DistMap(5.0, costMap3D.tree, costMap3D.start, costMap3D.end, false); // take unknwon region as unoccupied
185149
DistMap.update();
186150

187-
octomap::point3d qp(24.23, 0.0 ,1.25);
188-
189-
190151
// set this as the costMap in the costMap3D object
191152
costMap3D.costMap = &DistMap;
192153

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-
204154
// set planning range and pass cost map to planner
205155
kAstar.init(costMap3D.start, costMap3D.end, currPose);
206156
kAstar.setEnvironment(&DistMap);
@@ -257,19 +207,6 @@ void plan(ros::Publisher path, ros::Publisher map, ros::Publisher pathEDT)
257207
Eigen::Vector3d pos = *i;
258208
Eigen::Vector3d pos_next;
259209

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);
273210

274211
// std::cout<<"Waypoint in current trajectory ..."<<pos<<std::endl;
275212

@@ -303,8 +240,6 @@ void plan(ros::Publisher path, ros::Publisher map, ros::Publisher pathEDT)
303240
// publish the path
304241
path.publish(generatedPath);
305242

306-
// publish the EDT data for the path
307-
pathEDT.publish(generatedPathEDT);
308243

309244
// insert this in the global trajectory
310245
trajectory.insert(trajectory.end(), currTraj.begin(), currTraj.end());
@@ -354,11 +289,6 @@ int main(int argc, char **argv)
354289
/** Publishers **/
355290
ros::Publisher path = n.advertise<nav_msgs::Path>("/fastPlanner_path",1);
356291
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);
362292

363293
ros::Rate rate(20);
364294

@@ -391,7 +321,7 @@ int main(int argc, char **argv)
391321

392322
kAstar.setParam(n); // set the fast planner parameters
393323

394-
plan(path, map, pathEDT);
324+
plan(path, map);
395325
}
396326

397327
return 0;

0 commit comments

Comments
 (0)