车辆加速度监听
This commit is contained in:
@@ -151,6 +151,8 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
CallerAutopilotVehicleStateListenerManager.invokeAutopilotSteeringData(vehicleState.steering)
|
||||
//挂挡档位数据
|
||||
CallerAutopilotVehicleStateListenerManager.invokeAutopilotGearData(vehicleState.gear)
|
||||
//加速度
|
||||
CallerAutopilotVehicleStateListenerManager.invokeAutopilotAcc(vehicleState.accel)
|
||||
} else {
|
||||
CallerAutopilotVehicleStateListenerManager.invokeAutopilotDataException(header.timestamp.toLong())
|
||||
}
|
||||
|
||||
@@ -150,4 +150,9 @@ public class MoGoHandAdasMsgManager implements
|
||||
@Override
|
||||
public void onAutopilotDataException(long timestamp) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotAcc(float carAcc) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -4,15 +4,17 @@ import android.content.*
|
||||
import android.util.*
|
||||
import chassis.Chassis.GearPosition
|
||||
import chassis.Chassis.LightSwitch
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
|
||||
import com.mogo.eagle.core.function.api.autopilot.*
|
||||
import com.mogo.eagle.core.function.call.autopilot.*
|
||||
import com.mogo.eagle.core.utilcode.kotlin.*
|
||||
import com.zhjt.mogo_core_function_devatools.status.flow.IFlow
|
||||
import com.zhjt.mogo_core_function_devatools.status.entity.CanStatus
|
||||
import kotlinx.coroutines.*
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import mogo_msg.MogoReportMsg.MogoReportMessage
|
||||
|
||||
internal class CanImpl(ctx: Context): IFlow<CanStatus>(ctx), IMoGoAutopilotVehicleStateListener, IMoGoAutopilotStatusListener {
|
||||
internal class CanImpl(ctx: Context) : IFlow<CanStatus>(ctx), IMoGoAutopilotVehicleStateListener, IMoGoAutopilotStatusListener {
|
||||
|
||||
companion object {
|
||||
const val TAG = "CanImpl"
|
||||
@@ -67,13 +69,18 @@ internal class CanImpl(ctx: Context): IFlow<CanStatus>(ctx), IMoGoAutopilotVehic
|
||||
timeOutCheck()
|
||||
}
|
||||
|
||||
override fun onAutopilotAcc(carAcc: Float) {
|
||||
send(CanStatus(isCanEnabled()))
|
||||
timeOutCheck()
|
||||
}
|
||||
|
||||
|
||||
private fun timeOutCheck() {
|
||||
job?.safeCancel()
|
||||
launch(Dispatchers.Default) {
|
||||
delay(4000)
|
||||
send(CanStatus(false))
|
||||
}.also { job = it }
|
||||
}.also { job = it }
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
|
||||
@@ -1835,6 +1835,13 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆加速度
|
||||
*/
|
||||
override fun onAutopilotAcc(carAcc: Float) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
/**
|
||||
* 吐司提示
|
||||
*/
|
||||
|
||||
@@ -171,6 +171,15 @@ public class SteeringWheelView extends ConstraintLayout {
|
||||
Log.d(TAG, "刹车灯:" + String.valueOf(brakeLight));
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆加速度
|
||||
* @param carAcc
|
||||
*/
|
||||
@Override
|
||||
public void onAutopilotAcc(float carAcc) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 方向盘转向角 左+右-
|
||||
* @param steering
|
||||
|
||||
@@ -21,6 +21,8 @@ import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import chassis.Chassis;
|
||||
|
||||
/**
|
||||
@@ -66,6 +68,13 @@ public class TrafficDataView extends ConstraintLayout {
|
||||
speedTextView = findViewById(R.id.speedTextView);
|
||||
accTextView = findViewById(R.id.speedAccTextView);
|
||||
}
|
||||
//onVehicleState
|
||||
|
||||
// @Override
|
||||
// public void onVehicleState(MessagePad.Header header, VehicleStateOuterClass.VehicleState vehicleState) {
|
||||
// VehicleState base = new VehicleState(header, vehicleState, sdf);
|
||||
// DataDistribution.getInstance().addData(base);
|
||||
// }
|
||||
|
||||
private final IMoGoAutopilotVehicleStateListener mIMoGoAutopilotVehicleStateListener = new IMoGoAutopilotVehicleStateListener() {
|
||||
/**
|
||||
@@ -128,6 +137,13 @@ public class TrafficDataView extends ConstraintLayout {
|
||||
public void onAutopilotDataException(long timestamp) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotAcc(float carAcc) {
|
||||
Log.d(TAG, "加速度:" + carAcc);
|
||||
BigDecimal acc = new BigDecimal(String.valueOf(carAcc)).setScale(2);
|
||||
accTextView.setText(String.valueOf(acc));
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user