Merge branch 'dev_robotaxi-d-app-module_2110_220915_2.11.0' into 'test_robotaxi-d-app-module_2110_220915_2.11.0.1'
Dev robotaxi d app module 2110 220915 2.11.0 See merge request zhjt/AndroidApp/MoGoEagleEye!247
This commit is contained in:
@@ -396,7 +396,7 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
|
||||
if (isAnimateRunning){
|
||||
stopAutopilotAnimation();
|
||||
}
|
||||
mPresenter.autoDriveToNextStation(false);
|
||||
mPresenter.autoDriveToNextStation();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
@@ -52,6 +53,7 @@ import com.mogo.och.bus.util.BusAnalyticsManager;
|
||||
import com.mogo.och.bus.util.BusTrajectoryManager;
|
||||
import com.mogo.och.common.module.biz.constant.OchCommonConst;
|
||||
import com.mogo.och.common.module.biz.provider.LoginService;
|
||||
import com.mogo.och.common.module.manager.OCHAdasAbilityManager;
|
||||
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil;
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil;
|
||||
import com.mogo.och.common.module.utils.PinYinUtil;
|
||||
@@ -85,8 +87,6 @@ public class BusOrderModel {
|
||||
public double mLongitude = 0;
|
||||
public double mLatitude = 0;
|
||||
private Context mContext;
|
||||
private Disposable mBusOrdersDisposable; //定时轮询小巴车订单
|
||||
private List<String> prevBusOrderNos = new ArrayList<>();
|
||||
private final List<BusStationBean> stationList = new ArrayList<>();
|
||||
private BusRoutesResult busRoutesResult = null;
|
||||
/**
|
||||
@@ -107,6 +107,9 @@ public class BusOrderModel {
|
||||
|
||||
private volatile boolean isArrivedStation = false;
|
||||
|
||||
//0: 代表没有启动过 1代表是启动第一次,当>=1 代表是重试 每次到站/路线结束清空置为0
|
||||
private volatile int firstStartAutopilot = 0;
|
||||
|
||||
private LoginService loginService;
|
||||
|
||||
private long prePassengerWriteOffTime = 0; //记录最后查询到乘客核销的时间
|
||||
@@ -274,9 +277,7 @@ public class BusOrderModel {
|
||||
}
|
||||
|
||||
public void release(){
|
||||
if (mBusOrdersDisposable != null) {
|
||||
mBusOrdersDisposable.dispose();
|
||||
}
|
||||
|
||||
startOrStopOrderLoop(false);
|
||||
startOrStopQueryPassengerWriteOff(false);
|
||||
MogoApisHandler.getInstance()
|
||||
@@ -373,6 +374,8 @@ public class BusOrderModel {
|
||||
refreshBusStationsCallback.updateEmptyUi();
|
||||
}
|
||||
clearAutopilotControlParameters();
|
||||
closeBeautificationMode();
|
||||
clearStartAutopilotTag();
|
||||
return;
|
||||
}
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG, "获取到小巴路线数据: " + data );
|
||||
@@ -470,11 +473,13 @@ public class BusOrderModel {
|
||||
* 服务端返回的OchBusRoutesResult逻辑, 离开站为当前站, 到达下一站后才会将下一站置为当前站,
|
||||
* 车机端展示是离开当前站,下一站设置为当前站, 所以服务端数据回来要做处理,不能直接渲染
|
||||
*/
|
||||
private void leaveStationSuccess(boolean isRestart) {
|
||||
private void leaveStationSuccess() {
|
||||
//开启自动驾驶 2.10.0: 如果自动驾驶状态下开启, 非自动驾驶状态下不开启,需手动点击自动驾驶按钮开启
|
||||
if (isRestart || CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState()
|
||||
if (CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState()
|
||||
== IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING){
|
||||
startAutopilot(isRestart);
|
||||
startAutopilot(false);
|
||||
}else {
|
||||
firstStartAutopilot = 0;
|
||||
}
|
||||
|
||||
if (isGoingToNextStation) {
|
||||
@@ -497,6 +502,14 @@ public class BusOrderModel {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!FunctionBuildConfig.isDemoMode && !OCHAdasAbilityManager.getInstance().getAutopilotAbilityStatus()){
|
||||
ToastUtils.showLong(OCHAdasAbilityManager.getInstance().getAutopilotUnAbilityReason() +
|
||||
", 请稍候重试");
|
||||
return;
|
||||
}
|
||||
|
||||
firstStartAutopilot ++;
|
||||
|
||||
triggerStartServiceEvent(isRestart, false);
|
||||
|
||||
BusStationBean currentStation = stationList.get( backgroundCurrentStationIndex);
|
||||
@@ -511,7 +524,8 @@ public class BusOrderModel {
|
||||
CallerAutoPilotManager.INSTANCE.startAutoPilot(parameters);
|
||||
|
||||
CallerLogger.INSTANCE.d( M_BUS + TAG, "开启自动驾驶====" + GsonUtil.jsonFromObject(parameters)
|
||||
+" startLatLon="+currentStation.getName()+",endLatLon="+nextStation.getName());
|
||||
+" startLatLon="+currentStation.getName()+",endLatLon="+nextStation.getName() +
|
||||
"isRestart = " + isRestart);
|
||||
|
||||
if (mControllerStatusCallback != null) {
|
||||
mControllerStatusCallback.startOpenAutopilot();
|
||||
@@ -522,7 +536,6 @@ public class BusOrderModel {
|
||||
* 到站查询核销乘客
|
||||
*/
|
||||
public void queryPassengerWriteOff(){
|
||||
//todo 查询接口拿到核销乘客波播报
|
||||
if ( backgroundCurrentStationIndex > stationList.size() - 1 ) { //到站短时间内调用多次
|
||||
CallerLogger.INSTANCE.e( M_BUS + TAG, "数组越界" );
|
||||
return;
|
||||
@@ -615,7 +628,7 @@ public class BusOrderModel {
|
||||
/**
|
||||
* 离站上报
|
||||
*/
|
||||
public void leaveStation(boolean isRestart){
|
||||
public void leaveStation(){
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG,"leaveStation-backgroundCurrentStationIndex = "+backgroundCurrentStationIndex);
|
||||
String nextStationName = "";
|
||||
if (backgroundCurrentStationIndex < stationList.size() - 1){
|
||||
@@ -633,7 +646,7 @@ public class BusOrderModel {
|
||||
CallerLogger.INSTANCE.d( M_BUS + TAG, "自动驾驶开启开往下一站====" );
|
||||
//需要更改当前站和下一站的状态 然后渲染
|
||||
startOrStopQueryPassengerWriteOff(false);
|
||||
leaveStationSuccess(isRestart);
|
||||
leaveStationSuccess();
|
||||
leaveTTSTips(finalNextStationName);
|
||||
queryBusRoutes();
|
||||
}
|
||||
@@ -670,24 +683,25 @@ public class BusOrderModel {
|
||||
* 关闭美化模式
|
||||
*/
|
||||
public void closeBeautificationMode() {
|
||||
Logger.d("Route", "BusOrderModel -> closeBeautificationMode ==> isDemoMode:" + FunctionBuildConfig.isDemoMode);
|
||||
if (FunctionBuildConfig.isDemoMode) {//收车结束美化
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false;
|
||||
CallerAutoPilotManager.INSTANCE.setIgnoreConditionDraw(false);
|
||||
CallerAutoPilotManager.INSTANCE.setIPCDemoMode(false);
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG, "美化模式-ignore:置为false(收车)");
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG, "美化模式-ignore:置为false");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启自动驾驶到下一站
|
||||
*/
|
||||
public void autoDriveToNextStation(boolean isRestart) {
|
||||
public void autoDriveToNextStation() {
|
||||
if ( backgroundCurrentStationIndex >= stationList.size() - 1 ) {
|
||||
// 当前站是最后一站,结束当前行程
|
||||
travelOver();
|
||||
return;
|
||||
}
|
||||
leaveStation(isRestart);
|
||||
leaveStation();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -735,15 +749,20 @@ public class BusOrderModel {
|
||||
+" isLeaving()="+currentStation.isLeaving());
|
||||
|
||||
// 美化是否开始
|
||||
Logger.d("Route", "BusOrderModel -> updateBusStatus ==> isDemoMode:" + FunctionBuildConfig.isDemoMode);
|
||||
if (FunctionBuildConfig.isDemoMode && (backgroundCurrentStationIndex >= 0
|
||||
&& backgroundCurrentStationIndex <= stationList.size()-1)
|
||||
&& stationList.get(backgroundCurrentStationIndex).isLeaving()){//行驶过程中设置美化
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = true;
|
||||
CallerAutoPilotManager.INSTANCE.setIgnoreConditionDraw(true);
|
||||
CallerAutoPilotManager.INSTANCE.setIPCDemoMode(true);
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG, "美化模式-ignore:置为true(每次滑动出发)");
|
||||
&& backgroundCurrentStationIndex <= stationList.size()-1)){//行驶过程中设置美化
|
||||
if (stationList.get(backgroundCurrentStationIndex).isLeaving()){
|
||||
startBeautificationMode();
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG, "美化模式-ignore:置为true(每次滑动出发)");
|
||||
}else {
|
||||
closeBeautificationMode();
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG, "美化模式-ignore:false(到站)");
|
||||
clearStartAutopilotTag();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( currentStation.isLeaving() && slidePanelHideCallback != null) {
|
||||
slidePanelHideCallback.hideSlidePanel();
|
||||
}
|
||||
@@ -755,6 +774,17 @@ public class BusOrderModel {
|
||||
BusTrajectoryManager.getInstance().syncTrajectoryInfo();
|
||||
}
|
||||
|
||||
private void clearStartAutopilotTag() {
|
||||
firstStartAutopilot = 0;
|
||||
}
|
||||
|
||||
private void startBeautificationMode() {
|
||||
Logger.d("Route", "BusOrderModel -> startBeautificationMode ==> ignore = true");
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = true;
|
||||
CallerAutoPilotManager.INSTANCE.setIgnoreConditionDraw(true);
|
||||
CallerAutoPilotManager.INSTANCE.setIPCDemoMode(true);
|
||||
}
|
||||
|
||||
public void clearBusStationDatas(){
|
||||
if (refreshBusStationsCallback != null){
|
||||
refreshBusStationsCallback.clearBusStationsMarkers();
|
||||
@@ -774,8 +804,11 @@ public class BusOrderModel {
|
||||
public void restartAutopilot() {
|
||||
CallerLogger.INSTANCE.d( M_BUS + TAG, "重启自动驾驶===" + isGoingToNextStation );
|
||||
//只去启动自动驾驶,不再去上报离站
|
||||
startAutopilot(true);
|
||||
// autoDriveToNextStation(true);
|
||||
startAutopilot(firstStartAutopilot >= 1);
|
||||
}
|
||||
|
||||
public boolean isRestartAutopilot(){
|
||||
return firstStartAutopilot > 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -832,12 +865,12 @@ public class BusOrderModel {
|
||||
if (isArrivedStation) return;
|
||||
isArrivedStation = true;
|
||||
|
||||
if (FunctionBuildConfig.isDemoMode && backgroundCurrentStationIndex <= stationList.size() - 1) {//到达一站结束美化
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false;
|
||||
CallerAutoPilotManager.INSTANCE.setIgnoreConditionDraw(false);
|
||||
CallerAutoPilotManager.INSTANCE.setIPCDemoMode(false);
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG, "美化模式-ignore:置为false(到最后一站)");
|
||||
}
|
||||
// if (FunctionBuildConfig.isDemoMode && backgroundCurrentStationIndex <= stationList.size() - 1) {//到达一站结束美化
|
||||
// closeBeautificationMode();
|
||||
// CallerLogger.INSTANCE.d(M_BUS + TAG, "美化模式-ignore:置为false(到最后一站)");
|
||||
// }
|
||||
|
||||
|
||||
CallerLogger.INSTANCE.d( M_BUS + TAG, "到站====currentStationIndex=" + backgroundCurrentStationIndex);
|
||||
isGoingToNextStation = false;
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
@@ -28,6 +29,7 @@ import com.mogo.och.bus.model.BusOrderModel;
|
||||
import com.mogo.och.bus.util.BusTrajectoryManager;
|
||||
import com.mogo.och.common.module.biz.bean.DriverStatusQueryRespBean;
|
||||
import com.mogo.och.common.module.biz.callback.ILoginCallback;
|
||||
import com.mogo.och.common.module.manager.OCHAdasAbilityManager;
|
||||
import com.mogo.och.common.module.utils.SoundPoolHelper;
|
||||
import com.zhidao.socket.utils.LoginStatusUtil;
|
||||
|
||||
@@ -54,13 +56,14 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
private int currentAutopilotStatus = -1;
|
||||
private List<BusStationBean> mStationList = new ArrayList<>();
|
||||
private int mCurrentStation = 0;
|
||||
private boolean isRestartAutopilot = false;
|
||||
// private boolean isRestartAutopilot = false;
|
||||
|
||||
public BusPresenter(BusFragment view) {
|
||||
super(view);
|
||||
//2021.11.1 鹰眼架构整合,由IMoGoAutopilotStatusListener逐步替代IMogoAdasOCHCallback接口
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, this);
|
||||
BusOrderModel.getInstance().init();
|
||||
OCHAdasAbilityManager.getInstance().init(AbsMogoApplication.getApp());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -89,23 +92,24 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
BusOrderModel.getInstance().setSlidePanelHideCallback(null);
|
||||
BusOrderModel.getInstance().setControllerStatusCallback(null);
|
||||
BusOrderModel.getInstance().setPassengerCallback(null);
|
||||
OCHAdasAbilityManager.getInstance().release();
|
||||
}
|
||||
|
||||
public void abortTask() {
|
||||
BusOrderModel.getInstance().abortTask();
|
||||
}
|
||||
|
||||
public void autoDriveToNextStation(boolean isRestart) {
|
||||
public void autoDriveToNextStation() {
|
||||
currentAutopilotStatus = -1;
|
||||
BusOrderModel.getInstance().autoDriveToNextStation(isRestart);
|
||||
isRestartAutopilot = false;
|
||||
BusOrderModel.getInstance().autoDriveToNextStation();
|
||||
// isRestartAutopilot = false;
|
||||
}
|
||||
|
||||
public void restartAutopilot() {
|
||||
if (BusOrderModel.getInstance().isGoingToNextStation()){
|
||||
currentAutopilotStatus = -1;
|
||||
BusOrderModel.getInstance().restartAutopilot();
|
||||
isRestartAutopilot = true;
|
||||
// isRestartAutopilot = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,7 +215,7 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
// 改变UI自动驾驶状态
|
||||
runOnUIThread(() -> mView.onAutopilotStatusChanged(currentAutopilotStatus));
|
||||
BusOrderModel.getInstance().triggerStartServiceEvent(
|
||||
isRestartAutopilot, true);
|
||||
BusOrderModel.getInstance().isRestartAutopilot(), true);
|
||||
}
|
||||
break;
|
||||
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE:
|
||||
|
||||
@@ -73,4 +73,6 @@ dependencies {
|
||||
implementation project(':core:function-impl:mogo-core-function-v2x')
|
||||
}
|
||||
|
||||
implementation project(':libraries:mogo-adas')
|
||||
|
||||
}
|
||||
@@ -0,0 +1,215 @@
|
||||
package com.mogo.och.common.module.manager;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.zhidao.support.adas.high.AdasManager;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotAbility;
|
||||
import com.zhidao.support.adas.high.common.ProtocolStatus;
|
||||
|
||||
import chassis.Chassis;
|
||||
import chassis.VehicleStateOuterClass;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
import perception.TrafficLightOuterClass;
|
||||
import prediction.Prediction;
|
||||
import record_cache.RecordPanelOuterClass;
|
||||
import system_master.SystemStatusInfo;
|
||||
|
||||
/**
|
||||
* Created on 2022/10/9
|
||||
* 工控机状态信息回调(判断是否能否启动自动驾驶的回调)
|
||||
* 目前定的是3秒回调一次
|
||||
*/
|
||||
public class OCHAdasAbilityManager {
|
||||
|
||||
private static final String TAG = OCHAdasAbilityManager.class.getSimpleName();
|
||||
|
||||
|
||||
private boolean isAutopilotAbility = true;
|
||||
private String autopilotAbilityReason = "";
|
||||
|
||||
private static final class SingletonHolder {
|
||||
private static final OCHAdasAbilityManager INSTANCE = new OCHAdasAbilityManager();
|
||||
}
|
||||
|
||||
public static OCHAdasAbilityManager getInstance() {
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
public void init(Context context) {
|
||||
initListeners();
|
||||
}
|
||||
|
||||
public boolean getAutopilotAbilityStatus(){
|
||||
return isAutopilotAbility;
|
||||
}
|
||||
|
||||
public String getAutopilotUnAbilityReason(){
|
||||
return autopilotAbilityReason;
|
||||
}
|
||||
|
||||
private void initListeners() {
|
||||
//2022.10.9 工控机状态信息回调(判断是否能否启动自动驾驶的回调), 目前定的是3秒回调一次
|
||||
AdasManager.getInstance().setOnAdasListener(adasListener);
|
||||
}
|
||||
|
||||
private void releaseListeners() {
|
||||
AdasManager.getInstance().setOnAdasListener(null);
|
||||
}
|
||||
|
||||
public void release() {
|
||||
releaseListeners();
|
||||
}
|
||||
|
||||
private final OnAdasListener adasListener = new OnAdasListener() {
|
||||
@Override
|
||||
public void onTrajectory(MessagePad.Header header, MessagePad.Trajectory trajectory) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTrackedObjects(MessagePad.Header header, MessagePad.TrackedObjects trackedObjects) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGnssInfo(MessagePad.Header header, MessagePad.GnssInfo gnssInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVehicleState(MessagePad.Header header, VehicleStateOuterClass.VehicleState vehicleState) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotState(MessagePad.Header header, MessagePad.AutopilotState autopilotState) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReportMessage(MessagePad.Header header, MogoReportMsg.MogoReportMessage mogoReportMessage) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPerceptionTrafficLight(MessagePad.Header header, TrafficLightOuterClass.TrafficLights trafficLights) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPredictionObstacleTrajectory(MessagePad.Header header, Prediction.mPredictionObjects predictionObjects) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPointCloud(byte[] pointCloud) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlanningObjects(MessagePad.Header header, MessagePad.PlanningObjects planningObjects) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBasicInfoReq(MessagePad.Header header, MessagePad.BasicInfoReq basicInfoReq) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarConfigResp(MessagePad.Header header, MessagePad.CarConfigResp carConfigResp) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRecordResult(MessagePad.Header header, RecordPanelOuterClass.RecordPanel recordPanel) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGlobalPathResp(MessagePad.Header header, MessagePad.GlobalPathResp globalPathResp) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWarn(MessagePad.Header header, MessagePad.Warn warn) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArrivalNotification(MessagePad.Header header, MessagePad.ArrivalNotification arrivalNotification) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusQueryResp(MessagePad.Header header, SystemStatusInfo.StatusInfo statusInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRecordDataConfigResp(MessagePad.Header header, MessagePad.RecordDataConfig config) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlanningActionMsg(MessagePad.Header header, MessagePad.PlanningActionMsg planningActionMsg) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(ProtocolStatus status, byte[] bytes) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotAbility(AutopilotAbility ability) {
|
||||
isAutopilotAbility = true;
|
||||
autopilotAbilityReason = null;
|
||||
if (ability.gear == null || ability.gear == Chassis.GearPosition.GEAR_P || ability.gear == Chassis.GearPosition.GEAR_R) {
|
||||
isAutopilotAbility = false;
|
||||
autopilotAbilityReason = "挡位不正常";
|
||||
}
|
||||
if (isAutopilotAbility)
|
||||
if (ability.brake > 0) {
|
||||
isAutopilotAbility = false;
|
||||
autopilotAbilityReason = "制动踏板被踩下";
|
||||
}
|
||||
|
||||
if (isAutopilotAbility)
|
||||
if (ability.statusInfo.getSysState() == SystemStatusInfo.SystemState.SYS_STARTING) {
|
||||
isAutopilotAbility = false;
|
||||
autopilotAbilityReason = "系统正在启动";
|
||||
}
|
||||
if (isAutopilotAbility)
|
||||
if (ability.statusInfo.getSysState() == SystemStatusInfo.SystemState.SYS_EXITING) {
|
||||
isAutopilotAbility = false;
|
||||
autopilotAbilityReason = "系统正在关闭";
|
||||
}
|
||||
// 暂时先拦截及提示以上4种异常情况
|
||||
// if (isAutopilotAbility)
|
||||
// if (ability.statusInfo == null) {
|
||||
// isAutopilotAbility = false;
|
||||
// autopilotAbilityReason = "系统Topic不正常";
|
||||
// }
|
||||
// if (isAutopilotAbility)
|
||||
// if (ability.statusInfo.getSysState() == SystemStatusInfo.SystemState.SYS_FAULT) {
|
||||
// isAutopilotAbility = false;
|
||||
// autopilotAbilityReason = "系统异常";
|
||||
// }
|
||||
//
|
||||
// if (isAutopilotAbility)
|
||||
// for (SystemStatusInfo.HealthInfo healthInfo : ability.statusInfo.getHealthInfoList()) {
|
||||
// if (healthInfo.getState() == SystemStatusInfo.HealthState.FAULT) {
|
||||
// isAutopilotAbility = false;
|
||||
// autopilotAbilityReason = healthInfo.getName() + " Topic异常";
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
Logger.d(TAG, "是否可以启动自动驾驶=" + isAutopilotAbility + " 原因=" + autopilotAbilityReason);
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -12,4 +12,6 @@ public interface ITaxiControllerStatusCallback {
|
||||
void onVRModeChanged(boolean isVRMode);
|
||||
// 自车定位
|
||||
void onCarLocationChanged(Location location);
|
||||
//开始开启自动驾驶
|
||||
void startOpenAutopilot();
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.och.common.module.biz.constant.LoginStatusManager;
|
||||
import com.mogo.och.common.module.biz.constant.OchCommonConst;
|
||||
import com.mogo.och.common.module.biz.provider.LoginService;
|
||||
import com.mogo.och.common.module.manager.OCHAdasAbilityManager;
|
||||
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil;
|
||||
import com.mogo.och.common.module.utils.PinYinUtil;
|
||||
import com.mogo.och.common.module.utils.ToastUtilsOch;
|
||||
@@ -791,7 +792,7 @@ public class TaxiModel {
|
||||
GsonUtil.jsonFromObject(data));
|
||||
|
||||
if (mCurrentOCHOrder.orderStatus == TaxiOrderStatusEnum.OnTheWayToEnd.getCode()){
|
||||
|
||||
Logger.d("Route", "TaxiModel -> updateNativeCurrentOrder ==> isDemoMode:" + FunctionBuildConfig.isDemoMode);
|
||||
if (FunctionBuildConfig.isDemoMode) {
|
||||
// 当美化模式(演示模式)开启时: 订单对应自动驾驶开启后,置true
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = true;
|
||||
@@ -838,6 +839,7 @@ public class TaxiModel {
|
||||
TaxiTrajectoryManager.getInstance().syncTrajectoryInfo();
|
||||
SharedPrefsMgr.getInstance(mContext).remove(TaxiConst.SP_KEY_OCH_TAXI_ORDER);
|
||||
isRestartAutopilot = false;
|
||||
Logger.d("Route", "TaxiModel -> clearCurrentOCHOrder ==> isDemoMode:" + FunctionBuildConfig.isDemoMode);
|
||||
if (FunctionBuildConfig.isDemoMode) {
|
||||
// 当美化模式(演示模式)开启时: 取消或订单已完成时,置false
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false;
|
||||
@@ -875,6 +877,12 @@ public class TaxiModel {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!FunctionBuildConfig.isDemoMode && !OCHAdasAbilityManager.getInstance().getAutopilotAbilityStatus()){
|
||||
ToastUtils.showLong(OCHAdasAbilityManager.getInstance().getAutopilotUnAbilityReason() +
|
||||
", 请稍候重试");
|
||||
return;
|
||||
}
|
||||
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE
|
||||
== CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState()) {
|
||||
// TODO: 2021/11/28 工控机存在刚开始状态为0,但是可以开启变为2,工控机解决前不显示此toast
|
||||
@@ -897,12 +905,19 @@ public class TaxiModel {
|
||||
}
|
||||
|
||||
CallerAutoPilotManager.INSTANCE.startAutoPilot(parameters);
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "start autopilot with parameter: %s", GsonUtil.jsonFromObject(parameters)
|
||||
+ " ,startSiteName=" + mCurrentOCHOrder.startSiteAddr + " ,endSiteName=" + mCurrentOCHOrder.endSiteAddr);
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "start autopilot with parameter: %s",
|
||||
GsonUtil.jsonFromObject(parameters)
|
||||
+ " ,startSiteName=" + mCurrentOCHOrder.startSiteAddr
|
||||
+ " ,endSiteName=" + mCurrentOCHOrder.endSiteAddr
|
||||
+ "isRestartAutopilot = "+isRestartAutopilot);
|
||||
|
||||
TaxiAnalyticsManager.getInstance().triggerStartAutopilotEvent(isRestartAutopilot, false,
|
||||
mCurrentOCHOrder.startSiteAddr, mCurrentOCHOrder.endSiteAddr, mCurrentOCHOrder.orderNo);
|
||||
|
||||
if (mControllerStatusCallback != null) {
|
||||
mControllerStatusCallback.startOpenAutopilot();
|
||||
}
|
||||
|
||||
// TODO: 2021/8/20 无工控机环境, 手动调起自动驾驶开启返回结果,有工控机环境要删除
|
||||
// OCHTaxiUiController.getInstance().onAutoPilotStatusChanged( IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING, "开启自动驾驶" );
|
||||
}
|
||||
@@ -1129,7 +1144,7 @@ public class TaxiModel {
|
||||
|
||||
TaxiAnalyticsManager.getInstance().triggerStartAutopilotEvent(isRestartAutopilot, true,
|
||||
mCurrentOCHOrder.startSiteAddr, mCurrentOCHOrder.endSiteAddr, mCurrentOCHOrder.orderNo);
|
||||
|
||||
Logger.d("Route", "TaxiModel -> onAutopilotStatusResponse ==> isDemoMode:" + FunctionBuildConfig.isDemoMode);
|
||||
if (FunctionBuildConfig.isDemoMode) {
|
||||
// 当美化模式(演示模式)开启时: 订单对应自动驾驶开启后,置true
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = true;
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.common.module.biz.bean.DriverStatusQueryRespBean;
|
||||
import com.mogo.och.common.module.biz.callback.ILoginCallback;
|
||||
import com.mogo.och.common.module.biz.constant.LoginStatusManager;
|
||||
import com.mogo.och.common.module.manager.OCHAdasAbilityManager;
|
||||
import com.mogo.och.taxi.constant.TaxiConst;
|
||||
import com.mogo.och.taxi.constant.TaxiDriverRoleEnum;
|
||||
import com.mogo.och.taxi.constant.TaxiOrderStatusEnum;
|
||||
@@ -51,6 +52,7 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
public TaxiPresenter(TaxiFragment view) {
|
||||
super(view);
|
||||
TaxiModel.getInstance().init(AbsMogoApplication.getApp());
|
||||
OCHAdasAbilityManager.getInstance().init(AbsMogoApplication.getApp());
|
||||
initListeners();
|
||||
}
|
||||
|
||||
@@ -73,6 +75,7 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
TaxiModel.getInstance().setCarStatusCallback(this);
|
||||
TaxiModel.getInstance().setControllerStatusCallback(this);
|
||||
TaxiModel.getInstance().setOrderStatusCallback(this);
|
||||
OCHAdasAbilityManager.getInstance().release();
|
||||
}
|
||||
|
||||
private void releaseListeners() {
|
||||
@@ -318,6 +321,13 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startOpenAutopilot() {
|
||||
runOnUIThread(() -> {
|
||||
mView.startOrStopLoadingAnim(true);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loginSuccess(DriverStatusQueryRespBean data) {
|
||||
//设置 接单状态
|
||||
|
||||
@@ -247,7 +247,7 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
|
||||
}else if (!(boolean)ctvAutopilotStatusRL.getTag()){
|
||||
ToastUtils.showShort(getResources().getString(R.string.module_och_taxi_auto_disable_tip1));
|
||||
}else {
|
||||
restartAutopilot();
|
||||
startAutopilot();
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -542,7 +542,7 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
|
||||
/**
|
||||
* 重新开启自动驾驶
|
||||
*/
|
||||
public abstract void restartAutopilot();
|
||||
public abstract void startAutopilot();
|
||||
|
||||
|
||||
public void changeOperationViewVisible(int visible) {
|
||||
|
||||
@@ -84,14 +84,13 @@ public class TaxiFragment extends BaseTaxiTabFragment<TaxiFragment, TaxiPresente
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restartAutopilot() {
|
||||
public void startAutopilot() {
|
||||
// 在自动驾驶中,或者自己确认车辆环境可开启自动驾驶 则可点击
|
||||
if ((mPresenter.getCurOrderStatus() == TaxiOrderStatusEnum.OnTheWayToEnd ||
|
||||
mPresenter.getCurOrderStatus() == TaxiOrderStatusEnum.UserArriveAtStart)
|
||||
&& !isStarting) {
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "restartAutopilot");
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "startAutopilot");
|
||||
mPresenter.startAutoPilot();
|
||||
startOrStopLoadingAnim(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,13 +225,6 @@ public class TaxiFragment extends BaseTaxiTabFragment<TaxiFragment, TaxiPresente
|
||||
updateTaxiTestBarInfo(); //更新调试bar中信息
|
||||
}
|
||||
|
||||
public void startAutoPilot() {
|
||||
if (!isStarting){
|
||||
mPresenter.startAutoPilot();
|
||||
startOrStopLoadingAnim(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void confirmAutopilotConditionByDriver(){
|
||||
mPresenter.confirmAutopilotConditionByDriver();
|
||||
}
|
||||
@@ -380,7 +372,6 @@ public class TaxiFragment extends BaseTaxiTabFragment<TaxiFragment, TaxiPresente
|
||||
findViewById(R.id.test_bar_on_the_way_to_end).setOnClickListener(v -> {
|
||||
if (!isStarting){
|
||||
mPresenter.startAutoPilot();
|
||||
startOrStopLoadingAnim(true);
|
||||
}
|
||||
TaxiModel.getInstance().setOnTheWayToEndStation();
|
||||
});
|
||||
|
||||
@@ -13,7 +13,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager.setDemoMode
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager.setIgnoreConditionDraw
|
||||
import com.mogo.eagle.core.function.call.bindingcar.CallerBindingcarManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.*
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.telematic.MogoProtocolMsg
|
||||
@@ -118,6 +118,7 @@ class TeleMsgHandler : IMsgHandler {
|
||||
"1" -> true
|
||||
else -> false
|
||||
}
|
||||
Logger.d("Route", "TeleMsgHandler -> handleMsgFromServer ==> isDemoMode:" + FunctionBuildConfig.isDemoMode + ",isIgnore:" + FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData)
|
||||
timestamp = currTime
|
||||
invokeNettyConnResult("乘客屏收到的美化模式isIgnore为:${FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData}")
|
||||
} else {
|
||||
|
||||
@@ -578,6 +578,7 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
}
|
||||
FunctionBuildConfig.isDemoMode = isChecked
|
||||
tbIsDrawAutopilotTrajectoryData.isEnabled = !isChecked
|
||||
Logger.d("Route", "DebugSettingView -> initView ==> isDemoMode:" + FunctionBuildConfig.isDemoMode + ",isIgnore: $isChecked" )
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = isChecked
|
||||
if (!FunctionBuildConfig.isDemoMode) {
|
||||
tbIsDrawAutopilotTrajectoryData.isChecked = false
|
||||
@@ -622,6 +623,7 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
|
||||
// 强制绘制引导线
|
||||
tbIsDrawAutopilotTrajectoryData.setOnCheckedChangeListener { _, isChecked ->
|
||||
Logger.d("Route", "DebugSettingView -> initView2 ==> isDemoMode:" + FunctionBuildConfig.isDemoMode + ",isIgnore: $isChecked")
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = isChecked
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -61,6 +62,7 @@ public class MogoRouteOverlayManager implements
|
||||
|
||||
@Override
|
||||
public void onAutopilotTrajectory(@NonNull List<MessagePad.TrajectoryPoint> items) {
|
||||
Logger.d(TAG, "--- onAutopilotTrajectory ---:" + items.size());
|
||||
synchronized (queue) {
|
||||
queue.clear();
|
||||
queue.offer(items);
|
||||
@@ -73,17 +75,20 @@ public class MogoRouteOverlayManager implements
|
||||
return;
|
||||
}
|
||||
if (isArriveAtStation.get()) {
|
||||
Logger.d(TAG, "--- onLocationChanged 1 -- [isDemo1: " + FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData + ",isDemo2:" +FunctionBuildConfig.isDemoMode + ",isGps:" + isGps + ",mode:" + autopilotMode.get() + ",lon:" + location.getLongitude() + ",lat:" + location.getLatitude() + ",angle:" + location.getBearing() + "]");
|
||||
RouteOverlayDrawer.getInstance().clearMogoRouteOverlay();
|
||||
return;
|
||||
}
|
||||
boolean force = FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData;
|
||||
if (!force && autopilotMode.get() != 1) {
|
||||
Logger.d(TAG, "--- onLocationChanged 2 -- [isDemo1: " + FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData + ",isDemo2:" +FunctionBuildConfig.isDemoMode + ",isGps:" + isGps + ",mode:" + autopilotMode.get() + ",lon:" + location.getLongitude() + ",lat:" + location.getLatitude() + ",angle:" + location.getBearing() + "]");
|
||||
RouteOverlayDrawer.getInstance().clearMogoRouteOverlay();
|
||||
return;
|
||||
}
|
||||
synchronized (queue) {
|
||||
List<MessagePad.TrajectoryPoint> items = queue.peekLast();
|
||||
if (items != null && !items.isEmpty()) {
|
||||
Logger.d(TAG, "--- onLocationChanged -- [isDemo1: " + FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData + ",isDemo2:" +FunctionBuildConfig.isDemoMode + ",isGps:" + isGps + ",mode:" + autopilotMode.get() + ",lon:" + location.getLongitude() + ",lat:" + location.getLatitude() + ",angle:" + location.getBearing() + "]");
|
||||
RouteOverlayDrawer.getInstance().drawTrajectoryList(items, location.getBearing());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user