Ver código fonte

laneline decition test after laneATT change

liyupeng 1 ano atrás
pai
commit
523552d384

+ 6 - 5
src/decition/laneline_decition_brain_sf_changan_shenlan/decition/brain.cpp

@@ -913,13 +913,14 @@ void iv::decition::BrainDecition::UpdateLineToMap(iv::GPS_INS now_gps_ins)
         }
 
         if(left_line_points.size()!=0&&right_line_points.size()!=0){
+            roadWidth = fabs(left_line_points[0].x - right_line_points[0].x);
             k = k1;
             last_k = k;
-            line_length = std::min(left_line_points.size(),right_line_points.size());
+            line_length = left_line_points.size();
             for(int j=0;j<line_length;++j){
                 iv::Point2D reference_line_point;
-                reference_line_point.x = (left_line_points[j].x+right_line_points[j].x)/2;
-                reference_line_point.y = (left_line_points[j].y+right_line_points[j].y)/2;
+                reference_line_point.x = left_line_points[j].x+roadWidth/2.0;
+                reference_line_point.y = left_line_points[j].y;
                 reference_line_points.push_back(reference_line_point);
             }
             gpsTraceFromLane = iv::decition::DecideFromLaneline::getGpsTraceFromLane(reference_line_points);
@@ -930,7 +931,7 @@ void iv::decition::BrainDecition::UpdateLineToMap(iv::GPS_INS now_gps_ins)
             line_length = left_line_points.size();
             for(int j=0;j<line_length;++j){
                 iv::Point2D reference_line_point;
-                reference_line_point.x = left_line_points[j].x+1.8;
+                reference_line_point.x = left_line_points[j].x+roadWidth/2.0;
                 reference_line_point.y = left_line_points[j].y;
                 reference_line_points.push_back(reference_line_point);
             }
@@ -942,7 +943,7 @@ void iv::decition::BrainDecition::UpdateLineToMap(iv::GPS_INS now_gps_ins)
             line_length = right_line_points.size();
             for(int j=0;j<line_length;++j){
                 iv::Point2D reference_line_point;
-                reference_line_point.x = right_line_points[j].x-1.8;
+                reference_line_point.x = right_line_points[j].x-roadWidth/2.0;
                 reference_line_point.y = right_line_points[j].y;
                 reference_line_points.push_back(reference_line_point);
             }

+ 1 - 0
src/decition/laneline_decition_brain_sf_changan_shenlan/decition/brain.h

@@ -78,6 +78,7 @@ namespace iv {
             std::vector<iv::Point2D> gpsTraceFromLane,lastGpsTraceFromLane,smoothGpsTraceFromLane;
             std::deque<std::vector<iv::Point2D>> lanePointDeque;
             double k, last_k;
+            double roadWidth = 3.6;
             int minLengthOfLaneline = 1000;
             void UpdateLineToMap(GPS_INS now_gps_ins);
 

+ 7 - 7
src/decition/laneline_decition_brain_sf_changan_shenlan/decition/decide_from_laneline.cpp

@@ -372,13 +372,13 @@ double iv::decition::DecideFromLaneline::limitAngle(double speed, double angle)
         }
     }
     if(preAngle > 400)
-    {
-        preAngle = 400;
-    }
-    if(preAngle < -400)
-    {
-        preAngle = -400;
-    }
+        {
+            preAngle = 400;
+        }
+        if(preAngle < -400)
+        {
+            preAngle = -400;
+        }
     return preAngle;
 }