[6.6.0] union the chassis state in one caller
This commit is contained in:
@@ -1,37 +0,0 @@
|
||||
package com.mogo.eagle.core.function.call.autopilot
|
||||
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotVehicleStateListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
import planning.RoboSweeperTaskIndexOuterClass
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
/**
|
||||
* 车辆底盘数据 回调监听
|
||||
*/
|
||||
object CallerAutopilotVehicleStateListenerManager : CallerBase<IMoGoAutopilotVehicleStateListener>() {
|
||||
|
||||
@Volatile
|
||||
private var timeStamp: Long = 0L
|
||||
|
||||
/**
|
||||
* 工控机时间回调
|
||||
*/
|
||||
fun invokeAutopilotTime(time: Long) {
|
||||
this.timeStamp = time
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取工控机的时间, 单位是秒
|
||||
*/
|
||||
fun getAutopilotTimeStamp(): Long {
|
||||
return this.timeStamp
|
||||
}
|
||||
|
||||
fun invokeAutopilotDataException(timestamp: Long) {
|
||||
M_LISTENERS.forEach{
|
||||
val listener = it.value
|
||||
listener.onAutopilotDataException(timestamp)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.mogo.eagle.core.function.call.autopilot
|
||||
|
||||
import chassis.ChassisStatesOuterClass
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoBatteryManagementSystemListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
|
||||
/**
|
||||
* 电池管理系统 包含 电量剩余百分比 电压 电流等
|
||||
*/
|
||||
object CallerBatteryManagementSystemListenerManager : CallerBase<IMoGoBatteryManagementSystemListener>() {
|
||||
|
||||
/**
|
||||
* 电池管理系统
|
||||
*/
|
||||
fun invokeBatteryManagementSystemStates(states: ChassisStatesOuterClass.BMSSystemStates) {
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.onBatteryManagementSystemStates(states)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.mogo.eagle.core.function.call.autopilot
|
||||
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisAccStateListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
|
||||
/**
|
||||
* 车辆加速度 回调监听
|
||||
*/
|
||||
object CallerChassisAccStateListenerManager : CallerBase<IMoGoChassisAccStateListener>() {
|
||||
|
||||
/**
|
||||
* 车辆加速度
|
||||
* acc 加速度
|
||||
*/
|
||||
fun invokeAutopilotAcc(carAcc: Float) {
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.onAutopilotAcc(carAcc)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.mogo.eagle.core.function.call.autopilot
|
||||
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisBrakeStateListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
|
||||
/**
|
||||
* 车辆刹车 回调监听
|
||||
*/
|
||||
object CallerChassisBrakeStateListenerManager : CallerBase<IMoGoChassisBrakeStateListener>() {
|
||||
|
||||
/**
|
||||
* brake 刹车
|
||||
*/
|
||||
fun invokeAutopilotBrake(brake: Float){
|
||||
M_LISTENERS.forEach{
|
||||
val listener = it.value
|
||||
listener.onAutopilotBrake(brake)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.mogo.eagle.core.function.call.autopilot
|
||||
|
||||
import chassis.Chassis
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisGearStateListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
|
||||
/**
|
||||
* 车辆挂档档位 回调监听
|
||||
*/
|
||||
object CallerChassisGearStateListenerManager : CallerBase<IMoGoChassisGearStateListener>() {
|
||||
|
||||
/**
|
||||
* 车辆挂档档位
|
||||
* @param gear 档位
|
||||
*/
|
||||
fun invokeAutopilotGearData(gear: Chassis.GearPosition) {
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.onAutopilotGearData(gear)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
package com.mogo.eagle.core.function.call.autopilot
|
||||
|
||||
import chassis.Chassis
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLamplightListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
|
||||
/**
|
||||
* 车辆底盘灯光数据 回调监听
|
||||
*/
|
||||
object CallerChassisLamplightListenerManager : CallerBase<IMoGoChassisLamplightListener>() {
|
||||
|
||||
/**
|
||||
* 车辆转向灯数据回调
|
||||
* @param lightSwitch
|
||||
*/
|
||||
fun invokeAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch) {
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.onAutopilotLightSwitchData(lightSwitch)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆刹车灯数据回调
|
||||
* @param brakeLight
|
||||
*/
|
||||
fun invokeAutopilotBrakeLightData(brakeLight: Boolean) {
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.onAutopilotBrakeLightData(brakeLight)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
package com.mogo.eagle.core.function.call.autopilot
|
||||
|
||||
import chassis.Chassis
|
||||
import chassis.ChassisStatesOuterClass
|
||||
import chassis.VehicleStateOuterClass
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisStatesListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
object CallerChassisStatesListenerManager: CallerBase<IMoGoChassisStatesListener>() {
|
||||
|
||||
fun invokeStates(vehicleState: VehicleStateOuterClass.VehicleState){
|
||||
//刹车灯数据
|
||||
invokeAutopilotBrakeLightData(vehicleState.brakeLightStatus)
|
||||
//方向盘转向角数据
|
||||
invokeAutopilotSteeringData(vehicleState.steering)
|
||||
//挂档档位数据
|
||||
invokeAutopilotGearData(vehicleState.gear)
|
||||
//加速度
|
||||
invokeAutopilotAcc(vehicleState.accel)
|
||||
//油门
|
||||
invokeAutopilotThrottle(vehicleState.throttle)
|
||||
//刹车
|
||||
invokeAutopilotBrake(vehicleState.brake)
|
||||
//电量
|
||||
if (vehicleState.hasBmsSoc()) {
|
||||
invokeBatteryManagementSystemStates(
|
||||
ChassisStatesOuterClass.BMSSystemStates.newBuilder()
|
||||
.setBmsSoc(vehicleState.bmsSoc).build()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun invokeNewStates(chassisStates: ChassisStatesOuterClass.ChassisStates){
|
||||
//刹车灯数据
|
||||
chassisStates.bcmSystemStates?.let { bcmSystemStates ->
|
||||
invokeAutopilotBrakeLightData(bcmSystemStates.brakeLightState != 0)
|
||||
}
|
||||
//方向盘转向角数据
|
||||
chassisStates.steerSystemStates?.let {
|
||||
invokeAutopilotSteeringData(it.steeringWheelAngle)
|
||||
}
|
||||
//挂档档位数据
|
||||
chassisStates.gearSystemStates?.let { gearSystemStates ->
|
||||
gearSystemStates.gearPosition?.let {
|
||||
//挂档档位数据
|
||||
invokeAutopilotGearData(it)
|
||||
}
|
||||
}
|
||||
//加速度
|
||||
chassisStates.vehicleMotionStates?.let {
|
||||
//加速度
|
||||
invokeAutopilotAcc(it.acceleration)
|
||||
}
|
||||
//油门
|
||||
chassisStates.drivingSystemStates?.let {
|
||||
invokeAutopilotThrottle(it.throttleResponsePosition)
|
||||
}
|
||||
//刹车
|
||||
chassisStates.brakeSystemStates?.let {
|
||||
//刹车
|
||||
invokeAutopilotBrake(it.brakePedalResponsePosition)
|
||||
}
|
||||
//电量
|
||||
chassisStates.bmsSystemStates?.let {
|
||||
//电量
|
||||
invokeBatteryManagementSystemStates(it)
|
||||
}
|
||||
}
|
||||
|
||||
private var steering: Float? by Delegates.observable(0.0f) { _, oldValue, newValue ->
|
||||
if (newValue == null) {
|
||||
return@observable
|
||||
}
|
||||
if (oldValue == newValue) {
|
||||
return@observable
|
||||
}
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.onAutopilotSteeringData(newValue)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆转向灯数据回调
|
||||
* @param lightSwitch
|
||||
*/
|
||||
fun invokeAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch) {
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.onAutopilotLightSwitchData(lightSwitch)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆刹车灯数据回调
|
||||
* @param brakeLight
|
||||
*/
|
||||
private fun invokeAutopilotBrakeLightData(brakeLight: Boolean) {
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.onAutopilotBrakeLightData(brakeLight)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆方向盘转向角回调
|
||||
* @param steering 方向盘转向角
|
||||
*/
|
||||
private fun invokeAutopilotSteeringData(steering: Float) {
|
||||
this.steering = steering
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆挂档档位
|
||||
* @param gear 档位
|
||||
*/
|
||||
fun invokeAutopilotGearData(gear: Chassis.GearPosition) {
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.onAutopilotGearData(gear)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆加速度
|
||||
* acc 加速度
|
||||
*/
|
||||
private fun invokeAutopilotAcc(carAcc: Float) {
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.onAutopilotAcc(carAcc)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* throttle 油门
|
||||
*/
|
||||
fun invokeAutopilotThrottle(throttle: Float) {
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.onAutopilotThrottle(throttle)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* brake 刹车
|
||||
*/
|
||||
fun invokeAutopilotBrake(brake: Float){
|
||||
M_LISTENERS.forEach{
|
||||
val listener = it.value
|
||||
listener.onAutopilotBrake(brake)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 电池管理系统
|
||||
*/
|
||||
private fun invokeBatteryManagementSystemStates(states: ChassisStatesOuterClass.BMSSystemStates) {
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.onBatteryManagementSystemStates(states)
|
||||
}
|
||||
}
|
||||
|
||||
fun invokeStatesDataException(timestamp: Long) {
|
||||
M_LISTENERS.forEach{
|
||||
val listener = it.value
|
||||
listener.onAutopilotDataException(timestamp)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package com.mogo.eagle.core.function.call.autopilot
|
||||
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisSteeringStateListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
/**
|
||||
* 车辆方向盘转向角 回调监听
|
||||
*/
|
||||
object CallerChassisSteeringStateListenerManager : CallerBase<IMoGoChassisSteeringStateListener>() {
|
||||
|
||||
private var steering: Float? by Delegates.observable(0.0f) { _, oldValue, newValue ->
|
||||
if (newValue == null) {
|
||||
return@observable
|
||||
}
|
||||
if (oldValue == newValue) {
|
||||
return@observable
|
||||
}
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.onAutopilotSteeringData(newValue)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆方向盘转向角回调
|
||||
* @param steering 方向盘转向角
|
||||
*/
|
||||
fun invokeAutopilotSteeringData(steering: Float) {
|
||||
this.steering = steering
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.mogo.eagle.core.function.call.autopilot
|
||||
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisThrottleStateListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
|
||||
/**
|
||||
* throttle 油门 回调监听
|
||||
*/
|
||||
object CallerChassisThrottleStateListenerManager : CallerBase<IMoGoChassisThrottleStateListener>() {
|
||||
|
||||
/**
|
||||
* throttle 油门
|
||||
*/
|
||||
fun invokeAutopilotThrottle(throttle: Float) {
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.onAutopilotThrottle(throttle)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -37,16 +37,8 @@ CallerAutopilotPointCloudListenerManager
|
||||
CallerAutopilotRecordListenerManager
|
||||
CallerAutopilotStatisticsListenerManager
|
||||
CallerAutoPilotStatusListenerManager
|
||||
CallerAutopilotVehicleStateListenerManager
|
||||
CallerBatteryManagementSystemListenerManager
|
||||
CallerChassisAccStateListenerManager
|
||||
CallerChassisBrakeStateListenerManager
|
||||
CallerChassisGearStateListenerManager
|
||||
CallerChassisLamplightListenerManager
|
||||
CallerChassisLocationGCJ20ListenerManager
|
||||
CallerChassisLocationWGS84ListenerManager
|
||||
CallerChassisSteeringStateListenerManager
|
||||
CallerChassisThrottleStateListenerManager
|
||||
CallerPlanningActionsListenerManager
|
||||
CallerPlanningRottingListenerManager
|
||||
CallerPlanningTrajectoryListenerManager
|
||||
|
||||
Reference in New Issue
Block a user