|
@@ -254,8 +254,10 @@ int detectStopObstacle(const pcl::PointCloud<pcl::PointXYZ>& points, const int c
|
|
|
*obstacle_type = EObstacleType::NONE;
|
|
|
std::cout<<" close "<<closest_waypoint<<std::endl<<" search distance: "<<STOP_SEARCH_DISTANCE<<std::endl;
|
|
|
// start search from the closest waypoint
|
|
|
- for (int i = closest_waypoint; i < closest_waypoint + STOP_SEARCH_DISTANCE; i++)
|
|
|
+ //for (int i = closest_waypoint; i < closest_waypoint + STOP_SEARCH_DISTANCE; i++)
|
|
|
+ for (int i = closest_waypoint; i < closest_waypoint + 300; i++)
|
|
|
{
|
|
|
+ std::cout<<" i : "<<i<<std::endl;
|
|
|
// reach the end of waypoints
|
|
|
if (i >= static_cast<int>(lane.waypoints.size()))
|
|
|
break;
|
|
@@ -267,6 +269,7 @@ int detectStopObstacle(const pcl::PointCloud<pcl::PointXYZ>& points, const int c
|
|
|
stop_obstacle_waypoint = i;
|
|
|
*obstacle_type = EObstacleType::STOPLINE;
|
|
|
obstacle_points->setStopPoint(lane.waypoints.at(i).pose.pose.position); // for vizuialization
|
|
|
+ std::cout<<"breakl"<<std::endl;
|
|
|
break;
|
|
|
}
|
|
|
|
|
@@ -287,6 +290,7 @@ int detectStopObstacle(const pcl::PointCloud<pcl::PointXYZ>& points, const int c
|
|
|
tf::Vector3 tf_waypoint = point2vector(waypoint);
|
|
|
tf_waypoint.setZ(0);
|
|
|
|
|
|
+ std::cout<<" stop range "<<stop_range<<std::endl;
|
|
|
int stop_point_count = 0;
|
|
|
for (const auto& p : points)
|
|
|
{
|
|
@@ -309,6 +313,7 @@ int detectStopObstacle(const pcl::PointCloud<pcl::PointXYZ>& points, const int c
|
|
|
if (stop_point_count > points_threshold)
|
|
|
{
|
|
|
stop_obstacle_waypoint = i;
|
|
|
+ std::cout<<" obstacle on waypoints."<<std::endl;
|
|
|
*obstacle_type = EObstacleType::ON_WAYPOINTS;
|
|
|
break;
|
|
|
}
|
|
@@ -328,6 +333,7 @@ int detectDecelerateObstacle(const pcl::PointCloud<pcl::PointXYZ>& points, const
|
|
|
{
|
|
|
int decelerate_obstacle_waypoint = -1;
|
|
|
// start search from the closest waypoint
|
|
|
+ std::cout<<" close point index : "<<closest_waypoint<<" decdis: "<<DECELERATION_SEARCH_DISTANCE<<std::endl;
|
|
|
for (int i = closest_waypoint; i < closest_waypoint + DECELERATION_SEARCH_DISTANCE; i++)
|
|
|
{
|
|
|
// reach the end of waypoints
|
|
@@ -377,11 +383,13 @@ EControl pointsDetection(const pcl::PointCloud<pcl::PointXYZ>& points, const int
|
|
|
const autoware_msgs::Lane& lane, const CrossWalk& crosswalk, const VelocitySetInfo& vs_info,
|
|
|
int* obstacle_waypoint, ObstaclePoints* obstacle_points)
|
|
|
{
|
|
|
- std::cout<<"points callback "<<std::endl;
|
|
|
+// std::cout<<"points callback size "<<points.size()<<std::endl;
|
|
|
// no input for detection || no closest waypoint
|
|
|
if ((points.empty() == true && vs_info.getDetectionResultByOtherNodes() == -1) || closest_waypoint < 0)
|
|
|
return EControl::KEEP;
|
|
|
|
|
|
+ std::cout<<"detect stop"<<std::endl;
|
|
|
+
|
|
|
|
|
|
EObstacleType obstacle_type = EObstacleType::NONE;
|
|
|
int stop_obstacle_waypoint =
|
|
@@ -389,8 +397,9 @@ EControl pointsDetection(const pcl::PointCloud<pcl::PointXYZ>& points, const int
|
|
|
vs_info.getPointsThreshold(), vs_info.getLocalizerPose(),
|
|
|
obstacle_points, &obstacle_type, vs_info.getDetectionResultByOtherNodes());
|
|
|
|
|
|
+ std::cout<<" stop waypoint "<<stop_obstacle_waypoint<<std::endl;
|
|
|
// skip searching deceleration range
|
|
|
- if (vs_info.getDecelerationRange() < 0.01)
|
|
|
+ if (vs_info.getDecelerationRange() < 0.01)
|
|
|
{
|
|
|
*obstacle_waypoint = stop_obstacle_waypoint;
|
|
|
if (stop_obstacle_waypoint < 0)
|
|
@@ -408,6 +417,7 @@ EControl pointsDetection(const pcl::PointCloud<pcl::PointXYZ>& points, const int
|
|
|
vs_info.getPointsThreshold(), vs_info.getLocalizerPose(), obstacle_points);
|
|
|
|
|
|
// stop obstacle was not found
|
|
|
+ //std::cout<<" dec : "<<decelerate_obstacle_waypoint<<std::endl;
|
|
|
if (stop_obstacle_waypoint < 0)
|
|
|
{
|
|
|
*obstacle_waypoint = decelerate_obstacle_waypoint;
|
|
@@ -420,7 +430,8 @@ EControl pointsDetection(const pcl::PointCloud<pcl::PointXYZ>& points, const int
|
|
|
*obstacle_waypoint = stop_obstacle_waypoint;
|
|
|
return EControl::STOP;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
// about 5.0 meter
|
|
|
double waypoint_interval =
|
|
|
getPlaneDistance(lane.waypoints[0].pose.pose.position, lane.waypoints[1].pose.pose.position);
|
|
@@ -453,6 +464,13 @@ EControl obstacleDetection(int closest_waypoint, const autoware_msgs::Lane& lane
|
|
|
static EControl prev_detection = EControl::KEEP;
|
|
|
static int prev_obstacle_waypoint = -1;
|
|
|
|
|
|
+
|
|
|
+ if (detection_result == EControl::STOP)
|
|
|
+ {
|
|
|
+ std::cout<<"STOP STOP STOP"<<std::endl;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
// stop or decelerate because we found obstacles
|
|
|
if (detection_result == EControl::STOP || detection_result == EControl::STOPLINE || detection_result == EControl::DECELERATE)
|
|
|
{
|
|
@@ -478,6 +496,7 @@ EControl obstacleDetection(int closest_waypoint, const autoware_msgs::Lane& lane
|
|
|
|
|
|
// there are no obstacles, so we move forward
|
|
|
*obstacle_waypoint = -1;
|
|
|
+ //std::cout<<" ob point "<<*obstacle_waypoint <<std::endl;
|
|
|
false_count = 0;
|
|
|
prev_detection = EControl::KEEP;
|
|
|
return detection_result;
|
|
@@ -488,6 +507,7 @@ void changeWaypoints(const VelocitySetInfo& vs_info, const EControl& detection_r
|
|
|
{
|
|
|
if (detection_result == EControl::STOP || detection_result == EControl::STOPLINE)
|
|
|
{ // STOP for obstacle/stopline
|
|
|
+ std::cout<<"enter stop change . "<<std::endl;
|
|
|
// stop_waypoint is about stop_distance meter away from obstacles/stoplines
|
|
|
int stop_distance = (detection_result == EControl::STOP)
|
|
|
? vs_info.getStopDistanceObstacle() : vs_info.getStopDistanceStopline();
|
|
@@ -495,6 +515,7 @@ void changeWaypoints(const VelocitySetInfo& vs_info, const EControl& detection_r
|
|
|
? vs_info.getDecelerationObstacle() : vs_info.getDecelerationStopline();
|
|
|
int stop_waypoint =
|
|
|
calcWaypointIndexReverse(vs_path->getPrevWaypoints(), obstacle_waypoint, stop_distance);
|
|
|
+ std::cout<<" stop distance : "<<stop_distance<<" deceleration: "<<deceleration<<" stopwaypoint: "<<stop_waypoint<<std::endl;
|
|
|
// change waypoints to stop by the stop_waypoint
|
|
|
vs_path->changeWaypointsForStopping(stop_waypoint, obstacle_waypoint, closest_waypoint, deceleration);
|
|
|
vs_path->avoidSuddenAcceleration(deceleration, closest_waypoint);
|