Merge branch 'dev_robobus-d_230707_3.3.2' into dev_saasbus-d_230607_from3.2.0

This commit is contained in:
wangmingjun
2023-07-07 18:17:43 +08:00
17 changed files with 214 additions and 36 deletions

View File

@@ -270,14 +270,16 @@ class PM2DrivingModel private constructor() {
d(SceneConstant.M_BUS_P + TAG, "可以接受轨迹")
}
d(SceneConstant.M_BUS_P + TAG, "接受轨迹中")
updateRoutePoints(it.wayPointsList)
it.wayPointsList?.let {list->
updateRoutePoints(list)
}
}
}
}
@Synchronized
fun updateRoutePoints(routePoints: List<MessagePad.Location>?) {
fun updateRoutePoints(routePoints: List<MessagePad.Location>) {
mRoutePoints.clear()
val latLngModels = CoordinateCalculateRouteUtil
.coordinateConverterWgsToGcjLocations(mContext, routePoints)
@@ -487,7 +489,7 @@ class PM2DrivingModel private constructor() {
.getArrivedPointIndexNew(
mWipePreIndex,
mRoutePoints,
mLocation
mLocation!!
)
mWipePreIndex = haveArrivedIndex
d(SceneConstant.M_BUS_P + TAG,
@@ -518,7 +520,7 @@ class PM2DrivingModel private constructor() {
if (mTwoStationsRouts.size > 0 && mLocation != null) {
val lastPointsMap = CoordinateCalculateRouteUtil
.getRemainPointListByCompareNew(mPreRouteIndex, mTwoStationsRouts, mLocation)
.getRemainPointListByCompareNew(mPreRouteIndex, mTwoStationsRouts, mLocation!!)
for (index in lastPointsMap.keys) {
mPreRouteIndex = index
break

View File

@@ -22,6 +22,7 @@ import com.mogo.och.sweepercloud.ui.dialog.SweeperCloudLoadingDialog
import com.mogo.och.sweepercloud.util.SweeperCloudTaskUtils.createConfirmStartSubTaskDialog
import com.mogo.och.sweepercloud.util.SweeperCloudTaskUtils.createReceivedTaskInfoDialog
import com.mogo.och.sweepercloud.util.SweeperCloudTaskUtils.createSweeperTaskEndDialog
import com.mogo.och.sweepercloud.util.SweeperCloudTaskUtils.createSweeperTaskExceptionEndDialog
import com.mogo.och.sweepercloud.util.SweeperCloudTaskUtils.createSweeperTaskNormalEndDialog
import com.mogo.och.sweepercloud.util.SweeperCloudTaskUtils.printMessage
import com.mogo.och.sweepercloud.view.SweeperCurrentTaskInfoView
@@ -121,6 +122,11 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
}
}
override fun setAutoState(state: Int) {
super.setAutoState(state)
getCurrentView().updateStartAutoPilotBtnState(state)
}
fun onSweeperFutianCleanSystemState(cleanSystemState: ChassisStatesOuterClass.SweeperFuTianTaskSystemStates) {
mCleanSystemState = cleanSystemState
sweeper_cl_work_mode.setSweeperFutianCleanSystemState(mSubTaskType, cleanSystemState)
@@ -338,6 +344,32 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
})
}
/**
* 大任务异常结束弹窗(异常 / 取消)
*/
private fun sweeperCloudTaskExceptionEndDialog(isCancel: Boolean): SweeperCloudDialog? {
return createSweeperTaskExceptionEndDialog(context, object : SweeperCloudDialogClickListener {
override fun onConfirm() {
ToastUtils.showLong("任务已结束")
resetTaskInfoPanel()
}
override fun onRefuseOrEnd() {
}
override fun onCountDownStop() {
ToastUtils.showLong("任务已结束")
resetTaskInfoPanel()
}
override fun onNext() {
}
}, isCancel)
}
/**
* 云端同步大任务状态
*/
@@ -356,7 +388,11 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
if (mDialog != null && mDialog!!.isShowing) {
return
}
mDialog = sweeperCloudTaskNormalEndDialog()
mDialog = if (subTaskStatus == SweeperBigTaskStatus.BigTaskStatus.CANCLE
|| subTaskStatus == SweeperBigTaskStatus.BigTaskStatus.ABNORMAL)
sweeperCloudTaskExceptionEndDialog(subTaskStatus == SweeperBigTaskStatus.BigTaskStatus.CANCLE)
else
sweeperCloudTaskNormalEndDialog()
mDialog?.show()
showNotice("任务已结束")
}

View File

@@ -660,13 +660,11 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
@Override
public void onAutopilotStatusResponse(int state) {
IMoGoAutopilotStatusListener.super.onAutopilotStatusResponse(state);
// TODO: 2023/6/19 bingbing
}
@Override
public void onAutopilotDockerInfo(@NonNull String dockerVersion) {
IMoGoAutopilotStatusListener.super.onAutopilotDockerInfo(dockerVersion);
// TODO: 2023/6/19 bingbing
}
}

View File

@@ -337,6 +337,27 @@ object SweeperCloudTaskUtils {
return context?.let { it1 -> builder.build(it1) }
}
/**
* 任务异常结束弹窗 (异常 / 取消)
*/
@JvmStatic
fun createSweeperTaskExceptionEndDialog(
context: Context?,
listener: SweeperCloudDialogClickListener?,
isCancel: Boolean
): SweeperCloudDialog? {
var builder: SweeperCloudDialog.Builder = SweeperCloudDialog.Builder()
builder.titleStr = "任务结束"
builder.contentStr = if (isCancel) "任务已取消!" else "任务已异常结束!"
builder.tipStr = ""
builder.leftStr = "确认"
builder.middleStr = ""
builder.rightStr = ""
builder.countDownTime = 10
builder.listener = listener
return context?.let { it1 -> builder.build(it1) }
}
@JvmStatic
fun printMessage(message: MessageOrBuilder): String {
return "\n"+TextFormat.printer().escapingNonAscii(false).printToString(message)

View File

@@ -1,11 +1,13 @@
package com.mogo.och.sweepercloud.view
import android.content.Context
import android.graphics.Color
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import android.widget.TextView
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.och.common.module.utils.DateTimeUtil
import com.mogo.och.sweepercloud.R
import com.zhjt.mogo.adas.data.sweeper.common.SweeperCommon.TaskStatus
@@ -27,8 +29,20 @@ class SweeperCurrentTaskInfoView : ConstraintLayout {
initView(context)
}
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {}
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) {}
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(
context,
attrs,
defStyleAttr
) {
}
constructor(
context: Context,
attrs: AttributeSet?,
defStyleAttr: Int,
defStyleRes: Int
) : super(context, attrs, defStyleAttr, defStyleRes) {
}
private fun initView(context: Context) {
LayoutInflater.from(context).inflate(R.layout.sweeper_current_task_info, this)
@@ -39,6 +53,34 @@ class SweeperCurrentTaskInfoView : ConstraintLayout {
return tvStartAuto
}
/**
* 根据当前自动驾驶状态,更新【请求进入自动驾驶】按钮样式
*/
fun updateStartAutoPilotBtnState(autopilotState: Int) {
when (autopilotState) {
//不可自动驾驶
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE -> {
tvStartAuto.setTextColor(Color.parseColor("#66FFFFFF"))
tvStartAuto.isSelected = false
}
//人工驾驶
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE -> {
tvStartAuto.setTextColor(Color.parseColor("#FFFFFFFF"))
tvStartAuto.isSelected = true
}
//自动驾驶中
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING -> {
tvStartAuto.setTextColor(Color.parseColor("#66FFFFFF"))
tvStartAuto.isSelected = false
}
//平行驾驶
IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING -> {
tvStartAuto.setTextColor(Color.parseColor("#66FFFFFF"))
tvStartAuto.isSelected = false
}
}
}
/**
* 设置当前任务数据
*/
@@ -51,12 +93,13 @@ class SweeperCurrentTaskInfoView : ConstraintLayout {
tvTaskName.text = taskName
val calendarStart = DateTimeUtil.formatLongToCalendar(taskStartTime)
val calendarEnd = DateTimeUtil.formatLongToCalendar(taskEndTime)
tvTaskTime.text = "${DateTimeUtil.formatCalendarToString(calendarStart, DateTimeUtil.HH_mm)}-${
DateTimeUtil.formatCalendarToString(
calendarEnd,
DateTimeUtil.HH_mm
)
}"
tvTaskTime.text =
"${DateTimeUtil.formatCalendarToString(calendarStart, DateTimeUtil.HH_mm)}-${
DateTimeUtil.formatCalendarToString(
calendarEnd,
DateTimeUtil.HH_mm
)
}"
}
listTask?.let {
//特殊处理当前暂无执行中任务的情况
@@ -75,10 +118,10 @@ class SweeperCurrentTaskInfoView : ConstraintLayout {
*/
private fun setSubTaskState(isWorking: Boolean) {
if (isWorking) {
tvTaskState.text = "正在作业"
tvTaskState.text = "任务执行中"
tvTaskState.setBackgroundResource(R.drawable.bg_shape_task_state_working)
} else {
tvTaskState.text = "暂未准备"
tvTaskState.text = "任务待开始"
tvTaskState.setBackgroundResource(R.drawable.bg_shape_task_state_not_ready)
}
}

View File

@@ -1,10 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<item android:state_selected="true">
<shape android:shape="rectangle">
<corners android:bottomRightRadius="30dp" android:bottomLeftRadius="@dimen/dp_30"/>
<corners android:bottomLeftRadius="@dimen/dp_30" android:bottomRightRadius="@dimen/dp_30" />
<gradient android:angle="180" android:endColor="#2F6EFF" android:startColor="#20AAFF" />
</shape>
</item>
<item android:state_selected="false">
<shape>
<solid android:color="#4D2F6EFF" />
<corners android:bottomLeftRadius="@dimen/dp_30" android:bottomRightRadius="@dimen/dp_30" />
</shape>
</item>
</selector>

View File

@@ -26,7 +26,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_36"
android:layout_marginTop="@dimen/dp_20"
android:text="当前作业模式:"
android:text="当前上装模式:"
android:textColor="@color/white"
android:textSize="@dimen/dp_32"
app:layout_constraintStart_toStartOf="parent"

View File

@@ -322,6 +322,7 @@ class MoGoAutopilotControlProvider :
CallerLogger.d("$M_D_C$TAG", "结束记录包: [$cmdId, $result]")
}
@ChainLog(
linkChainLog = AdasChain.CHAIN_TYPE_SOCKET_AUTOPILOT,
linkCode = AdasChain.CHAIN_SOURCE_ADAS,
@@ -329,14 +330,42 @@ class MoGoAutopilotControlProvider :
paramIndexes = [0]
)
override fun startAutoPilot(controlParameters: AutopilotControlParameters) {
startAutoPilot(controlParameters, Constants.AUTOPILOT_SOURCE.PAD)
}
//todo chainlog
override fun startAutoPilotByMoFang(controlParameters: AutopilotControlParameters?) {
if (controlParameters==null){
startAutoPilotWithNoParameter(Constants.AUTOPILOT_SOURCE.MO_FANG)
}else{
startAutoPilot(controlParameters, Constants.AUTOPILOT_SOURCE.MO_FANG)
}
}
private fun startAutoPilotWithNoParameter(source: Int) {
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
val invokeResult = AdasManager.getInstance()
.sendAutoPilotModeReq(1, 1, controlParameters.toRouteInfo())
.sendAutoPilotModeReq(1, source, null)
invokeAutoPilotResult(if (invokeResult) "无参自动驾驶调用成功" else "自动驾驶调用失败, socket 或者 rawPack 可能为空")
} else {
if (AdasManager.getInstance().ipcConnectionStatus == IPC_CONNECTION_STATUS.CONNECTED) {
val invokeResult = AdasManager.getInstance()
.sendAutoPilotModeReq(1, source, null)
invokeAutoPilotResult(if (invokeResult) "无参自动驾驶调用成功" else "自动驾驶调用失败, socket 或者 rawPack 可能为空")
} else {
invokeAutoPilotResult("车机与工控机链接失败,无法开启自动驾驶 无参")
CallerLogger.e("$M_D_C$TAG", "车机与工控机链接失败,无法开启自动驾驶")
}
}
}
private fun startAutoPilot(controlParameters: AutopilotControlParameters, source: Int) {
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
val invokeResult = AdasManager.getInstance()
.sendAutoPilotModeReq(1, source, controlParameters.toRouteInfo())
invokeAutoPilotResult(if (invokeResult) "自动驾驶调用成功" else "自动驾驶调用失败, socket 或者 rawPack 可能为空")
} else {
if (AdasManager.getInstance().ipcConnectionStatus == IPC_CONNECTION_STATUS.CONNECTED) {
val invokeResult = AdasManager.getInstance()
.sendAutoPilotModeReq(1, 1, controlParameters.toRouteInfo())
.sendAutoPilotModeReq(1, source, controlParameters.toRouteInfo())
invokeAutoPilotResult(if (invokeResult) "自动驾驶调用成功" else "自动驾驶调用失败, socket 或者 rawPack 可能为空")
} else {
invokeAutoPilotResult("车机与工控机链接失败,无法开启自动驾驶")

View File

@@ -99,6 +99,7 @@ class ChainConstant {
//operation by user
const val CHAIN_CODE_OCH_TAXI_START_AUTOPILOT = "CHAIN_CODE_OCH_TAXI_START_AUTOPILOT"
const val CHAIN_CODE_OCH_TAXI_START_AUTOPILOT_MOFANG = "CHAIN_CODE_OCH_TAXI_START_AUTOPILOT_MOFANG"
const val CHAIN_CODE_OCH_COMMON_DISTANCE = "CHAIN_CODE_OCH_COMMON_DISTANCE"
const val CHAIN_CODE_EAGLE_START_AUTOPILOT = "CHAIN_CODE_EAGLE_START_AUTOPILOT"
const val CHAIN_CODE_EAGLE_START_AUTOPILOT_RESULT = "CHAIN_CODE_EAGLE_START_AUTOPILOT_RESULT"

View File

@@ -38,6 +38,13 @@ interface IMoGoAutopilotControlProvider : IMoGoFunctionServerProvider {
*/
fun startAutoPilot(controlParameters: AutopilotControlParameters)
/**
* 开启自动驾驶(魔方)
*
* @param controlParameters 开启自动驾驶的控制参数
*/
fun startAutoPilotByMoFang(controlParameters: AutopilotControlParameters?)
/**
* 给工控机透出路口红绿灯信息
*/

View File

@@ -7,10 +7,10 @@ import com.mogo.eagle.core.data.deva.badcase.BagManagerEntity
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_EAGLE_START_AUTOPILOT
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_SOURCE_ADAS
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_SOCKET_AUTOPILOT
import com.mogo.eagle.core.data.biz.trafficlight.TrafficLightResult
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_OCH_TAXI_START_AUTOPILOT_MOFANG
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotControlProvider
import com.mogo.eagle.core.function.call.base.CallerBase
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
@@ -71,6 +71,23 @@ object CallerAutoPilotControlManager {
CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(controlParameters)
}
/**
* 开启自动驾驶
*
* @param controlParameters 开启自动驾驶的控制参数
*/
@ChainLog(
linkChainLog = CHAIN_TYPE_SOCKET_AUTOPILOT,
linkCode = CHAIN_SOURCE_ADAS,
nodeAliasCode = CHAIN_CODE_OCH_TAXI_START_AUTOPILOT_MOFANG,
paramIndexes = [0],
)
fun startAutoPilotByMoFang(controlParameters: AutopilotControlParameters?) {
providerApi?.startAutoPilotByMoFang(controlParameters)
// 更新记录在全局的控制参数
CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(controlParameters)
}
/**
* 发送红绿灯数据至工控机
*/

View File

@@ -155,9 +155,9 @@ MATRIX_VERSION=2.0.8
# 测试模式司机端版本号
NOOP_DRIVER_VERSION=3.2.0
# 公交模式司机端版本号
BUS_DRIVER_VERSION=3.3.0
BUS_DRIVER_VERSION=3.3.2
# 公交模式乘客端端版本号
BUS_PASSENGER_VERSION=2.3.0
BUS_PASSENGER_VERSION=2.3.2
# 接驳模式司机端版本号
SHUTTLE_DRIVER_VERSION=3.2.0
# 接驳模式乘客端端版本号
@@ -171,6 +171,6 @@ CHARTER_DRIVER_VERSION=3.1.0
# 包车模式乘客端端版本号
CHARTER_PASSENGER_VERSION=2.2.0
# 支持云控清扫车模式司机端版本号
SWEEPERCLOUD_DRIVER_VERSION=3.1.0
SWEEPERCLOUD_DRIVER_VERSION=3.1.4
# 清扫车模式司机端版本号
SWEEPEROPERATE_DRIVER_VERSION=3.1.0

View File

@@ -296,7 +296,7 @@ message RouteInfo
message SetAutopilotModeReq
{
uint32 mode = 1; //1: enter autopilot mode, 0: quit autopilot mode
uint32 source = 2; //命令来源: 0: pad模拟, 1: pad业务, 2:aicloud
uint32 source = 2; //命令来源: 0: pad模拟, 1: pad业务, 2:aicloud, 3:魔方(清扫车MAP Version==332以及MAP Version>=350其他车型目前未上线)
RouteInfo routeInfo = 3; //自动驾驶路径信息
}
@@ -597,13 +597,13 @@ message PlanningActionMsg
//message definition for MsgTypeSetParamReq
message SetOneParam
{
uint32 type = 1; // 0:default 1:绕障类功能开关(bool) 2:变道绕障的目标障碍物速度阈值(double, m/s)
uint32 type = 1; // 0:default 1:绕障类功能开关(bool) 2:变道绕障的目标障碍物速度阈值(double, m/s)
// 3:AEB开关(bool) 0:关闭自动紧急制动功能 1:启用自动紧急制动功能
// 4:限制绕障开关(bool) 0:正常绕障 1限制绕障 默认0
// 5:停车让行线前避让等待开关(bool) 0:停车让行线前无需等待 1:停车让行线前需要等待 默认0
// 6:地图限速功能开关(bool) 0:不使用地图限速功能 1:使用地图限速功能 默认0
// 7:环岛模式开关(bool) 0:普通模式 1:环岛模式 默认0
// 8:弱网减速停车策略开关(bool) 0:关闭弱网减速停车策略 1:使用弱网减速停车策略
// 8:弱网减速停车策略开关(bool) 0:关闭弱网减速停车策略 1:使用弱网减速停车策略
// 9:m1拼接视频自车位置参数(string), 格式:x,y,width,height
string value = 2; // 转成字符串的值
}
@@ -700,6 +700,3 @@ message SessionInfo
uint64 connectedTimeStamp = 4;
string version = 5;
}

View File

@@ -837,7 +837,7 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
* 设置自动驾驶模式 启动自动驾驶
*
* @param mode 1: enter autopilot mode, 0: quit autopilot mode
* @param source 命令来源: 0: pad模拟(模拟时routeInfo传null), 1: AICloud业务
* @param source 命令来源: 0: pad模拟, 1: pad业务, 2:aicloud, 3:魔方(清扫车MAP Version==332以及MAP Version>=350其他车型目前未上线)
* @param routeInfo 自动驾驶路径信息
* @return boolean
*/

View File

@@ -299,7 +299,7 @@ public class AdasManager implements IAdasNetCommApi {
* 设置自动驾驶模式 启动自动驾驶
*
* @param mode 1: enter autopilot mode, 0: quit autopilot mode
* @param source 命令来源: 0: pad模拟(模拟时routeInfo传null), 1: AICloud业务
* @param source 命令来源: 0: pad模拟, 1: pad业务, 2:aicloud, 3:魔方(清扫车MAP Version==332以及MAP Version>=350其他车型目前未上线)
* @param routeInfo 自动驾驶路径信息
* @return
*/

View File

@@ -87,7 +87,7 @@ public interface IAdasNetCommApi {
* 设置自动驾驶模式 启动自动驾驶
*
* @param mode 1: enter autopilot mode, 0: quit autopilot mode
* @param source 命令来源: 0: pad模拟(模拟时routeInfo传null), 1: AICloud业务
* @param source 命令来源: 0: pad模拟, 1: pad业务, 2:aicloud, 3:魔方(清扫车MAP Version==332以及MAP Version>=350其他车型目前未上线)
* @param routeInfo 自动驾驶路径信息
* @return 加入WS发送消息队列是否成功
*/

View File

@@ -120,4 +120,26 @@ public class Constants {
int OLD_CHASSIS = 1;//老底盘
}
/**
* 启动自动驾驶-Source类型
*/
public interface AUTOPILOT_SOURCE {
/**
* pad模拟
*/
int PAD_SIMULATE = 0;
/**
* pad业务
*/
int PAD = 1;
/**
* AICloud
*/
int AI_CLOUD = 2;
/**
* 魔方
*/
int MO_FANG = 3;
}
}