Ver código fonte

modify final brake

zhangjia 2 anos atrás
pai
commit
93ad523b1f

+ 30 - 8
src/decition/decition_brain_sf/decition/adc_adapter/sightseeing_adapter.cpp

@@ -191,17 +191,29 @@ iv::decition::Decition iv::decition::SightseeingAdapter::getAdapterDeciton(GPS_I
         }
     }
 
-
     controlBrake=0;
-    if(obsDistance>10 && obsDistance<15){
-            dSpeed=2;
-    }else if(obsDistance>5 && obsDistance<=10){
-            dSpeed=1;
+
+    float distance_to_end=DecideGps00::DistanceToEnd;
+ //   if(DecideGps00::PathPoint+1500>gpsMapLine.size())
+//    {
+//        distance_to_end=computeDistToEnd(gpsMapLine,PathPoint);
+//        givlog->debug("decition_brain","distoend: %f",
+//                        distance_to_end);
+//    }
+
+    if(distance_to_end>0.5 && distance_to_end<=10){
+                dSpeed=min((double)dSpeed, 2.0);
+    }else if(distance_to_end<=0.5){
+                dSpeed=0;
+    }
+
+    if(obsDistance>5 && obsDistance<=15){
+            dSpeed=min((double)dSpeed, 2.0);
     }else if(obsDistance>0 && obsDistance<=5){
             dSpeed=0;
     }
 
-    if((dSpeed==0)&&(realSpeed<0.2)){
+    if((dSpeed==0)&&(realSpeed<0.1)){
             final_handbrake=true;
     }else{
             final_handbrake=false;
@@ -232,8 +244,8 @@ iv::decition::Decition iv::decition::SightseeingAdapter::getAdapterDeciton(GPS_I
     (*decition)->angSpeed=600;
 
     //日志输出
-    givlog->debug("brain_decition","dSpeed: %f,realspeed: %f,brake: %f,torque: %f,accAim: %f,handBrake: %d,dangWei: %d",
-                            dSpeed,realSpeed,(*decition)->brake,(*decition)->torque,accAim,(*decition)->handBrake,(*decition)->dangWei);
+    givlog->debug("brain_decition","dSpeed: %f,realspeed: %f,brake: %f,torque: %f,accAim: %f,handBrake: %d,dangWei: %d,distance_to_end: %f",
+                            dSpeed,realSpeed,(*decition)->brake,(*decition)->torque,accAim,(*decition)->handBrake,(*decition)->dangWei,distance_to_end);
 
     //垃圾车,控制输出,其它
     (*decition)->grade=1;
@@ -304,4 +316,14 @@ float iv::decition::SightseeingAdapter::limitSpeed(float realSpeed, float contro
     return controlSpeed;
 }
 
+double iv::decition::SightseeingAdapter::computeDistToEnd(const std::vector<GPSData> gpsMapLine,int pathpoint){
+    double dist_to_end=0;
+    for(int i=pathpoint;i<gpsMapLine.size()-1;i++){
+        if(gpsMapLine[i]->mode2!=23)
+            dist_to_end+=GetDistance(*gpsMapLine[i+1], *gpsMapLine[i]);
+    }
+    return dist_to_end;
+}
+
+
 

+ 1 - 1
src/decition/decition_brain_sf/decition/adc_adapter/sightseeing_adapter.h

@@ -30,7 +30,7 @@ namespace iv {
 
                         float limitBrake(float realSpeed, float controlBrake,float dSpeed,float obsDistance , float ttc);
                         float limitSpeed(float realSpeed, float controlBrake,float dSpeed,float controlSpeed );
-
+                        double computeDistToEnd(const std::vector<GPSData> gpsMapLine,int pathpoint);
                     private:
                         int seizingCount=0;
 

+ 5 - 2
src/decition/decition_brain_sf/decition/decide_gps_00.cpp

@@ -36,6 +36,7 @@ iv::decition::DecideGps00::~DecideGps00() {
 float iv::decition::DecideGps00::xiuzhengCs=0;
 
 int iv::decition::DecideGps00::PathPoint = -1;
+double iv::decition::DecideGps00::DistanceToEnd = 1000;
 double iv::decition::DecideGps00::minDis = iv::MaxValue;
 double iv::decition::DecideGps00::maxAngle = iv::MinValue;
 //int iv::decition::DecideGps00::lastGpsIndex = iv::MaxValue;
@@ -1061,13 +1062,15 @@ iv::decition::Decition iv::decition::DecideGps00::getDecideFromGPS(GPS_INS now_g
 //                }
                 if(!circleMode){
                         double forecast_final=secSpeed*secSpeed+5;
-                        int forecast_final_point=((int)forecast_final)*10+1500;
+                        int forecast_final_point=((int)forecast_final)*10+1500;  //1500
                         static int BrakePoint=-1;
                         static bool final_brake=false;
-                        static double distance_to_end=1000;
+                        static double distance_to_end=1000;      //1000
+                        DistanceToEnd=1000;
                         if(PathPoint+forecast_final_point>gpsMapLine.size())
                         {                           
                             distance_to_end=computeDistToEnd(gpsMapLine,PathPoint);
+                            DistanceToEnd=distance_to_end;
                             givlog->debug("decition_brain","distoend: %f",
                                             distance_to_end);
                             if((forecast_final>=distance_to_end)&&(realspeed>3)){

+ 1 - 0
src/decition/decition_brain_sf/decition/decide_gps_00.h

@@ -117,6 +117,7 @@ public:
     int chaocheCounts=0;
 
     static int PathPoint;
+    static double DistanceToEnd;
     float lastGroupOffsetX=0.0;
 
     GPS_INS traffic_light_gps;