Merge remote-tracking branch 'origin/dev_robotaxi-d_230809_6.0.0' into dev_robotaxi-d_230809_6.0.0

This commit is contained in:
wangmingjun
2023-08-17 21:23:14 +08:00
59 changed files with 1192 additions and 245 deletions

View File

@@ -9,7 +9,6 @@ import com.amap.api.maps.model.LatLng
import com.mogo.commons.AbsMogoApplication
import com.mogo.commons.mvp.MvpFragment
import com.mogo.eagle.core.data.config.HdMapBuildConfig
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager.getMapUIController
import com.mogo.eagle.core.function.hmi.ui.msgbox.MMsgBoxButtonView
import com.mogo.eagle.core.function.view.SiteMarkerBean
@@ -205,7 +204,6 @@ class MainFragment :
override fun initViews(savedInstanceState: Bundle?) {
super.initViews(savedInstanceState)
mapBizView.onCreate(savedInstanceState)
getMapUIController()?.setAllGesturesEnabled(false)
omvOverMap.onCreateView(savedInstanceState)
}
@@ -223,6 +221,9 @@ class MainFragment :
super.onResume()
mapBizView.onResume()
omvOverMap.onResume()
UiThreadHandler.postDelayed({
getMapUIController()?.setAllGesturesEnabled(false)
},200)
}
override fun onSaveInstanceState(outState: Bundle) {

View File

@@ -0,0 +1,175 @@
package com.mogo.och.bus.passenger.ui.lockview
import android.content.Context
import android.os.Handler
import android.os.Looper
import android.os.Message
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.MotionEvent
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.och.bus.passenger.R
import com.mogo.och.taxi.passenger.widget.animutils.AnimationsContainer
import kotlinx.android.synthetic.main.m1_devices_lock_unlock.view.aciv_screen_lock
import kotlinx.android.synthetic.main.m1_devices_lock_unlock.view.aciv_screen_lock_bg
import kotlinx.android.synthetic.main.m1_devices_lock_unlock.view.aciv_screen_unlock_ani
class LockAndUnlockView : ConstraintLayout, LockManager.LockStatusCallback {
constructor(context: Context) : super(context)
constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet)
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super(
context,
attributeSet,
defStyleAttr
)
val TAG = "UnLockView"
private var animations: AnimationsContainer? = null
private var downType: DownType = DownType.NONE
private var handler: Handler?=null
private fun initView() {
LayoutInflater.from(context).inflate(R.layout.m1_devices_lock_unlock, this, true)
handler = object : Handler(Looper.myLooper()!!) {
override fun handleMessage(msg: Message) {
super.handleMessage(msg)
when (msg.what) {
2 -> {// 解锁
LockManager.setLock(LockManager.LockStatus.UNLOCK)
animations?.stop()
}
else -> {}
}
}
}
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
LockManager.setAutoStatusCallback(TAG, this)
aciv_screen_unlock_ani?.let {
animations = AnimationsContainer(R.array.openlock, 24, it)
animations!!.setOnAnimStopListener(object :
AnimationsContainer.OnAnimationStoppedListener {
override fun AnimationStopped() {
it.setImageDrawable(null)
}
})
}
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
LockManager.setAutoStatusCallback(TAG, null)
}
override fun onTouchEvent(event: MotionEvent?): Boolean {
when (event?.action) {
MotionEvent.ACTION_DOWN -> {
if (LockManager.getLockStatus()==LockManager.LockStatus.LOCKED) {
downType = DownType.LOCK
LockManager.setLock(LockManager.LockStatus.UNLOCKING)
handler?.sendEmptyMessageDelayed(2,1_000)
} else {
downType = DownType.UNLOCK
}
CallerLogger.d(TAG, "ACTION_DOWN")
}
MotionEvent.ACTION_MOVE -> {}
MotionEvent.ACTION_UP -> {
if (downType == DownType.LOCK) {
handler?.let {
if (it.hasMessages(2)) {
it.removeMessages(2)
LockManager.setLock(LockManager.LockStatus.LOCKED)
}
}
} else {
if (LockManager.getLockStatus()==LockManager.LockStatus.UNLOCK) {
CallerLogger.d(TAG, "onClick")
LockManager.setLock(LockManager.LockStatus.LOCKED)
}
}
CallerLogger.d(TAG, "ACTION_UP")
}
MotionEvent.ACTION_CANCEL -> {
handler?.let {
if (it.hasMessages(2)) {
it.removeMessages(2)
LockManager.setLock(LockManager.LockStatus.LOCKED)
}
}
CallerLogger.d(TAG, "ACTION_CANCEL")
}
else -> {}
}
return true
}
enum class DownType {
NONE, LOCK, UNLOCK
}
override fun lockStatusChange(isLock: LockManager.LockStatus) {
setImageStatus(LockManager.getStatusViewVisable(),isLock)
}
override fun statusViewvisableChange(statusView: Int) {
setImageStatus(statusView,LockManager.getLockStatus())
}
private fun setImageStatus(statusView: Int,lockStatus: LockManager.LockStatus){
when (statusView) {
View.GONE -> {
when (lockStatus) {
LockManager.LockStatus.LOCKED -> {
aciv_screen_lock.setImageResource(R.drawable.charter_p_lock_normal)
}
LockManager.LockStatus.UNLOCK -> {
aciv_screen_lock.setImageResource(R.drawable.charter_p_unlock)
}
}
aciv_screen_lock_bg?.setImageResource(R.drawable.charger_p_normal)
}
View.VISIBLE -> {
when (lockStatus) {
LockManager.LockStatus.LOCKED -> {
aciv_screen_lock.setImageResource(R.drawable.charter_p_lock)
aciv_screen_lock_bg?.setImageResource(R.drawable.charter_p_lock_bg)
animations?.stop()
}
LockManager.LockStatus.UNLOCKING -> {
aciv_screen_lock.setImageResource(R.drawable.charter_p_lock)
aciv_screen_lock_bg?.setImageDrawable(null)
animations?.reStart()
}
LockManager.LockStatus.UNLOCK -> {
aciv_screen_lock.setImageResource(R.drawable.charter_p_unlock)
aciv_screen_lock_bg?.setImageResource(R.drawable.charger_p_normal)
animations?.stop()
}
}
}
else -> {}
}
}
init {
try {
initView()
} catch (e: Exception) {
e.printStackTrace()
}
}
}

View File

