油门刹车数据获取供bus使用

This commit is contained in:
liujing
2022-07-27 11:47:02 +08:00
parent bfe95019a4
commit 6717ca1c33
4 changed files with 43 additions and 1 deletions

View File

@@ -118,7 +118,7 @@ public class MoGoHandAdasMsgManager implements
if (!AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) { //小巴不展示
if (gnssInfo != null) {
//设置刹车信息
if (gnssInfo.getAcceleration() < SharedPrefsMgr.getInstance(mContext).getFloat(MoGoConfig.BRAKE_ACCELERATION_THRESHOLD,-2.5F)) {
if (gnssInfo.getAcceleration() < SharedPrefsMgr.getInstance(mContext).getFloat(MoGoConfig.BRAKE_ACCELERATION_THRESHOLD, -2.5F)) {
brakeLight = 1;
} else {
brakeLight = 0;
@@ -132,6 +132,7 @@ public class MoGoHandAdasMsgManager implements
/**
* 车辆方向盘转向角回调
*
* @param steering 方向盘转向角
*/
@Override
@@ -141,6 +142,7 @@ public class MoGoHandAdasMsgManager implements
/**
* 车辆挂挡档位
*
* @param gear 档位
*/
@Override

View File

@@ -141,6 +141,16 @@ public class TrafficDataView extends ConstraintLayout {
String accStr = myformat.format(carAcc);
accTextView.setText("a: " + accStr);
}
@Override
public void onAutopilotBrake(float brake) {
Log.d(TAG, "刹车:" + String.valueOf(brake));
}
@Override
public void onAutopilotThrottle(float throttle) {
Log.d(TAG, "油门:" + String.valueOf(throttle));
}
};
/**

View File

@@ -42,4 +42,14 @@ interface IMoGoAutopilotVehicleStateListener {
* 车辆加速度
*/
fun onAutopilotAcc(carAcc: Float)
/**
* 油门
*/
fun onAutopilotThrottle(throttle: Float)
/**
* 刹车
*/
fun onAutopilotBrake(brake: Float)
}

View File

@@ -112,6 +112,26 @@ object CallerAutopilotVehicleStateListenerManager : CallerBase() {
}
}
/**
* throttle 油门
*/
fun invokeAutopilotThrottle(throttle: Float){
M_AUTOPILOT_VEHICLE_LISTENERS.forEach{
val listener = it.value
listener.onAutopilotThrottle(throttle)
}
}
/**
* brake 刹车
*/
fun invokeAutopilotBrake(brake: Float){
M_AUTOPILOT_VEHICLE_LISTENERS.forEach{
val listener = it.value
listener.onAutopilotBrake(brake)
}
}
/**
* 工控机时间回调