|
@@ -78,6 +78,7 @@ void executeDecition(const iv::brain::decition decition)
|
|
|
gcontroller->control_angle_speed(decition.wheelspeed());
|
|
|
gcontroller->control_torque(decition.torque());
|
|
|
|
|
|
+
|
|
|
gcontroller->control_brake(decition.brake());
|
|
|
gcontroller->control_gear(decition.gear());
|
|
|
|
|
@@ -280,6 +281,38 @@ void sendthread()
|
|
|
gMutex.lock();
|
|
|
xdecition.CopyFrom(gdecition);
|
|
|
gMutex.unlock();
|
|
|
+
|
|
|
+#ifdef USE_SHENLANDECISION
|
|
|
+ double fbrake;
|
|
|
+ if(xdecition.brake()<0)
|
|
|
+ {
|
|
|
+ fbrake = xdecition.brake()*(-1)/0.07;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ fbrake = 0.0;
|
|
|
+ xdecition.set_brake(fbrake);
|
|
|
+
|
|
|
+ double ftorue = 0;
|
|
|
+ if(xdecition.torque()>0)
|
|
|
+ {
|
|
|
+ double fVehWeight = 1800;
|
|
|
+ double fRollForce = 50;
|
|
|
+ const double fRatio = 2.5;
|
|
|
+ double accAim = (xdecition.torque() * fRatio - fRollForce)/fVehWeight;
|
|
|
+ if(accAim>=0)
|
|
|
+ {
|
|
|
+ ftorue = accAim/0.05;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ xdecition.set_torque(ftorue);
|
|
|
+
|
|
|
+ xdecition.set_mode(1);
|
|
|
+ xdecition.set_grade(1);
|
|
|
+ xdecition.set_gear(4);
|
|
|
+ xdecition.set_engine(0);
|
|
|
+#endif
|
|
|
+
|
|
|
+
|
|
|
gnDecitionNum--;
|
|
|
}
|
|
|
executeDecition(xdecition);
|