@@ -3,6 +3,7 @@ package com.mogo.och.bus.passenger.ui.lockview
import android.os.Handler
import android.os.HandlerThread
import android.os.Message
import android.view.View
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import java.util.concurrent.ConcurrentHashMap
@@ -10,7 +11,10 @@ import java.util.concurrent.ConcurrentHashMap
object LockManager {
@Volatile
private var isLock:Boolean = false
private var lockStatus:LockStatus = LockStatus.UNLOCK
private var statusView:Int = View.GONE
private var handler:Handler?=null
private const val TAG = "LockManager"
@@ -24,7 +28,7 @@ object LockManager {
override fun handleMessage(msg: Message) {
super.handleMessage(msg)
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "2分钟没有触摸屏幕导致锁屏")
setLock(true)
setLock(LockStatus.LOCKED)
}
}
reStartCountDown()
@@ -46,26 +50,48 @@ object LockManager {
fun reStartCountDown(){
CallerLogger.d(TAG,"重置时间")
handler?.removeMessages(1)
handler?.sendEmptyMessageDelayed(1,120_000)
}
@Synchronized
fun isLocak():Boolean{
CallerLogger.d(TAG,"锁定状态:${isLock}")
return isLock
fun getLockStatus():LockStatus{
CallerLogger.d(TAG,"锁定状态:${lockStatus}")
return lockStatus
}
@Synchronized
fun setLock(isLock: Boolean){
if(this.isLock!=isLock){
this.isLock = isLock
fun setLock(isLock: LockStatus){
if(this.lockStatus!=isLock){
this.lockStatus = isLock
mLockChnageListener.forEach {
it.value.lockStatusChange(this.isLock)
it.value.lockStatusChange(this.lockStatus)
}
}
}
fun getStatusViewVisable():Int{
return statusView
}
fun setStatusView(visable:Int){
if(this.statusView!=visable){
this.statusView = visable
mLockChnageListener.forEach {
it.value.statusViewvisableChange(this.statusView)
}
}
}
interface LockStatusCallback {
fun lockStatusChange(isLock: Boolean)
fun lockStatusChange(isLock: LockStatus)
fun statusViewvisableChange(statusView:Int){}
}
enum class LockStatus{
LOCKED,
UNLOCKING,
UNLOCK
}
}

View File

@@ -3,6 +3,8 @@ package com.mogo.och.bus.passenger.ui.lockview
import android.content.Context
import android.util.AttributeSet
import android.view.MotionEvent
import android.view.View
import androidx.appcompat.widget.AppCompatImageView
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.och.bus.passenger.R
@@ -21,7 +23,9 @@ class LockViewConstrainLayout : ConstraintLayout {
defStyleAttr
)
private var acivScreenLock:UnLockView?=null
private var acivScreenLock: AppCompatImageView?=null
private var uvOnlyUnlock:AppCompatImageView?=null
private var uv_only_unlock:UnlockView?=null
override fun onAttachedToWindow() {
super.onAttachedToWindow()
@@ -37,30 +41,35 @@ class LockViewConstrainLayout : ConstraintLayout {
if (acivScreenLock == null) {
acivScreenLock = findViewById(R.id.aciv_screen_lock)
}
if (uvOnlyUnlock == null) {
uvOnlyUnlock = findViewById(R.id.aciv_only_unlock)
}
if (uv_only_unlock == null) {
uv_only_unlock = findViewById(R.id.uv_only_unlock)
}
LockManager.reStartCountDown()
var needInterceptTouch = true
acivScreenLock?.apply {
event?.let {
val location = IntArray(2)
getLocationInWindow(location)
CallerLogger.d("LockViewConstrainLayout", "${location[0]}---${location[1]}--${location[0]+width}---${location[1]+height}---${it.rawX}----${it.rawY}")
val mleft = location[0]
val mtop = location[1]
val mright = location[0]+width
val mbottom = location[1]+height
if (it.rawX > mleft && it.rawX < mright && it.rawY > mtop && it.rawY < mbottom) {
// 不拦截
needInterceptTouch = false
CallerLogger.d("LockViewConstrainLayout", "不拦截")
event?.let {
var need1 = true
uv_only_unlock?.let { parentImage->
if(parentImage.visibility!=View.GONE){
need1 = needIntercept(it,uvOnlyUnlock)
}
}
val need2 = needIntercept(it,acivScreenLock)
if(!need1||!need2){
needInterceptTouch = false
}
}
CallerLogger.d("LockViewConstrainLayout", "是否拦截 ${needInterceptTouch}")
return if(needInterceptTouch) {
if(LockManager.isLocak()){
if(LockManager.getLockStatus()==LockManager.LockStatus.LOCKED){
LockManager.setStatusView(View.VISIBLE)
uv_only_unlock?.visibility = View.VISIBLE
true
}else{
super.onInterceptTouchEvent(event)
@@ -70,5 +79,27 @@ class LockViewConstrainLayout : ConstraintLayout {
}
}
private fun needIntercept(event: MotionEvent,view: View?):Boolean {
view?.apply {
val location = IntArray(2)
getLocationInWindow(location)
CallerLogger.d(
"LockViewConstrainLayout",
"${location[0]}---${location[1]}--${location[0] + width}---${location[1] + height}---${event.rawX}----${event.rawY}"
)
val mleft = location[0]
val mtop = location[1]
val mright = location[0] + width
val mbottom = location[1] + height
if (event.rawX > mleft && event.rawX < mright && event.rawY > mtop && event.rawY < mbottom) {
CallerLogger.d("LockViewConstrainLayout", "不拦截")
// 不拦截
return false
}
}
return true
}
}

View File

@@ -1,106 +0,0 @@
package com.mogo.och.bus.passenger.ui.lockview
import android.content.Context
import android.util.AttributeSet
import android.view.MotionEvent
import android.view.ViewGroup
import android.widget.ImageView
import androidx.appcompat.widget.AppCompatImageView
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.och.bus.passenger.R
import com.mogo.och.common.module.utils.RxUtils
import com.mogo.och.taxi.passenger.widget.animutils.AnimationsContainer
import io.reactivex.disposables.Disposable
class UnLockView : AppCompatImageView, LockManager.LockStatusCallback {
constructor(context: Context) : super(context)
constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet)
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super(
context,
attributeSet,
defStyleAttr
)
val TAG = "UnLockView"
private var animations: AnimationsContainer?=null
private var aciv_screen_unlock_ani: ImageView?=null
private var unLockDelay: Disposable? = null
private var downType:DownType = DownType.NONE
override fun dispatchTouchEvent(event: MotionEvent?): Boolean {
return super.dispatchTouchEvent(event)
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
if (parent is ViewGroup) {
aciv_screen_unlock_ani = (parent as ViewGroup).findViewById(R.id.aciv_screen_unlock_ani)
aciv_screen_unlock_ani?.let {
animations = AnimationsContainer(R.array.openlock,12,it)
animations!!.setOnAnimStopListener(object :AnimationsContainer.OnAnimationStoppedListener{
override fun AnimationStopped() {
it.setImageDrawable(null)
}
})
}
}
LockManager.setAutoStatusCallback(TAG,this)
}
override fun onTouchEvent(event: MotionEvent?): Boolean {
when (event?.action) {
MotionEvent.ACTION_DOWN -> {
if(LockManager.isLocak()){
downType = DownType.LOCK
animations?.reStart()
RxUtils.disposeSubscribe(unLockDelay)
unLockDelay = RxUtils.createSubscribe {
LockManager.setLock(false)
animations?.stop()
}
}else{
downType = DownType.UNLOCK
}
CallerLogger.d(TAG,"ACTION_DOWN")
}
MotionEvent.ACTION_MOVE -> {}
MotionEvent.ACTION_UP -> {
if(downType==DownType.LOCK) {
RxUtils.disposeSubscribe(unLockDelay)
animations?.stop()
}else{
if (!LockManager.isLocak()) {
CallerLogger.d(TAG,"onClick")
LockManager.setLock(true)
}
}
CallerLogger.d(TAG,"ACTION_UP")
}
MotionEvent.ACTION_CANCEL -> {
RxUtils.disposeSubscribe(unLockDelay)
animations?.stop()
CallerLogger.d(TAG,"ACTION_CANCEL")
}
else -> {}
}
return true
}
enum class DownType{
NONE,LOCK,UNLOCK
}
override fun lockStatusChange(isLock: Boolean) {
if(isLock){
setImageResource(R.drawable.charter_p_lock)
}else{
setImageResource(R.drawable.charter_p_unlock)
}
}
}

View File

@@ -0,0 +1,149 @@
package com.mogo.och.bus.passenger.ui.lockview
import android.content.Context
import android.os.Handler
import android.os.Looper
import android.os.Message
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.MotionEvent
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.och.bus.passenger.R
import kotlinx.android.synthetic.main.m1_devices_unlock.view.aciv_only_unlock
import kotlinx.android.synthetic.main.m1_devices_unlock.view.actv_lock_status
class UnlockView : ConstraintLayout, LockManager.LockStatusCallback {
private val TAG = "UnlockView"
constructor(context: Context) : super(context)
constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet)
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super(
context,
attributeSet,
defStyleAttr
)
private var handler: Handler?=null
private fun initView() {
LayoutInflater.from(context).inflate(R.layout.m1_devices_unlock, this, true)
handler = object : Handler(Looper.myLooper()!!) {
override fun handleMessage(msg: Message) {
super.handleMessage(msg)
when (msg.what) {
1 -> {// 时间到隐藏view
visibility = View.GONE
}
2 -> {// 解锁
LockManager.setLock(LockManager.LockStatus.UNLOCK)
sendEmptyMessageDelayed(1, 2_000)
}
else -> {}
}
}
}
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
LockManager.setAutoStatusCallback(TAG,this)
}
override fun setVisibility(visibility: Int) {
super.setVisibility(visibility)
LockManager.setStatusView(visibility)
when (visibility) {
View.VISIBLE -> {
CallerLogger.d(TAG,"VISIBLE")
handler?.removeMessages(1)
handler?.sendEmptyMessageDelayed(1,2_000)
}
View.GONE -> {
handler?.removeMessages(1)
CallerLogger.d(TAG,"GONE")
}
View.INVISIBLE -> {
CallerLogger.d(TAG,"INVISIBLE")
}
else -> {}
}
}
override fun onTouchEvent(event: MotionEvent?): Boolean {
if(LockManager.getLockStatus()!=LockManager.LockStatus.UNLOCK) {
when (event?.action) {
MotionEvent.ACTION_DOWN -> {
handler?.removeMessages(1)
handler?.sendEmptyMessageDelayed(2, 1_000)
LockManager.setLock(LockManager.LockStatus.UNLOCKING)
CallerLogger.d(TAG, "ACTION_DOWN")
}
MotionEvent.ACTION_MOVE -> {}
MotionEvent.ACTION_UP -> {
handler?.let {
if (it.hasMessages(2)) {
it.removeMessages(2)
LockManager.setLock(LockManager.LockStatus.LOCKED)
handler?.sendEmptyMessageDelayed(1, 2_000)
}
}
CallerLogger.d(TAG, "ACTION_UP")
}
MotionEvent.ACTION_CANCEL -> {
handler?.let {
if (it.hasMessages(2)) {
it.removeMessages(2)
LockManager.setLock(LockManager.LockStatus.LOCKED)
handler?.sendEmptyMessageDelayed(1, 2_000)
}
}
CallerLogger.d(TAG, "ACTION_CANCEL")
}
else -> {}
}
}
return true
}
init {
try {
initView()
} catch (e: Exception) {
e.printStackTrace()
}
}
override fun lockStatusChange(isLock: LockManager.LockStatus) {
UiThreadHandler.post {
visibility = View.VISIBLE
when (isLock) {
LockManager.LockStatus.LOCKED -> {
// 锁定
actv_lock_status.text = "长按开锁键1秒快速解锁"
aciv_only_unlock.setImageResource(R.drawable.charter_p_only_lock)
}
LockManager.LockStatus.UNLOCKING -> {
// 开锁中
actv_lock_status.text = "开锁中.."
aciv_only_unlock.setImageResource(R.drawable.charter_p_only_unlocking)
}
LockManager.LockStatus.UNLOCK -> {
// 解锁成功
actv_lock_status.text = "已解锁"
aciv_only_unlock.setImageResource(R.drawable.charter_p_only_unlock)
}
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="90"
android:endColor="#F2E0E9F8"
android:startColor="#F2F4F8FF" />
<corners android:radius="@dimen/dp_36" />
</shape>

View File

@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout"
android:layout_width="@dimen/dp_138"
android:layout_height="@dimen/dp_138">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/aciv_screen_lock_bg"
android:layout_width="@dimen/dp_138"
android:layout_height="@dimen/dp_138"
android:src="@drawable/charger_p_normal"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
/>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/aciv_screen_lock"
android:layout_width="@dimen/dp_80"
android:layout_height="@dimen/dp_80"
android:src="@drawable/charter_p_unlock"
app:layout_constraintTop_toTopOf="@+id/aciv_screen_lock_bg"
app:layout_constraintBottom_toBottomOf="@+id/aciv_screen_lock_bg"
app:layout_constraintStart_toStartOf="@+id/aciv_screen_lock_bg"
app:layout_constraintEnd_toEndOf="@+id/aciv_screen_lock_bg"
/>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/aciv_screen_unlock_ani"
android:layout_width="@dimen/dp_90"
android:layout_height="@dimen/dp_90"
app:layout_constraintTop_toTopOf="@+id/aciv_screen_lock_bg"
app:layout_constraintBottom_toBottomOf="@+id/aciv_screen_lock_bg"
app:layout_constraintStart_toStartOf="@+id/aciv_screen_lock_bg"
app:layout_constraintEnd_toEndOf="@+id/aciv_screen_lock_bg" />
</merge>

View File

@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout"
android:background="@color/bus_p_m1_66000000"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_lock_status"
android:background="@drawable/charter_p_only_unlock_bg"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_width="@dimen/dp_420"
android:layout_height="@dimen/dp_320">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/aciv_only_unlock"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="@dimen/dp_56"
android:src="@drawable/charter_p_only_unlock"
android:layout_width="@dimen/dp_180"
android:layout_height="@dimen/dp_180"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_lock_status"
android:text="长按开锁键1秒杀快速解锁"
app:layout_constraintStart_toStartOf="@+id/aciv_only_unlock"
app:layout_constraintEnd_toEndOf="@+id/aciv_only_unlock"
app:layout_constraintTop_toBottomOf="@+id/aciv_only_unlock"
android:layout_marginTop="@dimen/dp_20"
android:textSize="@dimen/dp_29"
android:textColor="@color/bus_p_m1_112b57"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.Guideline
android:id="@+id/gl_horizontal_center"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatImageView
android:src="@drawable/charter_p_arrow_lock"
android:layout_marginTop="-15dp"
android:layout_marginStart="-15dp"
app:layout_constraintStart_toEndOf="@+id/cl_lock_status"
app:layout_constraintTop_toTopOf="@+id/gl_horizontal_center"
android:layout_width="@dimen/dp_637"
android:layout_height="@dimen/dp_241"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -36,38 +36,11 @@
android:id="@+id/aciv_map_2_default"
android:layout_width="@dimen/dp_148"
android:layout_height="@dimen/dp_150"
android:layout_marginBottom="-15dp"
android:src="@drawable/bus_p_overmap_reset"
app:layout_constraintBottom_toTopOf="@+id/bb_boorombar"
app:layout_constraintEnd_toEndOf="parent" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/aciv_screen_lock_bg"
android:layout_width="@dimen/dp_138"
android:layout_height="@dimen/dp_138"
android:src="@drawable/charter_p_lock_bg"
app:layout_constraintBottom_toTopOf="@+id/aciv_map_2_default"
app:layout_constraintEnd_toEndOf="parent" />
<com.mogo.och.bus.passenger.ui.lockview.UnLockView
android:id="@+id/aciv_screen_lock"
android:layout_width="@dimen/dp_80"
android:layout_height="@dimen/dp_80"
android:src="@drawable/charter_p_unlock"
app:layout_constraintTop_toTopOf="@+id/aciv_screen_lock_bg"
app:layout_constraintBottom_toBottomOf="@+id/aciv_screen_lock_bg"
app:layout_constraintStart_toStartOf="@+id/aciv_screen_lock_bg"
app:layout_constraintEnd_toEndOf="@+id/aciv_screen_lock_bg"
/>
<ImageView
android:id="@+id/aciv_screen_unlock_ani"
android:layout_width="@dimen/dp_90"
android:layout_height="@dimen/dp_90"
app:layout_constraintTop_toTopOf="@+id/aciv_screen_lock_bg"
app:layout_constraintBottom_toBottomOf="@+id/aciv_screen_lock_bg"
app:layout_constraintStart_toStartOf="@+id/aciv_screen_lock_bg"
app:layout_constraintEnd_toEndOf="@+id/aciv_screen_lock_bg" />
<!--pnc行为决策-->
<com.mogo.eagle.core.function.hmi.ui.vehicle.PncActionsView
android:layout_width="wrap_content"
@@ -172,4 +145,23 @@
app:layout_constraintEnd_toEndOf="@+id/mapBizView"
app:layout_constraintTop_toTopOf="parent" />
<com.mogo.och.bus.passenger.ui.lockview.UnlockView
android:id="@+id/uv_only_unlock"
android:visibility="gone"
android:background="@color/bus_p_m1_66000000"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<com.mogo.och.bus.passenger.ui.lockview.LockAndUnlockView
android:layout_width="@dimen/dp_138"
android:layout_height="@dimen/dp_138"
app:layout_constraintBottom_toTopOf="@+id/aciv_map_2_default"
android:layout_marginBottom="-30dp"
app:layout_constraintEnd_toEndOf="parent" />
</com.mogo.och.bus.passenger.ui.lockview.LockViewConstrainLayout>

View File

@@ -51,4 +51,5 @@
<color name="bus_p_m1_CCFFFFFF">#CCFFFFFF</color>
<color name="bus_p_m1_80ffffff">#80FFFFFF</color>
<color name="bus_p_m1_f0e0efff">#F0E0EFFF </color>
<color name="bus_p_m1_66000000">#66000000</color>
</resources>

View File

@@ -74,6 +74,7 @@ import com.mogo.och.common.module.utils.PinYinUtil
import mogo.telematics.pad.MessagePad
import mogo.telematics.pad.MessagePad.ArrivalNotification
import mogo.telematics.pad.MessagePad.GlobalPathResp
import system_master.SsmInfo
import system_master.SystemStatusInfo
import java.util.concurrent.ConcurrentHashMap
@@ -514,6 +515,8 @@ object BusPassengerModel{
}
override fun onAutopilotStatusRespByQuery(status: SystemStatusInfo.StatusInfo) {}
override fun onSystemStatus(statusInf: SsmInfo.SsmStatusInf) {}
}
private val moGoAutopilotPlanningListener: IMoGoPlanningRottingListener =
object : IMoGoPlanningRottingListener {

View File

@@ -39,6 +39,7 @@ import java.util.List;
import mogo.telematics.pad.MessagePad;
import mogo_msg.MogoReportMsg;
import system_master.SsmInfo;
import system_master.SystemStatusInfo;
/**
@@ -248,6 +249,11 @@ public class BusPresenter extends Presenter<BusFragment>
public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) {
}
@Override
public void onSystemStatus(@NonNull SsmInfo.SsmStatusInf statusInf) {
}
@Override
public void loginSuccess(DriverStatusQueryRespBean data) {
CallerLogger.INSTANCE.d(M_BUS + TAG, " loginStatus =" + LoginStatusManager.isLogin());

View File

@@ -42,6 +42,7 @@ import java.util.List;
import mogo.telematics.pad.MessagePad;
import mogo_msg.MogoReportMsg;
import system_master.SsmInfo;
import system_master.SystemStatusInfo;
/**
@@ -260,6 +261,11 @@ public class BusPresenter extends Presenter<BusFragment>
public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) {
}
@Override
public void onSystemStatus(@NonNull SsmInfo.SsmStatusInf statusInf) {
}
@Override
public void loginSuccess(DriverStatusQueryRespBean data) {
CallerLogger.INSTANCE.d(M_BUS + TAG, " loginStatus =" + LoginStatusManager.isLogin());

View File

@@ -63,6 +63,7 @@ import io.reactivex.plugins.RxJavaPlugins;
import mogo.telematics.pad.MessagePad;
import mogo_msg.MogoReportMsg;
import planning.RoboSweeperTaskIndexOuterClass;
import system_master.SsmInfo;
import system_master.SystemStatusInfo;
/**
@@ -642,6 +643,11 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
// CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "onAutopilotStatusRespByQuery status:" + status.getSysState().getNumber());
}
@Override
public void onSystemStatus(@NonNull SsmInfo.SsmStatusInf statusInf) {
}
@Override
public void onAutopilotRouteLineId(long lineId) {

View File

@@ -52,6 +52,7 @@ import chassis.ChassisStatesOuterClass;
import mogo.telematics.pad.MessagePad;
import mogo_msg.MogoReportMsg;
import planning.RoboSweeperTaskIndexOuterClass;
import system_master.SsmInfo;
import system_master.SystemStatusInfo;
/**
@@ -229,6 +230,10 @@ public class SweeperPresenter extends Presenter<SweeperFragment>
}
@Override
public void onSystemStatus(@NonNull SsmInfo.SsmStatusInf statusInf) {
}
@Override
public void onAutopilotArriveAtStation(@Nullable MessagePad.ArrivalNotification arrivalNotification) {
SweeperTaskModel.getInstance().onArriveTaskEnd(arrivalNotification);

View File

@@ -89,6 +89,7 @@ import mogo.telematics.pad.MessagePad
import mogo.telematics.pad.MessagePad.ArrivalNotification
import mogo.telematics.pad.MessagePad.GlobalPathResp
import mogo_msg.MogoReportMsg.MogoReportMessage
import system_master.SsmInfo
import system_master.SystemStatusInfo
import java.io.IOException
@@ -860,6 +861,8 @@ object TaxiModel {
}
override fun onAutopilotStatusRespByQuery(status: SystemStatusInfo.StatusInfo) {}
override fun onSystemStatus(statusInf: SsmInfo.SsmStatusInf) {}
}
private fun arriveTerminal() {

View File

@@ -98,6 +98,7 @@ import io.reactivex.functions.Consumer;
import io.reactivex.plugins.RxJavaPlugins;
import mogo.telematics.pad.MessagePad;
import mogo_msg.MogoReportMsg;
import system_master.SsmInfo;
import system_master.SystemStatusInfo;
/**
@@ -1297,6 +1298,9 @@ public class TaxiModel {
@Override
public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) {
}
@Override
public void onSystemStatus(@NonNull SsmInfo.SsmStatusInf statusInf) {
}
};
private final IMoGoPlanningRottingListener moGoAutopilotPlanningListener = new IMoGoPlanningRottingListener() {

View File

@@ -8,13 +8,12 @@ public class TaxiPassengerStartReqBean {
public String orderNo;
public String sn;
public Double gcjLat;
public Double gcjLon;
public TaxiPassengerStartReqBean(String sn, String orderNo, Double gcjLat, Double gcjLon) {
public Long lineId;
public TaxiPassengerStartReqBean(String sn, String orderNo, Long lineId) {
this.sn = sn;
this.orderNo = orderNo;
this.gcjLat = gcjLat;
this.gcjLon = gcjLon;
this.lineId = lineId;
}
}

View File

@@ -19,6 +19,7 @@ class TaxiPassengerConst {
// 埋点key接管后点击'自动驾驶'按钮启动
const val EVENT_KEY_RESTART_AUTOPILOT = "event_key_och_taxi_restart_autopilot"
// 埋点key开始服务开启自动驾驶成功/失败)
const val EVENT_KEY_START_SERVICE = "event_key_och_taxi_start_service"
const val EVENT_PARAM_SN = "sn"
@@ -34,6 +35,11 @@ class TaxiPassengerConst {
// 埋点key开启自动驾驶前已识别的异常会导致无法开启自驾
const val EVENT_KEY_AP_UNABLE_START_REASON = "event_key_och_taxi_ap_unable_start_reason"
const val EVENT_PARAM_UNABLE_START_REASON = "unable_start_reason";
const val EVENT_PARAM_UNABLE_START_REASON = "unable_start_reason"
//任务类型
const val TaskType_VIRTUAL = 1 // 虚拟任务
const val TaskType_DRIVE_TO_START = 2 // 接驾任务
const val TaskType_DRIVE_TO_END = 3 //送驾任务
}
}

View File

@@ -188,11 +188,10 @@ object AutopilotManager : IMoGoAutopilotStatusListener {
*/
private fun startAutoPilotServiceByPassenger() {
if (TaxiPassengerModel.currentOCHOrder == null) return
val currentLocation = CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02()
//val currentLocation = CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02()
TaxiPassengerServiceManager.startAutoPilotServiceByPassenger(
TaxiPassengerModel.currentOCHOrder!!.orderNo,
currentLocation.latitude,
currentLocation.longitude,
TaxiPassengerModel.currentLineId,
object : OchCommonServiceCallback<TaxiPassengerBaseRespBean> {
override fun onSuccess(data: TaxiPassengerBaseRespBean) {
VoiceNotice.showNotice("坐稳扶好,我们出发咯!", AIAssist.LEVEL2)

View File

@@ -33,6 +33,7 @@ import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrderQueryRespBean
import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrdersInServiceQueryRespBean
import com.mogo.och.taxi.passenger.callback.IOCHTaxiPassengerOrderStatusCallback
import com.mogo.och.taxi.passenger.constant.TaxiPassengerConst
import com.mogo.och.taxi.passenger.constant.TaxiPassengerConst.Companion.TaskType_DRIVE_TO_END
import com.mogo.och.taxi.passenger.constant.TaxiPassengerOrderStatusEnum
import com.mogo.och.taxi.passenger.constant.TaxiPassengerOrderStatusEnum.Companion.valueOf
import com.mogo.och.taxi.passenger.network.TaxiPassengerServiceManager
@@ -158,6 +159,11 @@ object TaxiPassengerModel {
}
return
}
//目前后端将一个订单拆分成了多个任务,乘客屏只关心 送驾 类型的任务,这里过滤其他任务避免干扰
if (data.data.taskType != TaskType_DRIVE_TO_END) {
d(M_TAXI_P + TAG, "queryInAndWaitOrders data.taskType=${data.data.taskType}, discard data")
return
}
//1. 处理进行中订单
if (data.data != null && data.data.order != null) {
// 1.1. 当存在进行中单时对本地currentOrder进行更新

View File

@@ -81,7 +81,7 @@ internal interface TaxiPassengerServiceApi {
* @return
*/
@Headers("Content-type:application/json;charset=UTF-8")
@POST("/och-taxi-cabin/api/flow/v1/startService")
@POST("/och-taxi-cabin/api/flow/v1/startTask")
fun startAutoPilotServiceByPassenger(
@Header("appId") appId: String = MoGoAiCloudClientConfig.getInstance().serviceAppId,
@Header("ticket") ticket: String= MoGoAiCloudClientConfig.getInstance().token,

View File

@@ -110,15 +110,14 @@ object TaxiPassengerServiceManager {
@JvmStatic
fun startAutoPilotServiceByPassenger(
orderNo: String?,
gcjLat: Double?,
gcjLon: Double?,
lineId: Long?,
callback: OchCommonServiceCallback<TaxiPassengerBaseRespBean>?
) {
if (beforeNet()) {
return
}
mOCHTaxiServiceApi.startAutoPilotServiceByPassenger(
data = TaxiPassengerStartReqBean(driverSn, orderNo, gcjLat, gcjLon)
data = TaxiPassengerStartReqBean(driverSn, orderNo, lineId)
)
.transformTry()
.retry(3)

View File

@@ -27,8 +27,8 @@ class ChekViewModel : ViewModel(), IOCHTaxiPassengerOrderStatusCallback {
private fun setOrderInfo() {
val currentOCHOrder = TaxiPassengerModel.currentOCHOrder
currentOCHOrder?.let { order ->
viewCallback?.setOrderInfo(order.orderStartSite.siteName,
order.orderEndSite.siteName, "${order.passengerSize}", order.bookingUserPhone)
viewCallback?.setOrderInfo(order.orderStartSite?.siteName,
order.orderEndSite?.siteName, "${order.passengerSize}", order.bookingUserPhone)
}
}

View File

@@ -30,6 +30,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutopilotGuardian
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutopilotSNRequest
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutopilotStatusRespByQuery
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeSystemStatus
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.updateAutoPilotDockerInfo
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.updateAutoPilotStatus
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager.invokeAutopilotAbility
@@ -75,6 +76,7 @@ import perception.TrafficLightOuterClass
import planning.RoboSweeperTaskIndexOuterClass
import prediction.Prediction
import record_cache.RecordPanelOuterClass
import system_master.SsmInfo
import system_master.SystemStatusInfo
/**
@@ -438,6 +440,10 @@ class MoGoAdasListenerImpl : OnAdasListener {
invokeAutopilotStatusRespByQuery(statusInfo)
}
override fun onSystemStatus(header: MessagePad.Header?, statusInf: SsmInfo.SsmStatusInf?) {
invokeSystemStatus(statusInf)
}
/**
* 数据采集配置应答
*/

View File

@@ -38,6 +38,7 @@ class MoGoAdasMsgConnectStatusListenerImpl :
init {
CallerCloudListenerManager.addListener(TAG, this)
CallerAutopilotActionsListenerManager.setConnected(AdasManager.getInstance().ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.CONNECTED)
}
override fun onConnectionIPCStatus(ipcConnectionStatus: Int, reason: String?) {

View File

@@ -13,6 +13,7 @@ import com.zhjt.mogo_core_function_devatools.status.flow.IFlow
import kotlinx.coroutines.Job
import mogo_msg.MogoReportMsg.MogoReportMessage
import planning.RoboSweeperTaskIndexOuterClass
import system_master.SsmInfo
import system_master.SystemStatusInfo.StatusInfo
import java.util.concurrent.atomic.AtomicInteger
@@ -115,6 +116,14 @@ internal class CanImpl(ctx: Context) :
}
}
override fun onSystemStatus(statusInf: SsmInfo.SsmStatusInf) {
val state = statusInf.healthInfoList?.find { "can_adapter".equals(it.name, true) }?.state?.ordinal
Log.d(TAG, "state: $state")
if (state != null) {
this.state.set(state)
}
}
override fun onDestroy() {
super.onDestroy()
job?.safeCancel()

View File

@@ -16,7 +16,8 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import system_master.SystemStatusInfo.HealthInfo
import system_master.SsmInfo
import system_master.SsmBase.HealthInfo
import system_master.SystemStatusInfo.StatusInfo
import java.util.concurrent.atomic.AtomicBoolean
import java.util.concurrent.atomic.AtomicReference
@@ -72,6 +73,17 @@ internal class RTKImpl(ctx: Context): IFlow<RTKStatus>(ctx), IMoGoAutopilotStatu
}
}
override fun onSystemStatus(statusInf: SsmInfo.SsmStatusInf) {
check?.takeIf { it.isActive }?.cancel()
isOldVersion.set(false)
val info = statusInf.healthInfoList?.find { "localization".equals(it.name, true) }
Log.d(TAG, "info: $info")
if (info != null) {
healthInfo.set(info)
send(RTKStatus(getDesc(), getCode()))
}
}
override fun onAutopilotIpcConnectStatusChanged(status: Int, reason: String?) {
super.onAutopilotIpcConnectStatusChanged(status, reason)
if (!CallerAutoPilotControlManager.isConnected()) {

View File

@@ -23,6 +23,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import mogo.telematics.pad.MessagePad;
import mogo_msg.MogoReportMsg;
import system_master.SsmInfo;
import system_master.SystemStatusInfo;
public class MogoRouteOverlayManager implements
@@ -134,6 +135,10 @@ public class MogoRouteOverlayManager implements
public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) {
}
@Override
public void onSystemStatus(@NonNull SsmInfo.SsmStatusInf statusInf) {
}
@Override
public void onAutopilotRouteLineId(long lineId) {

View File

@@ -61,6 +61,12 @@ interface IMoGoAutopilotStatusListener {
*/
fun onAutopilotStatusRespByQuery(status: SystemStatusInfo.StatusInfo) {}
/**
* 定频SSM
* 老版本 SSMSystemStatusInfo.StatusInfo HQ、M1 MAP350开始弃用其他车型MAP360开始弃用
*/
fun onSystemStatus(statusInf: SsmInfo.SsmStatusInf) {}
/**
* 自动驾驶路线ID回调
*/

View File

@@ -7,6 +7,7 @@ import com.mogo.eagle.core.function.call.base.CallerBase
import com.mogo.eagle.core.utilcode.util.GsonUtils
import mogo.telematics.pad.MessagePad
import mogo_msg.MogoReportMsg
import system_master.SsmInfo
import system_master.SystemStatusInfo
import kotlin.properties.Delegates
@@ -207,6 +208,19 @@ object CallerAutoPilotStatusListenerManager : CallerBase<IMoGoAutopilotStatusLis
}
}
/**
* 定频SSM
* 老版本 SSMSystemStatusInfo.StatusInfo HQ、M1 MAP350开始弃用其他车型MAP360开始弃用
*/
fun invokeSystemStatus(statusInf: SsmInfo.SsmStatusInf?) {
statusInf?.also {
M_LISTENERS.forEach { itx ->
val listener = itx.value
listener.onSystemStatus(it)
}
}
}
/**
* 更新自动驾驶控制参数结束自动驾驶时候需要更新为null且更新时候同时触发onAutopilotStatusResponse回调
*/

View File

@@ -1,8 +1,6 @@
package com.mogo.eagle.core.function.call.autopilot
import android.util.Log
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotActionsListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.isConnected
import com.mogo.eagle.core.function.call.base.CallerBase
import com.zhjt.mogo.adas.data.bean.UnableAutopilotReason
@@ -17,10 +15,9 @@ object CallerAutopilotActionsListenerManager : CallerBase<IMoGoAutopilotActionsL
private var unableAutopilotReasons: ArrayList<UnableAutopilotReason>? = null
init {
// isConnected = isConnected() //TODO 重复初始
isAutopilotAbility = false
unableAutopilotReasons = disconnectedReason()
printLog("初始化")
// printLog("初始化")
}
private fun disconnectedReason(): ArrayList<UnableAutopilotReason> {
@@ -50,7 +47,7 @@ object CallerAutopilotActionsListenerManager : CallerBase<IMoGoAutopilotActionsL
this.isAutopilotAbility = isConnected
unableAutopilotReasons = if (isConnected) null else disconnectedReason()
notification()
printLog("更新数据 连接状态变更")
// printLog("更新数据 连接状态变更")
}
}
@@ -66,23 +63,23 @@ object CallerAutopilotActionsListenerManager : CallerBase<IMoGoAutopilotActionsL
this.unableAutopilotReasons?.let { old ->
old.sortWith(compareBy(UnableAutopilotReason::hashCode));
isEquals = onw.toTypedArray() contentEquals old.toTypedArray()
Log.i(
"ddd",
"都不为null时=${isEquals}=${this.isAutopilotAbility} ${(if (this.unableAutopilotReasons == null) null else this.unableAutopilotReasons.toString())}"
)
// Log.i(
// "ddd",
// "都不为null时=${isEquals}=${this.isAutopilotAbility} ${(if (this.unableAutopilotReasons == null) null else this.unableAutopilotReasons.toString())}"
// )
}
}
} else isEquals =
!(unableAutopilotReasons != null || this.unableAutopilotReasons != null)
Log.i(
"ddd",
" 两个List是否相同=${isEquals} 新是否能启动自驾=${isAutopilotAbility} 老是否能启动自驾=${this.isAutopilotAbility} 新List是否为空=${unableAutopilotReasons == null} 老List是否为空=${this.unableAutopilotReasons == null}"
)
// Log.i(
// "ddd",
// " 两个List是否相同=${isEquals} 新是否能启动自驾=${isAutopilotAbility} 老是否能启动自驾=${this.isAutopilotAbility} 新List是否为空=${unableAutopilotReasons == null} 老List是否为空=${this.unableAutopilotReasons == null}"
// )
if (this.isAutopilotAbility != isAutopilotAbility || !isEquals) {
this.isAutopilotAbility = isAutopilotAbility
this.unableAutopilotReasons = unableAutopilotReasons
notification()
printLog("更新数据")
// printLog("更新数据")
}
}
}
@@ -94,10 +91,10 @@ object CallerAutopilotActionsListenerManager : CallerBase<IMoGoAutopilotActionsL
}
}
fun printLog(tag: String) {
Log.i(
"ddd",
"${tag}=${isAutopilotAbility} ${(if (unableAutopilotReasons == null) null else unableAutopilotReasons.toString())}"
)
}
// fun printLog(tag: String) {
// Log.i(
// "xfk",
// "${tag}=${isAutopilotAbility} ${(if (unableAutopilotReasons == null) null else unableAutopilotReasons.toString())}"
// )
// }
}

View File

@@ -155,17 +155,17 @@ MATRIX_VERSION=2.0.8
# 测试模式司机端版本号
NOOP_DRIVER_VERSION=3.2.0
# 公交模式司机端版本号
BUS_DRIVER_VERSION=3.4.0
BUS_DRIVER_VERSION=6.0.0
# 公交模式乘客端端版本号
BUS_PASSENGER_VERSION=2.4.0
BUS_PASSENGER_VERSION=5.0.0
# 接驳模式司机端版本号
SHUTTLE_DRIVER_VERSION=3.4.0
SHUTTLE_DRIVER_VERSION=6.0.0
# 接驳模式乘客端端版本号
SHUTTLE_PASSENGER_VERSION=2.4.0
SHUTTLE_PASSENGER_VERSION=5.0.0
# 出租车模式司机端版本号
TAXI_DRIVER_VERSION=3.4.0
TAXI_DRIVER_VERSION=6.0.0
# 出租车模式乘客端端版本号
TAXI_PASSENGER_VERSION=2.4.0
TAXI_PASSENGER_VERSION=5.0.0
# 出租车模式司机端版本号
TAXI_UNMANNED_DRIVER_VERSION=6.0.0
@@ -173,9 +173,9 @@ TAXI_UNMANNED_DRIVER_VERSION=6.0.0
TAXI_UNMANNED_PASSENGER_VERSION=5.0.0
# 包车模式司机端版本号
CHARTER_DRIVER_VERSION=3.4.0
CHARTER_DRIVER_VERSION=6.0.0
# 包车模式乘客端端版本号
CHARTER_PASSENGER_VERSION=2.4.0
CHARTER_PASSENGER_VERSION=5.0.0
# 支持云控清扫车模式司机端版本号
SWEEPERCLOUD_DRIVER_VERSION=3.1.4
# 清扫车模式司机端版本号

View File

@@ -32,6 +32,7 @@ enum MessageType
MsgTypeFunctionStates = 0x1000c; //重构后的功能状态, 透传
MsgTypeBackCameraVideo = 0x1000d; //后部摄像头视频 10hz
MsgTypeM1StitchedVideo = 0x1000e; //m1拼接视频 10hz
MsgTypeSSMState = 0x1000f; //ssm 系统状态 1hz hq m1 MAP350开始支持其他车型MAP360开始支持
MsgTypeBasicInfoReq = 0x10100; //自动驾驶设备基础信息请求
MsgTypeBasicInfoResp = 0x10101; //自动驾驶设备基础信息应答
@@ -709,3 +710,6 @@ message SessionInfo
uint64 connectedTimeStamp = 4;
string version = 5;
}
//message definition for MsgTypeSSMState
//refer to ssm_info.proto for details

View File

@@ -0,0 +1,18 @@
syntax = "proto2";
package system_master;
enum HealthState {
NORMAL = 0;
FAULT = 1;
UNKNOW = 2;
}
message HealthInfo{
required string name = 1; //node name
required HealthState state = 2; //health state
optional string code = 3; //code 与系统事件错误码对应,如有该错误填写,没有不填
optional string desc = 4; //补充描述,用于未知情况
}

View File

@@ -0,0 +1,54 @@
syntax = "proto2";
package system_master;
import "personal/ssm_base.proto";
enum NodeState {
NONE = 0; //未知状态None
WAITING = 1; //依赖未就绪Waiting
STARTING = 2; //启动中Starting
RUNNING = 3; //运行running
STOPPING = 4; //停止stopping
BROKEN = 5; //无法启动状态
MAN_RUN = 6; //非自动启动状态
MAN_STOP = 7; //非自动关闭状态
}
enum AgentState {
DISCONNECT = 0; //未连接或断开连接
CONNECTED = 1; //连接状态
}
enum ModeState {
MODE_STOP_UNREADY = 0; //停止模式-未就绪
MODE_STOP_READY = 1; //运行模式-就绪 (所有节点关闭)
MODE_RUN_UNREADY = 2; //运行模式-未就绪
MODE_RUN_READY = 3; //运行模式-就绪 (所有节点启动)
MODE_IDLE_UNREADY = 4; //空闲模式-未就绪
MODE_IDLE_READY = 5; //空闲模式-就绪 (非驾驶状态)
}
message NodeInf {
optional string node_name = 1; //node name
optional string launch_name = 2; //launch name
optional NodeState state = 3;
}
message SsmStatusInf {
required ModeState mode_state = 1; // 当前系统模式状态
optional string map_version = 2; // MAP 版本信息
optional string master_version = 3; // SSM 版本信息
required bool auto_pilot_ready = 4; // 自动驾驶状态就绪
required bool remote_pilot_ready = 5; // 平行驾驶状态就绪
repeated NodeInf auto_pilot_unready_list = 6; //自驾未就绪节点列表
repeated NodeInf remote_pilot_unready_list = 7; //平行驾驶未就绪列表
optional string auto_pilot_unready_reason = 8; //自动驾驶状态未就绪原因描述
optional string remote_pilot_unready_reason = 9; //平行驾驶状态未就绪原因描述
repeated HealthInfo health_info=10; // 健康检查状态信息
optional uint64 cur_used_lineid = 20 [default = 0]; //0当前无可用轨迹需要下单other: 可用轨迹id
optional string hd_map_ver = 21; //高精地图版本
optional string slam_map_ver = 22; //slam地图版本
optional string grid_map_ver = 23; //栅格地图版本
}

View File

@@ -1,6 +1,7 @@
syntax = "proto2";
package system_master;
import "personal/ssm_base.proto";
enum SystemState {
SYS_STARTING = 0; //系统正在启动
@@ -14,19 +15,6 @@ enum SystemState {
REMOTE_PILOT_RUNNING = 8; //平行驾驶运行中
}
enum HealthState {
NORMAL = 0;//正常
FAULT = 1;//异常
UNKNOW = 2;//未知
}
message HealthInfo{
required string name = 1; //node name
required HealthState state = 2; //health state
optional string code = 3; //code 与系统事件错误码对应,如有该错误填写,没有不填
optional string desc = 4; //补充描述,用于未知情况
}
message TopicInfo{
optional string name = 1; //topic name
optional int32 hz = 2; //Topic发送的频率
@@ -50,7 +38,7 @@ message NodeFaultList{
message StatusInfo {
required SystemState sys_state=1; // 当前系统状态
repeated HealthInfo health_info=2; // 健康检查状态信息
repeated HealthInfo health_info=2; // 健康检查状态信息
optional DropTopic topic_drop_info=3; // topic 掉频信息, 如有掉频添加没有不添加
optional string reserved = 4; // 用于表示idle模式'idle' 表示idle模式 'work' 表示正常工作
// add by liyl 20220907
@@ -63,5 +51,9 @@ message StatusInfo {
optional NodeFaultList remote_pilot_unready_list = 11; //平行驾驶未就绪列表, 20221128 增加
optional string auto_pilot_unready_reason = 12; //自动驾驶状态未就绪原因描述
optional string remote_pilot_unready_reason = 13; //平行驾驶状态未就绪原因描述
}
optional uint64 cur_used_lineid = 20 [default = 0]; //0当前无可用轨迹需要下单other: 可用轨迹id
optional string hd_map_ver = 21; //高精地图版本
optional string slam_map_ver = 22; //slam地图版本
optional string grid_map_ver = 23; //栅格地图版本
}

View File

@@ -22,6 +22,7 @@ android {
versionName rootProject.versionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
multiDexEnabled true
}
buildTypes {

View File

@@ -1136,8 +1136,16 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
*
* @return boolean
*/
@Deprecated//HQ、M1 MAP350开始弃用其他车型MAP360开始弃用
@Override
public boolean sendStatusQueryReq() {
MessagePad.CarConfigResp config = AdasManager.getInstance().getCarConfig();
if (config != null) {
//HQ和M1 MAP>=350开始走定频SSM其他车型360开始
if ((config.getMapVersion() >= 30500 && (config.getIsJinlvM1() || config.getIsHQ())) || config.getMapVersion() >= 30600) {
return false;
}
}
MessagePad.StatusQueryReq req = MessagePad.StatusQueryReq
.newBuilder()
.build();

View File

@@ -578,6 +578,7 @@ public class AdasManager implements IAdasNetCommApi {
*
* @return boolean
*/
@Deprecated//HQ、M1 MAP350开始弃用其他车型MAP360开始弃用
@Override
public boolean sendStatusQueryReq() {
return mChannel != null && mChannel.sendStatusQueryReq();

View File

@@ -266,6 +266,7 @@ public interface IAdasNetCommApi {
*
* @return 加入WS发送消息队列是否成功
*/
@Deprecated//HQ、M1 MAP350开始弃用其他车型MAP360开始弃用
boolean sendStatusQueryReq();
/**

View File

@@ -20,7 +20,6 @@ import com.zhjt.mogo.adas.data.sweeper.task.status.SweeperTaskStatus;
import com.zhjt.mogo.adas.data.sweeper.task.stop.SweeperTaskStop;
import java.util.ArrayList;
import java.util.List;
import bag_manager.BagManagerOuterClass;
import chassis.ChassisStatesOuterClass;
@@ -34,6 +33,7 @@ import perception.TrafficLightOuterClass;
import planning.RoboSweeperTaskIndexOuterClass;
import prediction.Prediction;
import record_cache.RecordPanelOuterClass;
import system_master.SsmInfo;
import system_master.SystemStatusInfo;
/**
@@ -197,8 +197,19 @@ public interface OnAdasListener {
* @param header 头
* @param statusInfo 数据
*/
@Deprecated//HQ、M1 MAP350开始弃用其他车型MAP360开始弃用
void onStatusQueryResp(MessagePad.Header header, SystemStatusInfo.StatusInfo statusInfo);
/**
* 定频SSM接口
* 1hz hq m1 MAP350开始支持其他车型MAP360开始支持
* 定频SSM接入后 onStatusQueryResp 状态查询应答接口将弃用
*
* @param header 头
* @param statusInf 数据
*/
void onSystemStatus(MessagePad.Header header, SsmInfo.SsmStatusInf statusInf);
/**
* 数据采集配置应答
*

View File

@@ -30,6 +30,7 @@ public enum MessageType {
TYPE_RECEIVE_FUNCTION_STATES(MessagePad.MessageType.MsgTypeFunctionStates, "重构后功能状态"),
TYPE_RECEIVE_BACK_CAMERA_VIDEO(MessagePad.MessageType.MsgTypeBackCameraVideo, "后摄像头"),
TYPE_RECEIVE_M1_STITCHED_VIDEO(MessagePad.MessageType.MsgTypeM1StitchedVideo, "M1拼接视频"),
TYPE_RECEIVE_SSM(MessagePad.MessageType.MsgTypeSSMState, "SSM系统状态"),
TYPE_RECEIVE_BASIC_INFO_REQ(MessagePad.MessageType.MsgTypeBasicInfoReq, "自动驾驶设备基础信息请求"),
TYPE_SEND_BASIC_INFO_RESP(MessagePad.MessageType.MsgTypeBasicInfoResp, "自动驾驶设备基础信息应答"),

View File

@@ -53,7 +53,7 @@ public class AutopilotAbility230 {
Chassis.GearPosition gear = chassisStates.getGearSystemStates().getGearPosition();
if (!AutopilotAbilityManager.getInstance().isLaunchAutopilot(gear)) {
isAutopilotAbility = false;
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.CHASSIS, "当前档位无法启动自驾");
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.CHASSIS, "档位异常");
}
}
//TODO 关于手刹:不同车型的实现不同所以目前没法使用此字段

View File

@@ -79,17 +79,14 @@ public class AutopilotAbility250 {
SystemStatusInfo.NodeFaultList nodeFaultList = statusInfo.getAutoPilotUnreadyList();
if (nodeFaultList.getSum() > 0) {
List<SystemStatusInfo.NodeInfo> list = nodeFaultList.getNodeList();
StringBuilder builder = new StringBuilder();
for (SystemStatusInfo.NodeInfo info : list) {
builder.append(info.getNodeName());
String nodeName = info.getNodeName();
int state = info.getState();
if (state < AutopilotAbilityManager.NODE_INFO_STATE.length) {
builder.append(AutopilotAbilityManager.NODE_INFO_STATE[state]);
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, nodeName + AutopilotAbilityManager.NODE_INFO_STATE[state]);
} else {
builder.append("未知异常 ");
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, nodeName + "未知异常");
}
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, builder.toString());
builder.setLength(0);
}
} else {
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, "未知异常节点");
@@ -144,7 +141,7 @@ public class AutopilotAbility250 {
Chassis.GearPosition gear = chassisStates.getGearSystemStates().getGearPosition();
if (!AutopilotAbilityManager.getInstance().isLaunchAutopilot(gear)) {
isAutopilotAbility = false;
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.CHASSIS, "当前档位无法启动自驾");
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.CHASSIS, "档位异常");
}
}
//TODO 关于手刹:不同车型的实现不同所以目前没法使用此字段

View File

@@ -82,17 +82,14 @@ public class AutopilotAbility330 {
SystemStatusInfo.NodeFaultList nodeFaultList = statusInfo.getAutoPilotUnreadyList();
if (nodeFaultList.getSum() > 0) {
List<SystemStatusInfo.NodeInfo> list = nodeFaultList.getNodeList();
StringBuilder builder = new StringBuilder();
for (SystemStatusInfo.NodeInfo info : list) {
builder.append(info.getNodeName());
String nodeName = info.getNodeName();
int state = info.getState();
if (state < AutopilotAbilityManager.NODE_INFO_STATE.length) {
builder.append(AutopilotAbilityManager.NODE_INFO_STATE[state]);
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, nodeName + AutopilotAbilityManager.NODE_INFO_STATE[state]);
} else {
builder.append("未知异常 ");
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, nodeName + "未知异常");
}
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, builder.toString());
builder.setLength(0);
}
} else {
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, "未知异常节点");
@@ -145,7 +142,7 @@ public class AutopilotAbility330 {
}
}
if (unableAutopilotReasons == null || unableAutopilotReasons.isEmpty()) {
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.LIB, "FSM未给出原因");
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.LIB, "FSM数据异常");
}
}
}

View File

@@ -0,0 +1,147 @@
package com.zhidao.support.adas.high.common.autopilot.ability;
import androidx.annotation.Nullable;
import com.zhidao.support.adas.high.AdasManager;
import com.zhidao.support.adas.high.common.CupidLogUtils;
import com.zhjt.mogo.adas.data.bean.UnableAutopilotReason;
import java.util.ArrayList;
import chassis.Chassis;
import chassis.ChassisStatesOuterClass;
import system_master.SsmInfo;
/**
* 是否可以启动自动驾驶能力检测 工控机版本>=350&&(isHQ||isJinlvM1) || 工控机版本>=360&&!isFutianSweeper 使用此类
* 目前监控了定频SSM的数据和FSM状态原因查询
* 没有使用监控事件报告的原因是因为,部分异常没进行正常恢复通知,例如收到了异常监控数据,但是异常恢复之后没有恢复的通知
* <p>
*/
public class AutopilotAbility350And360 {
private static final String TAG = AutopilotAbility250.class.getSimpleName();
private ChassisStatesOuterClass.ChassisStates chassisStates;
private int masterVersion = -1;//Master版本
private OnAutopilotAbilityListener listener;
protected interface OnAutopilotAbilityListener {
void onAutopilotAbility(boolean isAutopilotAbility, @Nullable ArrayList<UnableAutopilotReason> unableAutopilotReasons);
}
protected AutopilotAbility350And360() {
this.masterVersion = -1;
}
protected void setStatusInfo(SsmInfo.SsmStatusInf statusInfo) {
onCallback(statusInfo);
}
protected void setChassisStates(ChassisStatesOuterClass.ChassisStates chassisStates) {
this.chassisStates = chassisStates;
}
private void onCallback(SsmInfo.SsmStatusInf statusInfo) {
boolean isAutopilotAbility = true;//是否能启动自动驾驶
ArrayList<UnableAutopilotReason> unableAutopilotReasons = null;//不能启动自动驾驶原因
//检测节点状态相关
if (statusInfo != null) {
if (masterVersion == -1 && statusInfo.hasMasterVersion()) {
//截取Master Version
masterVersion = AdasManager.getInstance().parseVersion(false, statusInfo.getMasterVersion());
}
CupidLogUtils.i(TAG, "MasterVersion=" + masterVersion);
//SSM 3版本兼容
if (masterVersion > 2 && statusInfo.hasAutoPilotReady() && statusInfo.hasAutoPilotUnreadyReason()) {
isAutopilotAbility = statusInfo.getAutoPilotReady();
if (!isAutopilotAbility) {
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, statusInfo.getAutoPilotUnreadyReason());
}
} else if (masterVersion > 1 && statusInfo.hasAutoPilotReady()) {//如果 maser version 大于1还需要判断AutoPilotReady字段是否存在以确保MAP版本和SSM Maser版本不陪配情况逻辑能正常执行
isAutopilotAbility = statusInfo.getAutoPilotReady();
if (!isAutopilotAbility) {
int count = statusInfo.getAutoPilotUnreadyListCount();
if (count > 0) {
for (int i = 0; i < count; i++) {
SsmInfo.NodeInf info = statusInfo.getAutoPilotUnreadyList(i);
String nodeName = info.getNodeName();
int state = info.getState().getNumber();
if (state < AutopilotAbilityManager.NODE_INFO_STATE_FIXED_FREQUENCY.length) {
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, nodeName + AutopilotAbilityManager.NODE_INFO_STATE_FIXED_FREQUENCY[state]);
} else {
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, nodeName + "未知异常");
}
}
} else {
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, "未知异常节点");
}
}
} else {
SsmInfo.ModeState modeState = statusInfo.getModeState();
if (modeState != SsmInfo.ModeState.MODE_RUN_UNREADY && modeState != SsmInfo.ModeState.MODE_RUN_READY) {
isAutopilotAbility = false;
String unableAutopilotReason = null;
if (modeState == SsmInfo.ModeState.MODE_STOP_UNREADY) {
unableAutopilotReason = "系统处于停止模式(未就绪)";
} else if (modeState == SsmInfo.ModeState.MODE_STOP_READY) {
unableAutopilotReason = "系统处于停止模式";
} else if (modeState == SsmInfo.ModeState.MODE_IDLE_UNREADY) {
unableAutopilotReason = "系统处于空闲模式(未就绪)";
} else if (modeState == SsmInfo.ModeState.MODE_IDLE_READY) {
unableAutopilotReason = "系统处于空闲模式";
} else {
unableAutopilotReason = "未知系统模式";
}
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, unableAutopilotReason);
}
}
} else {
isAutopilotAbility = false;//是否能启动自动驾驶
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.LIB, "SSM数据异常");
}
//检测底盘相关
if (chassisStates != null) {
if (chassisStates.hasBrakeSystemStates()) {
float brake = chassisStates.getBrakeSystemStates().getBrakePedalResponsePosition();
if (brake > 0) {
isAutopilotAbility = false;
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.CHASSIS, "制动踏板被踩下");
}
}
if (chassisStates.hasGearSystemStates()) {
Chassis.GearPosition gear = chassisStates.getGearSystemStates().getGearPosition();
if (!AutopilotAbilityManager.getInstance().isLaunchAutopilot(gear)) {
isAutopilotAbility = false;
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.CHASSIS, "档位异常");
}
}
//TODO 关于手刹:不同车型的实现不同所以目前没法使用此字段
// //电子驻车制动系统
// if (chassisStates.hasEpbSystemStates()) {
// ChassisStatesOuterClass.EPBSystemStates epb = chassisStates.getEpbSystemStates();
// if (epb.hasEpbEnableState()){
// epb.getEpbWorkState();
// }
// }
}
if (listener != null) {
listener.onAutopilotAbility(isAutopilotAbility, unableAutopilotReasons);
}
}
protected void start(OnAutopilotAbilityListener listener) {
this.listener = listener;
}
protected void stop() {
this.chassisStates = null;
this.masterVersion = -1;
this.listener = null;
}
}

View File

@@ -0,0 +1,134 @@
package com.zhidao.support.adas.high.common.autopilot.ability;
import android.text.TextUtils;
import androidx.annotation.Nullable;
import com.zhidao.support.adas.high.AdasManager;
import com.zhidao.support.adas.high.common.CupidLogUtils;
import com.zhjt.mogo.adas.data.bean.UnableAutopilotReason;
import java.util.ArrayList;
import function_state_management.FSMStatusReasonQueryOuterClass;
import system_master.SsmInfo;
/**
* 是否可以启动自动驾驶能力检测 工控机版本>=360&&isFutianSweeper 使用此类
* TODO 目前只用于清扫车其他车型需要MAP支持 FSM的相关功能
* 目前监控了定频SSM的数据和FSM状态原因查询
* 没有使用监控事件报告的原因是因为,部分异常没进行正常恢复通知,例如收到了异常监控数据,但是异常恢复之后没有恢复的通知
*/
public class AutopilotAbility360 {
private static final String TAG = AutopilotAbility360.class.getSimpleName();
private volatile FSMStatusReasonQueryOuterClass.FSMStatusReasonRespond fsmStatusReasonRespond;//自动驾驶状态为OFF的原因
private int masterVersion = -1;//Master版本
private OnAutopilotAbilityListener listener;
protected interface OnAutopilotAbilityListener {
void onAutopilotAbility(boolean isAutopilotAbility, @Nullable ArrayList<UnableAutopilotReason> unableAutopilotReasons);
}
protected AutopilotAbility360() {
this.masterVersion = -1;
}
protected synchronized void setFsmStatusReasonRespond(FSMStatusReasonQueryOuterClass.FSMStatusReasonRespond fsmStatusReasonRespond) {
this.fsmStatusReasonRespond = fsmStatusReasonRespond;
}
protected void setStatusInfo(SsmInfo.SsmStatusInf statusInfo) {
onCallback(statusInfo);
}
private void onCallback(SsmInfo.SsmStatusInf statusInfo) {
boolean isAutopilotAbility = true;//是否能启动自动驾驶
ArrayList<UnableAutopilotReason> unableAutopilotReasons = null;//不能启动自动驾驶原因
//检测节点状态相关
if (statusInfo != null) {
if (masterVersion == -1 && statusInfo.hasMasterVersion()) {
//截取Master Version
masterVersion = AdasManager.getInstance().parseVersion(false, statusInfo.getMasterVersion());
}
CupidLogUtils.i(TAG, "MasterVersion=" + masterVersion);
//SSM 3版本兼容
if (masterVersion > 2 && statusInfo.hasAutoPilotReady() && statusInfo.hasAutoPilotUnreadyReason()) {
isAutopilotAbility = statusInfo.getAutoPilotReady();
if (!isAutopilotAbility) {
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, statusInfo.getAutoPilotUnreadyReason());
}
} else if (masterVersion > 1 && statusInfo.hasAutoPilotReady()) {//如果 maser version 大于1还需要判断AutoPilotReady字段是否存在以确保MAP版本和SSM Maser版本不陪配情况逻辑能正常执行
isAutopilotAbility = statusInfo.getAutoPilotReady();
if (!isAutopilotAbility) {
int count = statusInfo.getAutoPilotUnreadyListCount();
if (count > 0) {
for (int i = 0; i < count; i++) {
SsmInfo.NodeInf info = statusInfo.getAutoPilotUnreadyList(i);
String nodeName = info.getNodeName();
int state = info.getState().getNumber();
if (state < AutopilotAbilityManager.NODE_INFO_STATE_FIXED_FREQUENCY.length) {
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, nodeName + AutopilotAbilityManager.NODE_INFO_STATE_FIXED_FREQUENCY[state]);
} else {
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, nodeName + "未知异常");
}
}
} else {
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, "未知异常节点");
}
}
} else {
SsmInfo.ModeState modeState = statusInfo.getModeState();
if (modeState != SsmInfo.ModeState.MODE_RUN_UNREADY && modeState != SsmInfo.ModeState.MODE_RUN_READY) {
isAutopilotAbility = false;
String unableAutopilotReason = null;
if (modeState == SsmInfo.ModeState.MODE_STOP_UNREADY) {
unableAutopilotReason = "系统处于停止模式(未就绪)";
} else if (modeState == SsmInfo.ModeState.MODE_STOP_READY) {
unableAutopilotReason = "系统处于停止模式";
} else if (modeState == SsmInfo.ModeState.MODE_IDLE_UNREADY) {
unableAutopilotReason = "系统处于空闲模式(未就绪)";
} else if (modeState == SsmInfo.ModeState.MODE_IDLE_READY) {
unableAutopilotReason = "系统处于空闲模式";
} else {
unableAutopilotReason = "未知系统模式";
}
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, unableAutopilotReason);
}
}
} else {
isAutopilotAbility = false;//是否能启动自动驾驶
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.LIB, "SSM数据异常");
}
if (fsmStatusReasonRespond != null) {
int count = fsmStatusReasonRespond.getFsmStatusReasonRespondCount();
if (count > 0) {
isAutopilotAbility = false;
for (int i = 0; i < count; i++) {
String respond = fsmStatusReasonRespond.getFsmStatusReasonRespond(i);
if (!TextUtils.isEmpty(respond)) {
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.FSM, respond);
}
}
if (unableAutopilotReasons == null || unableAutopilotReasons.isEmpty()) {
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.LIB, "FSM数据异常");
}
}
}
if (listener != null) {
listener.onAutopilotAbility(isAutopilotAbility, unableAutopilotReasons);
}
}
protected void start(OnAutopilotAbilityListener listener) {
this.listener = listener;
}
protected void stop() {
this.masterVersion = -1;
this.listener = null;
}
}

View File

@@ -2,6 +2,7 @@ package com.zhidao.support.adas.high.common.autopilot.ability;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import androidx.annotation.Nullable;
@@ -20,6 +21,7 @@ import chassis.Chassis;
import chassis.ChassisStatesOuterClass;
import function_state_management.FSMStatusReasonQueryOuterClass;
import mogo.telematics.pad.MessagePad;
import system_master.SsmInfo;
import system_master.SystemStatusInfo;
/**
@@ -29,21 +31,26 @@ import system_master.SystemStatusInfo;
* <p>
* 此定时器不能停止 鹰眼中存在UI更新依赖循环查询系统状态
*/
public class AutopilotAbilityManager implements AutopilotAbility230.OnAutopilotAbilityListener, AutopilotAbility250.OnAutopilotAbilityListener, AutopilotAbility330.OnAutopilotAbilityListener {
public class AutopilotAbilityManager implements AutopilotAbility230.OnAutopilotAbilityListener, AutopilotAbility250.OnAutopilotAbilityListener, AutopilotAbility330.OnAutopilotAbilityListener, AutopilotAbility350And360.OnAutopilotAbilityListener, AutopilotAbility360.OnAutopilotAbilityListener {
private static final String TAG = AutopilotAbilityManager.class.getSimpleName();
protected static final int WHAT_TIMEOUT = 0;
protected static final int DEFAULT_TIMEOUT = 2500;
protected static final long DEFAULT_DETECTION_TIME = 3 * 1000L;//默认检测周期
protected static final String[] NODE_INFO_STATE = {"未知状态 ", "依赖未就绪 ", "启动中 ", "运行 ", "停止 ", "无法启动状态 ", "人为启动状态 ", "人为关闭状态 "};
protected static final String[] NODE_INFO_STATE = {"未知状态", "依赖未就绪", "启动中", "运行", "停止", "无法启动状态", "人为启动状态", "人为关闭状态"};
protected static final String[] NODE_INFO_STATE_FIXED_FREQUENCY = {"未知状态", "依赖未就绪", "启动中", "运行", "停止", "无法启动状态", "非自动启动状态", "非自动关闭状态"};
private static volatile AutopilotAbilityManager INSTANCE;
private OnAdasListener listener;
private Handler handler;
private OnAutopilotAbilityListener onAutopilotAbilityListener;
private int mapVersion = -1;//工控机版本
private boolean isFutianSweeper = false;//是否是福田清扫车
private boolean isJinlvM1 = false;//是否是M1
private boolean isHQ = false;//是否是HQ
private AutopilotAbility230 autopilotAbility230;
private AutopilotAbility250 autopilotAbility250;
private AutopilotAbility330 autopilotAbility330;
private AutopilotAbility350And360 autopilotAbility350And360;
private AutopilotAbility360 autopilotAbility360;
private Timer startTimer;
/**
* 不能启动自动驾驶的档位
@@ -106,6 +113,8 @@ public class AutopilotAbilityManager implements AutopilotAbility230.OnAutopilotA
public void setCarConfig(MessagePad.CarConfigResp carConfig) {
mapVersion = carConfig.getMapVersion();
isFutianSweeper = carConfig.getIsFutianSweeper();
isJinlvM1 = carConfig.getIsJinlvM1();
isHQ = carConfig.getIsHQ();
if (mapVersion != -1) {
stopTimer();
CupidLogUtils.i(TAG, "工控机版本=" + mapVersion);
@@ -171,6 +180,15 @@ public class AutopilotAbilityManager implements AutopilotAbility230.OnAutopilotA
}
}
public void setStatusInfo(SsmInfo.SsmStatusInf statusInfo) {
if (autopilotAbility350And360 != null) {
autopilotAbility350And360.setStatusInfo(statusInfo);
}
if (autopilotAbility360 != null) {
autopilotAbility360.setStatusInfo(statusInfo);
}
}
/**
* 底盘状态更新
*
@@ -183,6 +201,9 @@ public class AutopilotAbilityManager implements AutopilotAbility230.OnAutopilotA
if (autopilotAbility250 != null) {
autopilotAbility250.setChassisStates(chassisStates);
}
if (autopilotAbility350And360 != null) {
autopilotAbility350And360.setChassisStates(chassisStates);
}
}
/**
@@ -194,6 +215,9 @@ public class AutopilotAbilityManager implements AutopilotAbility230.OnAutopilotA
if (autopilotAbility330 != null) {
autopilotAbility330.setFsmStatusReasonRespond(fsmStatusReasonRespond);
}
if (autopilotAbility360 != null) {
autopilotAbility360.setFsmStatusReasonRespond(fsmStatusReasonRespond);
}
}
public void onHandleMessage(Message msg) {
@@ -208,27 +232,54 @@ public class AutopilotAbilityManager implements AutopilotAbility230.OnAutopilotA
}
private void initAutopilotAbility() {
//目前只有MAP330的清扫车用的新的FSM状态原因查询
if (mapVersion >= 30300 && isFutianSweeper) {
CupidLogUtils.i(TAG, "是否可以启动自动驾驶能力检测使用330版本");
if (mapVersion >= 30600 && isFutianSweeper) {
Log.i(TAG, "能否启动自驾能力检测使用版本360清扫车专用");
stop230();
stop250();
stop330();
stop350And360();
if (autopilotAbility360 == null) {
autopilotAbility360 = new AutopilotAbility360();
autopilotAbility360.start(this);
}
} else if ((mapVersion >= 30500 && (isJinlvM1 || isHQ)) || mapVersion >= 30600) {
Log.i(TAG, "能否启动自驾能力检测使用版本350和360共用");
stop230();
stop250();
stop330();
stop360();
if (autopilotAbility350And360 == null) {
autopilotAbility350And360 = new AutopilotAbility350And360();
autopilotAbility350And360.start(this);
}
} else if (mapVersion >= 30300 && isFutianSweeper) {//目前只有MAP330的清扫车用的新的FSM状态原因查询
Log.i(TAG, "能否启动自驾能力检测使用版本330清扫车专用");
stop230();
stop250();
stop350And360();
stop360();
if (autopilotAbility330 == null) {
autopilotAbility330 = new AutopilotAbility330(mapVersion);
autopilotAbility330.start(this);
}
} else if (mapVersion >= 20500) {
CupidLogUtils.i(TAG, "是否可以启动自动驾驶能力检测使用250版本");
Log.i(TAG, "能否启动自驾能力检测使用版本:250");
stop230();
stop330();
stop350And360();
stop360();
if (autopilotAbility250 == null) {
autopilotAbility250 = new AutopilotAbility250(mapVersion);
autopilotAbility250.start(this);
}
} else {
CupidLogUtils.i(TAG, "是否可以启动自动驾驶能力检测使用230版本");
Log.i(TAG, "能否启动自驾能力检测使用版本:230");
stop250();
stop330();
stop350And360();
stop360();
if (autopilotAbility230 == null) {
autopilotAbility230 = new AutopilotAbility230();
autopilotAbility230.start(this);
@@ -258,6 +309,20 @@ public class AutopilotAbilityManager implements AutopilotAbility230.OnAutopilotA
}
}
private void stop350And360() {
if (autopilotAbility350And360 != null) {
autopilotAbility350And360.stop();
autopilotAbility350And360 = null;
}
}
private void stop360() {
if (autopilotAbility360 != null) {
autopilotAbility360.stop();
autopilotAbility360 = null;
}
}
private void stopTimer() {
if (startTimer != null) {
startTimer.cancel();
@@ -280,7 +345,7 @@ public class AutopilotAbilityManager implements AutopilotAbility230.OnAutopilotA
initAutopilotAbility();
}
}
}, 8000L);//延迟执行,避免刚连接成功后底盘信息无法及时同步
}, 8000L);//8秒原因需要后去CarConfig 对象两个地方调用initAutopilotAbility(); 初始化 一个在这另一个在setCarConfig(),如果setCarConfig() 证明获取版本还未成功获取版本会重试3次每次间隔两秒
}
}
@@ -290,9 +355,13 @@ public class AutopilotAbilityManager implements AutopilotAbility230.OnAutopilotA
stop230();
stop250();
stop330();
stop350And360();
stop360();
handler = null;
mapVersion = -1;
isFutianSweeper = false;
isHQ = false;
isJinlvM1 = false;
}
}

View File

@@ -30,6 +30,7 @@ public class MyMessageFactory implements IMyMessageFactory {
private IMsg warnMessage;//预警数据
private IMsg arrivalNotificationMessage;//到站提醒
private IMsg statusQueryRespMessage;//状态查询应答
private IMsg systemStatusMessage;//定频SSM
private IMsg recordDataConfigRespMessage;//数据采集配置应答
private IMsg planningDecisionStateMessage;//planning决策状态
private IMsg obuWarningDataMessage;//工控机透传OBU V2I数据
@@ -161,6 +162,12 @@ public class MyMessageFactory implements IMyMessageFactory {
statusQueryRespMessage = new StatusQueryRespMessage();
}
return statusQueryRespMessage;
} else if (messageType == MessageType.TYPE_RECEIVE_SSM.typeCode) {
//定频SSM
if (systemStatusMessage == null) {
systemStatusMessage = new SystemStatusMessage();
}
return systemStatusMessage;
} else if (messageType == MessageType.TYPE_RECEIVE_RECORD_DATA_CONFIG_RESP.typeCode) {
//数据采集配置应答
if (recordDataConfigRespMessage == null) {

View File

@@ -14,6 +14,7 @@ import system_master.SystemStatusInfo;
/**
* 状态查询应答
*/
@Deprecated//HQ、M1 MAP350开始弃用其他车型MAP360开始弃用
public class StatusQueryRespMessage extends MyAbstractMessageHandler {
@Override

View File

@@ -0,0 +1,33 @@
package com.zhidao.support.adas.high.msg;
import android.os.SystemClock;
import com.google.protobuf.InvalidProtocolBufferException;
import com.zhidao.support.adas.high.AdasChannel;
import com.zhidao.support.adas.high.OnAdasListener;
import com.zhidao.support.adas.high.common.CupidLogUtils;
import com.zhidao.support.adas.high.common.autopilot.ability.AutopilotAbilityManager;
import com.zhidao.support.adas.high.protocol.RawData;
import system_master.SsmInfo;
/**
* 定频SSM 接口
*/
public class SystemStatusMessage extends MyAbstractMessageHandler {
@Override
public void handlerMsg(RawData raw, OnAdasListener adasListener) throws InvalidProtocolBufferException {
SsmInfo.SsmStatusInf statusInfo = SsmInfo.SsmStatusInf.parser().parseFrom(raw.originalData.toByteArray(), raw.getOffsetValue(), raw.getPackageLengthValue() - raw.getOffsetValue());
AdasChannel.calculateTimeConsumingOnDispatchRaw("定频SSM", raw.receiveTime);
AutopilotAbilityManager.getInstance().setStatusInfo(statusInfo);
long nowTime = 0;
if (CupidLogUtils.isEnableLog())
nowTime = SystemClock.elapsedRealtime();
if (adasListener != null) {
adasListener.onSystemStatus(raw.getHeader(), statusInfo);
}
AdasChannel.calculateTimeConsumingBusiness("定频SSM", nowTime);
}
}