Browse Source

modify controller ang&sightseeing

zhangjia 2 years ago
parent
commit
d915cb98d6

+ 6 - 3
src/controller/controller_rubshCar/control/control_status.cpp

@@ -4,10 +4,13 @@
 
 void iv::control::ControlStatus::set_wheel_angle(float angle)
 {
+    int16_t ang =(int16_t)angle;
+    ServiceControlStatus.cmd_steer.bit.steering_pos_req_H = (ang >>8) & 0x00FF;
+    ServiceControlStatus.cmd_steer.bit.steering_pos_req_L = ang & 0x00FF;
 
-    int ang =angle;
-    ServiceControlStatus.cmd_steer.bit.steering_pos_req_H = (ang)  /256;
-    ServiceControlStatus.cmd_steer.bit.steering_pos_req_L = (ang)  % 256;
+    std::cout<<"ang="<<ang<<std::endl;
+    std::cout<<"ByteHigh="<<ServiceControlStatus.cmd_steer.bit.steering_pos_req_H<<std::endl;
+    std::cout<<"ByteLow="<<ServiceControlStatus.cmd_steer.bit.steering_pos_req_L<<std::endl;
 }
 
 void iv::control::ControlStatus::set_wheel_speed(float speed)

+ 3 - 2
src/decition/decition_brain_sf/decition/adc_adapter/sightseeing_adapter.cpp

@@ -201,10 +201,11 @@ iv::decition::Decition iv::decition::SightseeingAdapter::getAdapterDeciton(GPS_I
 //                        distance_to_end);
 //    }
 
-    if(distance_to_end>0.5 && distance_to_end<=10){
+    if(distance_to_end>0.3 && distance_to_end<=10){
                 dSpeed=min((double)dSpeed, 2.0);
-    }else if(distance_to_end<=0.5){
+    }else if(distance_to_end<=0.3){
                 dSpeed=0;
+                controlBrake=200;
     }
 
     if(obsDistance>5 && obsDistance<=15){