Browse Source

change fromautoware.

yuchuli 1 year ago
parent
commit
6c2544ea7c
1 changed files with 12 additions and 0 deletions
  1. 12 0
      src/decition/decition_fromautoware/ctrlcmd2decition.cpp

+ 12 - 0
src/decition/decition_fromautoware/ctrlcmd2decition.cpp

@@ -106,8 +106,20 @@ void ctrlcmd2decition::ListenCtrlCmd(const char *strdata, const unsigned int nSi
     {
         mpLT->GetTorqueBrake(xctrlcmd.linear_velocity()*3.6,facc,ftorque,fbrake);
     }
+    else
+    {
+        double fVehWeight = 1800;
+        double fg = 9.8;
+        double fRollForce = 50;
+        const double fRatio = 2.5;
+        double fNeed = fRollForce + fVehWeight*facc;
+
+        ftorque = fNeed/fRatio;
+    }
 //    facc = xctrlcmd.linear_acceleration();
     fwheelangle = xctrlcmd.steering_angle() * (180.0/M_PI) * 15.0;
+    if(fwheelangle>430)fwheelangle = 430;
+    if(fwheelangle<-430)fwheelangle = -430;
     std::cout<<" acc: "<<facc<<"  wheel: "<<fwheelangle<<std::endl;
     xdecition.set_accelerator(facc);
     xdecition.set_brake(fbrake);