Browse Source

modify rubbish car controller

zhangjia 3 years ago
parent
commit
1433c26540
1 changed files with 8 additions and 8 deletions
  1. 8 8
      src/controller/controller_rubshCar/control/control_status.cpp

+ 8 - 8
src/controller/controller_rubshCar/control/control_status.cpp

@@ -5,7 +5,7 @@
 void iv::control::ControlStatus::set_wheel_angle(float angle)
 {
 
-    int ang =(angle+870)*10;
+    int ang =angle;
     ServiceControlStatus.cmd_steer.bit.steering_pos_req_H = (ang)  /256;
     ServiceControlStatus.cmd_steer.bit.steering_pos_req_L = (ang)  % 256;
 }
@@ -13,7 +13,7 @@ void iv::control::ControlStatus::set_wheel_angle(float angle)
 void iv::control::ControlStatus::set_wheel_speed(float speed)
 {
 
-    int angSpeed =speed;
+    int angSpeed =speed/6;
     ServiceControlStatus.cmd_steer.bit.steering_val_req = angSpeed;
 }
 
@@ -29,14 +29,14 @@ void iv::control::ControlStatus::set_wheel_enable(bool enable)
 
 void iv::control::ControlStatus::set_torque(float troque)
 {
-    ServiceControlStatus.cmd_drive.bit.driver_tq_reqH=(unsigned)((int)troque*100/256);
-    ServiceControlStatus.cmd_drive.bit.driver_tq_reqL=(unsigned)((int)troque*100%256);
+    ServiceControlStatus.cmd_drive.bit.driver_tq_reqH=(unsigned)((int)troque*180/256);
+    ServiceControlStatus.cmd_drive.bit.driver_tq_reqL=(unsigned)((int)troque*180%256);
 }
 
 void iv::control::ControlStatus::set_brake(float brake)
 {
-    ServiceControlStatus.cmd_brake.bit.brake_tq_reqH=(unsigned)((int)brake*100/255);
-    ServiceControlStatus.cmd_brake.bit.brake_tq_reqL=(unsigned)((int)brake*100%255);
+    ServiceControlStatus.cmd_brake.bit.brake_tq_reqH=(unsigned)((int)brake/255);
+    ServiceControlStatus.cmd_brake.bit.brake_tq_reqL=(unsigned)((int)brake%255);
 }
 void iv::control::ControlStatus::set_brake_en(bool enable)
 {
@@ -62,9 +62,9 @@ void iv::control::ControlStatus::set_handBrake(bool handbrake)
 void iv::control::ControlStatus::set_handBrake_en(bool handbrake)
 {
     if(handbrake){
-        cmd_park.bit.park_enb = 2;
-    }else{
         cmd_park.bit.park_enb = 1;
+    }else{
+        cmd_park.bit.park_enb = 0;
     }
 }