[清扫车]子任务详情获取与子任务开始逻辑修改
This commit is contained in:
@@ -9,8 +9,7 @@ class SweeperConst {
|
||||
companion object {
|
||||
|
||||
private const val BASE_URL_OCH_DEV = "https://och-driver-dev.zhidaozhixing.com"
|
||||
//private const val BASE_URL_OCH_QA = "https://och-driver-qa.zhidaozhixing.com"
|
||||
private const val BASE_URL_OCH_QA = "https://och-driver-dev.zhidaozhixing.com"
|
||||
private const val BASE_URL_OCH_QA = "https://och-driver-qa.zhidaozhixing.com"
|
||||
private const val BASE_URL_OCH_RELEASE = "https://och-driver.zhidaozhixing.com"
|
||||
|
||||
@JvmStatic
|
||||
|
||||
@@ -427,8 +427,8 @@ public abstract class BaseSweeperTabFragment<V extends IView, P extends Presente
|
||||
*/
|
||||
public void setWeltDataToMap(ArrayList<WeltDataBean> weltDataBeans,Boolean isWeltData) {
|
||||
if (mMapWeltView != null) {
|
||||
mMapWeltView.setWeltData(weltDataBeans,isWeltData);
|
||||
runOnUIThread(() -> {
|
||||
mMapWeltView.setWeltData(weltDataBeans,isWeltData);
|
||||
mMapWeltView.drawablePolyline();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mogo.och.sweeper.fragment
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import chassis.ChassisStatesOuterClass
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
@@ -25,6 +26,8 @@ import com.mogo.och.sweeper.ui.dialog.SweeperNoTitleCommonDialog
|
||||
import com.mogo.och.sweeper.ui.popwindow.MenuPopWindow
|
||||
import kotlinx.android.synthetic.main.fragment_och_sweeper.*
|
||||
import kotlinx.android.synthetic.main.sweeper_no_data_common_view.*
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
/**
|
||||
* 清扫车主界面
|
||||
@@ -169,7 +172,9 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
|
||||
@UiThread
|
||||
fun onSweeperFutianCleanSystemState(cleanSystemState: ChassisStatesOuterClass.SweeperFuTianTaskSystemStates) {
|
||||
this.mCleanSystemState = cleanSystemState
|
||||
sweeper_cl_work_mode.setSweeperFutianCleanSystemState(mSubTaskType, cleanSystemState)
|
||||
lifecycleScope.launch(Dispatchers.Main){
|
||||
sweeper_cl_work_mode.setSweeperFutianCleanSystemState(mSubTaskType, cleanSystemState)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -209,7 +214,7 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
|
||||
setSubTaskData()
|
||||
if (mSubTaskType.code == SubTaskTypeEnum.AUTOPILOT_SUBTYPE.code) {//自动驾驶子任务需要调用详情
|
||||
mSubInfo?.let { subInfo ->
|
||||
presenter?.getSubTaskDetail(subInfo.taskId, mSubTaskType)//加载子任务详情包括轨迹信息
|
||||
presenter?.getSubTaskDetail(isFirstSubTask(), isLastSubTask(),subInfo.taskId, mSubTaskType,false)//加载子任务详情包括轨迹信息
|
||||
}
|
||||
} else {
|
||||
manualDriving(mSubInfo)
|
||||
@@ -225,6 +230,7 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
|
||||
*/
|
||||
fun updateSubTaskStatus(typeEnum: TaskStatusEnum, isLastSubTask: Boolean) {
|
||||
if (isLastSubTask) {
|
||||
showAmapNaviToStationFragment(false)
|
||||
mPresenter?.getMainTaskList()
|
||||
clearAllMarkerAndPolyline()
|
||||
return
|
||||
@@ -235,9 +241,10 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
|
||||
setSubTaskData()
|
||||
d(SceneConstant.M_SWEEPER + TAG, "END_SUBTASK mCurrentSubPosition:$mCurrentSubPosition")
|
||||
if (mSubTaskType.code == SubTaskTypeEnum.AUTOPILOT_SUBTYPE.code) {//自动驾驶子任务
|
||||
//关闭人工驾驶导航
|
||||
showAmapNaviToStationFragment(false)
|
||||
mSubInfo?.apply {
|
||||
presenter?.getSubTaskDetail(taskId, mSubTaskType)
|
||||
presenter?.startTask(isFirstSubTask(), isLastSubTask(), taskId, mSubTaskType, taskStatus)
|
||||
presenter?.getSubTaskDetail(isFirstSubTask(), isLastSubTask(),taskId, mSubTaskType,true)
|
||||
}
|
||||
} else {
|
||||
manualDriving(mSubInfo)
|
||||
@@ -250,12 +257,12 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
|
||||
d(SceneConstant.M_SWEEPER + TAG, "JUMP_OVER_SUBTASK mCurrentSubPosition:$mCurrentSubPosition")
|
||||
showAmapNaviToStationFragment(false)
|
||||
if (mSubTaskType.code == SubTaskTypeEnum.AUTOPILOT_SUBTYPE.code) {//自动驾驶子任务
|
||||
//关闭人工驾驶导航
|
||||
showAmapNaviToStationFragment(false)
|
||||
mSubInfo?.apply {
|
||||
presenter?.getSubTaskDetail(taskId, mSubTaskType)
|
||||
presenter?.startTask(isFirstSubTask(), isLastSubTask(), taskId, mSubTaskType, taskStatus)
|
||||
presenter?.getSubTaskDetail(isFirstSubTask(), isLastSubTask(),taskId, mSubTaskType,true)
|
||||
}
|
||||
} else {
|
||||
showAmapNaviToStationFragment(false)
|
||||
manualDriving(mSubInfo)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,8 +64,8 @@ class WeltMapOverViewFragment(var mIWeltMapSwitchToSmallCallBack: IWeltMapSwitch
|
||||
@JvmStatic
|
||||
fun newInstance(
|
||||
mIWeltMapSwitchToSmallCallBack: IWeltMapSwitchToSmallCallback,
|
||||
weltDataList: ArrayList<WeltDataBean>,
|
||||
latLngs: ArrayList<LatLng>
|
||||
weltDataList: ArrayList<WeltDataBean>?,
|
||||
latLngs: ArrayList<LatLng>?
|
||||
): WeltMapOverViewFragment {
|
||||
val args = Bundle()
|
||||
args.putSerializable("weltDataList", weltDataList)
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.mogo.och.sweeper.model;
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_SWEEPER;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -17,6 +16,7 @@ import com.mogo.commons.module.status.StatusDescriptor;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager;
|
||||
@@ -81,9 +81,9 @@ public class SweeperTaskModel {
|
||||
private ISweeperTaskCallback mSweeperTaskCallback;
|
||||
List<SweeperRoutePlanningUpdateReqBean.Result> points = new ArrayList<>();//全路径信息
|
||||
//当前子任务详情信息包括轨迹文件信息
|
||||
private SweeperSubTaskDetailBean currentSubTaskDetail;
|
||||
private SweeperSubTaskDetailBean mCurrentSubTaskDetail;
|
||||
//子任务是否正在进行中
|
||||
private boolean isSubTaskWorking = false;
|
||||
private boolean mIsSubTaskWorking = false;
|
||||
//自动驾驶是否到达子任务终点
|
||||
private boolean isArriveSubTaskEndSite = false;
|
||||
//当前子任务id
|
||||
@@ -94,6 +94,8 @@ public class SweeperTaskModel {
|
||||
private boolean mIsFirstSubtask = false;
|
||||
//0: 代表没有启动过 1代表是启动第一次,当>=1 代表是重试 每次子任务结束/主任务结束清空置为0
|
||||
private volatile int firstStartAutopilot = 0;
|
||||
//自动驾驶状态
|
||||
private int mAutopilotState = IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE;
|
||||
|
||||
public static SweeperTaskModel getInstance() {
|
||||
if (sInstance == null) {
|
||||
@@ -184,12 +186,20 @@ public class SweeperTaskModel {
|
||||
}
|
||||
|
||||
};
|
||||
public void setSubtask(boolean isFirstSubtask,boolean isLastSubtask,int subTaskId) {
|
||||
|
||||
public void setSubtask(boolean isFirstSubtask, boolean isLastSubtask, int subTaskId) {
|
||||
this.mIsLastSubtask = isLastSubtask;
|
||||
this.mIsFirstSubtask=isFirstSubtask;
|
||||
this.mSubTaskId=subTaskId;
|
||||
this.mIsFirstSubtask = isFirstSubtask;
|
||||
this.mSubTaskId = subTaskId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存自动驾驶状态
|
||||
* @param autopilotState
|
||||
*/
|
||||
public void setAutopilotState(int autopilotState){
|
||||
this.mAutopilotState=autopilotState;
|
||||
}
|
||||
public static List<SweeperRoutePlanningUpdateReqBean.Result> coordinateConverterWgsToGcjList(Context mContext,
|
||||
List<MessagePad.Location> mogoLatLngList) {
|
||||
List<SweeperRoutePlanningUpdateReqBean.Result> points = new ArrayList<>();
|
||||
@@ -251,7 +261,7 @@ public class SweeperTaskModel {
|
||||
mControllerStatusCallback.onCarLocationChanged(gnssInfo);
|
||||
}
|
||||
//子任务完成的围栏判断 子任务正在执行中,还未到达子任务终点
|
||||
if (isSubTaskWorking && !isArriveSubTaskEndSite) {
|
||||
if (mIsSubTaskWorking && !isArriveSubTaskEndSite) {
|
||||
judgeArrivedStation(gnssInfo);
|
||||
}
|
||||
}
|
||||
@@ -259,14 +269,14 @@ public class SweeperTaskModel {
|
||||
|
||||
//根据围栏判断,是否到达子任务终点
|
||||
private void judgeArrivedStation(MogoLocation location) {
|
||||
double endSiteLon = currentSubTaskDetail.getEndSiteLon();
|
||||
double endSiteLat = currentSubTaskDetail.getEndSiteLat();
|
||||
double endSiteLon = mCurrentSubTaskDetail.getEndSiteLon();
|
||||
double endSiteLat = mCurrentSubTaskDetail.getEndSiteLat();
|
||||
double distance = CoordinateUtils.calculateLineDistance(
|
||||
endSiteLon, endSiteLat,
|
||||
location.getLongitude(), location.getLatitude());
|
||||
if (distance <= SweeperConst.ARRIVE_AT_END_STATION_DISTANCE) {
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "行程日志-judgeArrivedStation() distance = " + distance
|
||||
+ " to " + currentSubTaskDetail.getEndSiteName());
|
||||
+ " to " + mCurrentSubTaskDetail.getEndSiteName());
|
||||
onArriveTaskEnd(null); //无自动驾驶到终点信息传null
|
||||
return;
|
||||
}
|
||||
@@ -276,9 +286,10 @@ public class SweeperTaskModel {
|
||||
* 在踩刹车、控制方向盘等操作后,会停止自动驾驶,重启自动驾驶的话相当于重新设置自动驾驶目的地
|
||||
*/
|
||||
public void startAutopilot() {
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "行程日志-重启自动驾驶===" + isSubTaskWorking);
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "行程日志-重启自动驾驶===" + mIsSubTaskWorking);
|
||||
//只去启动自动驾驶
|
||||
startAutopilot(firstStartAutopilot >= 1);
|
||||
mIsSubTaskWorking=true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -314,7 +325,7 @@ public class SweeperTaskModel {
|
||||
* 获取任务子任务执行状态
|
||||
*/
|
||||
public boolean getSubWorking() {
|
||||
return isSubTaskWorking;
|
||||
return mIsSubTaskWorking;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -342,37 +353,37 @@ public class SweeperTaskModel {
|
||||
public void onArriveTaskEnd(MessagePad.ArrivalNotification data) {
|
||||
//MAP 280 每隔100ms左右返回一次到站, 导致在到达中间站后再次滑动出发后会有时间差,收到一次到站,出现问题
|
||||
//此处比对 自驾告诉的子任务终点坐标和本地应到子任务终点坐标, 一致时才表示子任务完成
|
||||
if (data != null && data.getEndLocation() != null&¤tSubTaskDetail!=null) {
|
||||
if (data != null && data.getEndLocation() != null && mCurrentSubTaskDetail != null) {
|
||||
String latitude = NumberFormatUtil.cutOutNumber(data.getEndLocation().getLatitude(), 5); //wgs
|
||||
String longitude = NumberFormatUtil.cutOutNumber(data.getEndLocation().getLongitude(), 5);
|
||||
String arriveLat = NumberFormatUtil.cutOutNumber(currentSubTaskDetail.getEndSiteWgs64Lat(), 5);
|
||||
String arriveLon = NumberFormatUtil.cutOutNumber(currentSubTaskDetail.getEndSiteWgs64Lon(), 5);
|
||||
String arriveLat = NumberFormatUtil.cutOutNumber(mCurrentSubTaskDetail.getEndSiteWgs64Lat(), 5);
|
||||
String arriveLon = NumberFormatUtil.cutOutNumber(mCurrentSubTaskDetail.getEndSiteWgs64Lon(), 5);
|
||||
if (!latitude.equals(arriveLat) || !longitude.equals(arriveLon)) {
|
||||
CallerLogger.INSTANCE.e(M_SWEEPER + TAG, "行程日志-子任务终点拦截,自动子任务终点与本地子任务终点不一致");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (isArriveSubTaskEndSite)return;
|
||||
if (isArriveSubTaskEndSite) return;
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "行程日志-当前==subTaskId="
|
||||
+ mSubTaskId);
|
||||
//到达子任务终点 结束子任务
|
||||
subTaskEnd(mIsFirstSubtask,mIsLastSubtask,mSubTaskId);
|
||||
subTaskEnd(mIsFirstSubtask, mIsLastSubtask, mSubTaskId);
|
||||
}
|
||||
|
||||
public void triggerStartServiceEvent(boolean isRestart, boolean send) {
|
||||
if (currentSubTaskDetail == null) {
|
||||
if (mCurrentSubTaskDetail == null) {
|
||||
return;
|
||||
}
|
||||
SweeperAnalyticsManager.getInstance().triggerStartAutopilotEvent(isRestart, send,
|
||||
currentSubTaskDetail.getStartSiteName(), currentSubTaskDetail.getEndSiteName(), currentSubTaskDetail.getLineId());
|
||||
mCurrentSubTaskDetail.getStartSiteName(), mCurrentSubTaskDetail.getEndSiteName(), mCurrentSubTaskDetail.getLineId());
|
||||
}
|
||||
|
||||
public void triggerUnableStartAPReasonEvent() {
|
||||
if (currentSubTaskDetail == null) {
|
||||
if (mCurrentSubTaskDetail == null) {
|
||||
return;
|
||||
}
|
||||
SweeperAnalyticsManager.getInstance().triggerUnableStartAPReasonEvent(
|
||||
currentSubTaskDetail.getStartSiteName(), currentSubTaskDetail.getEndSiteName(), currentSubTaskDetail.getLineId(),
|
||||
mCurrentSubTaskDetail.getStartSiteName(), mCurrentSubTaskDetail.getEndSiteName(), mCurrentSubTaskDetail.getLineId(),
|
||||
OCHAdasAbilityManager.getInstance().getAutopilotUnAbilityReason());
|
||||
}
|
||||
|
||||
@@ -397,24 +408,24 @@ public class SweeperTaskModel {
|
||||
|
||||
private AutopilotControlParameters initAutopilotControlParameters() {
|
||||
AutopilotControlParameters parameters = new AutopilotControlParameters();
|
||||
if (currentSubTaskDetail != null) {
|
||||
parameters.routeID = currentSubTaskDetail.getLineId();
|
||||
parameters.routeName = currentSubTaskDetail.getLineName();
|
||||
parameters.startName = PinYinUtil.getPinYinHeadChar(currentSubTaskDetail.getStartSiteName());
|
||||
parameters.endName = PinYinUtil.getPinYinHeadChar(currentSubTaskDetail.getEndSiteName());
|
||||
if (mCurrentSubTaskDetail != null) {
|
||||
parameters.routeID = mCurrentSubTaskDetail.getLineId();
|
||||
parameters.routeName = mCurrentSubTaskDetail.getLineName();
|
||||
parameters.startName = PinYinUtil.getPinYinHeadChar(mCurrentSubTaskDetail.getStartSiteName());
|
||||
parameters.endName = PinYinUtil.getPinYinHeadChar(mCurrentSubTaskDetail.getEndSiteName());
|
||||
parameters.startLatLon = new AutopilotControlParameters
|
||||
.AutoPilotLonLat(currentSubTaskDetail.getStartSiteWgs64Lat(), currentSubTaskDetail.getStartSiteWgs64Lon());
|
||||
.AutoPilotLonLat(mCurrentSubTaskDetail.getStartSiteWgs64Lat(), mCurrentSubTaskDetail.getStartSiteWgs64Lon());
|
||||
parameters.endLatLon = new AutopilotControlParameters
|
||||
.AutoPilotLonLat(currentSubTaskDetail.getEndSiteWgs64Lat(), currentSubTaskDetail.getEndSiteWgs64Lon());
|
||||
.AutoPilotLonLat(mCurrentSubTaskDetail.getEndSiteWgs64Lat(), mCurrentSubTaskDetail.getEndSiteWgs64Lon());
|
||||
parameters.vehicleType = VEHICLE_TYPE;
|
||||
parameters.autoPilotLine = new AutopilotControlParameters.AutoPilotLine(
|
||||
currentSubTaskDetail.getLineId(),
|
||||
currentSubTaskDetail.getCsvFileUrl(), currentSubTaskDetail.getCsvFileMd5(),
|
||||
currentSubTaskDetail.getTxtFileUrl(), currentSubTaskDetail.getTxtFileMd5(),
|
||||
currentSubTaskDetail.getContrailSaveTime(), currentSubTaskDetail.getCarModel(),
|
||||
currentSubTaskDetail.getCsvFileUrlDPQP(), currentSubTaskDetail.getCsvFileMd5DPQP(),
|
||||
currentSubTaskDetail.getTxtFileUrlDPQP(), currentSubTaskDetail.getTxtFileMd5DPQP(),
|
||||
currentSubTaskDetail.getContrailSaveTimeDPQP());
|
||||
mCurrentSubTaskDetail.getLineId(),
|
||||
mCurrentSubTaskDetail.getCsvFileUrl(), mCurrentSubTaskDetail.getCsvFileMd5(),
|
||||
mCurrentSubTaskDetail.getTxtFileUrl(), mCurrentSubTaskDetail.getTxtFileMd5(),
|
||||
mCurrentSubTaskDetail.getContrailSaveTime(), mCurrentSubTaskDetail.getCarModel(),
|
||||
mCurrentSubTaskDetail.getCsvFileUrlDPQP(), mCurrentSubTaskDetail.getCsvFileMd5DPQP(),
|
||||
mCurrentSubTaskDetail.getTxtFileUrlDPQP(), mCurrentSubTaskDetail.getTxtFileMd5DPQP(),
|
||||
mCurrentSubTaskDetail.getContrailSaveTimeDPQP());
|
||||
}
|
||||
return parameters;
|
||||
}
|
||||
@@ -426,11 +437,11 @@ public class SweeperTaskModel {
|
||||
SweeperServiceManager.getCurrentTask(mContext, new OchCommonServiceCallback<BaseResponse<SweeperSubTaskBean>>() {
|
||||
@Override
|
||||
public void onSuccess(BaseResponse<SweeperSubTaskBean> data) {
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "getCurrentTask:"+GsonUtil.jsonFromObject(data));
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "getCurrentTask:" + GsonUtil.jsonFromObject(data));
|
||||
if (mSweeperTaskCallback != null && data != null) {
|
||||
SweeperSubTaskBean sweeperSubTaskBean = data.getData();
|
||||
if (sweeperSubTaskBean != null && sweeperSubTaskBean.getSubList() != null && sweeperSubTaskBean.getSubList().size() > 0) {
|
||||
mSweeperTaskCallback.setSubTaskBean(sweeperSubTaskBean,true);
|
||||
mSweeperTaskCallback.setSubTaskBean(sweeperSubTaskBean, true);
|
||||
} else {
|
||||
getMainTaskList();
|
||||
}
|
||||
@@ -466,7 +477,7 @@ public class SweeperTaskModel {
|
||||
SweeperServiceManager.getMainTaskList(mContext, new OchCommonServiceCallback<BaseResponse<List<SweeperMainTaskBean>>>() {
|
||||
@Override
|
||||
public void onSuccess(BaseResponse<List<SweeperMainTaskBean>> data) {
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "getMainTaskList:"+GsonUtil.jsonFromObject(data));
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "getMainTaskList:" + GsonUtil.jsonFromObject(data));
|
||||
if (mSweeperTaskCallback != null && data != null && data.getCode() == 0) {
|
||||
List<SweeperMainTaskBean> list = data.getData();
|
||||
mSweeperTaskCallback.setMainTaskList(list);
|
||||
@@ -502,12 +513,12 @@ public class SweeperTaskModel {
|
||||
SweeperServiceManager.getSubTaskList(taskId, mContext, new OchCommonServiceCallback<BaseResponse<List<SubInfo>>>() {
|
||||
@Override
|
||||
public void onSuccess(BaseResponse<List<SubInfo>> data) {
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "getSubTaskList:"+GsonUtil.jsonFromObject(data));
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "getSubTaskList:" + GsonUtil.jsonFromObject(data));
|
||||
if (mSweeperTaskCallback != null && data != null && data.getCode() == 0) {
|
||||
List<SubInfo> list = data.getData();
|
||||
if (list != null && list.size() > 0) {
|
||||
sweeperSubTaskBean.setSubList(list);
|
||||
mSweeperTaskCallback.setSubTaskBean(sweeperSubTaskBean,false);
|
||||
mSweeperTaskCallback.setSubTaskBean(sweeperSubTaskBean, false);
|
||||
} else {
|
||||
getMainTaskList();
|
||||
}
|
||||
@@ -539,19 +550,25 @@ public class SweeperTaskModel {
|
||||
/**
|
||||
* 获取子任务详情包括轨迹文件信息
|
||||
*/
|
||||
public void getSubTaskDetail(int subTaskId, SubTaskTypeEnum subTaskType) {
|
||||
public void getSubTaskDetail(boolean isFirst, boolean isEnd, int subTaskId, SubTaskTypeEnum subTaskType, boolean isStartSubtask) {
|
||||
SweeperServiceManager.getSubTaskDetail(subTaskId, mContext, new OchCommonServiceCallback<BaseResponse<SweeperSubTaskDetailBean>>() {
|
||||
@Override
|
||||
public void onSuccess(BaseResponse<SweeperSubTaskDetailBean> data) {
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "getSubTaskDetail:"+GsonUtil.jsonFromObject(data));
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "getSubTaskDetail:" + GsonUtil.jsonFromObject(data));
|
||||
if (data != null) {
|
||||
currentSubTaskDetail = data.getData();
|
||||
if (currentSubTaskDetail != null) {
|
||||
mSweeperTaskCallback.setSubTakDetail(currentSubTaskDetail,subTaskType);
|
||||
mCurrentSubTaskDetail = data.getData();
|
||||
if (mCurrentSubTaskDetail != null) {
|
||||
mSweeperTaskCallback.setSubTakDetail(mCurrentSubTaskDetail, subTaskType);
|
||||
if (subTaskType == SubTaskTypeEnum.AUTOPILOT_SUBTYPE) {//自动驾驶子任务
|
||||
//向自动驾驶发送要下载文件轨迹路径
|
||||
SweeperTrajectoryManager.getInstance().syncTrajectoryInfo(currentSubTaskDetail);
|
||||
SweeperTrajectoryManager.getInstance().syncTrajectoryInfo(mCurrentSubTaskDetail);
|
||||
updateAutopilotControlParameters();
|
||||
/**
|
||||
* 在自动驾驶状态
|
||||
*/
|
||||
if (isStartSubtask&&mAutopilotState==IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {//是否需要自动开始执行任务
|
||||
subTaskStart(isFirst, isEnd, subTaskId, subTaskType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -582,14 +599,14 @@ public class SweeperTaskModel {
|
||||
/**
|
||||
* 子任务开始上报
|
||||
*/
|
||||
public void subTaskStart(boolean isFirst,boolean isEnd,int subTaskId, SubTaskTypeEnum subTaskType) {
|
||||
SweeperServiceManager.subTaskStart(isFirst,isEnd,subTaskId, mContext, new OchCommonServiceCallback<BaseResponse<Boolean>>() {
|
||||
public void subTaskStart(boolean isFirst, boolean isEnd, int subTaskId, SubTaskTypeEnum subTaskType) {
|
||||
SweeperServiceManager.subTaskStart(isFirst, isEnd, subTaskId, mContext, new OchCommonServiceCallback<BaseResponse<Boolean>>() {
|
||||
@Override
|
||||
public void onSuccess(BaseResponse<Boolean> data) {
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "subTaskStart:"+GsonUtil.jsonFromObject(data));
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "subTaskStart:" + GsonUtil.jsonFromObject(data));
|
||||
if (mSweeperTaskCallback != null && data != null) {
|
||||
if (data.getData()) {
|
||||
isSubTaskWorking = true;
|
||||
mIsSubTaskWorking = true;
|
||||
isArriveSubTaskEndSite = false;
|
||||
mSweeperTaskCallback.updateSubTaskStatus(TaskStatusEnum.START_SUBTASK, false);
|
||||
if (subTaskType == SubTaskTypeEnum.AUTOPILOT_SUBTYPE) {//如果是自动驾驶子任务子开启自驾
|
||||
@@ -597,7 +614,7 @@ public class SweeperTaskModel {
|
||||
SweeperTaskModel.getInstance().startBeautificationMode();
|
||||
}
|
||||
startAutopilot(false);
|
||||
}else{
|
||||
} else {
|
||||
if (FunctionBuildConfig.isDemoMode) {//美化模式开启时
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = true;//是否强制绘制引导线
|
||||
CallerAutoPilotControlManager.INSTANCE.setIPCDemoMode(false);//是否自动启动自驾
|
||||
@@ -632,14 +649,14 @@ public class SweeperTaskModel {
|
||||
/**
|
||||
* 子任务结束上报
|
||||
*/
|
||||
public void subTaskEnd(boolean isFirst,boolean isEnd,int subTaskId) {
|
||||
SweeperServiceManager.subTaskEnd(isFirst,isEnd,subTaskId, mContext, new OchCommonServiceCallback<BaseResponse<Boolean>>() {
|
||||
public void subTaskEnd(boolean isFirst, boolean isEnd, int subTaskId) {
|
||||
SweeperServiceManager.subTaskEnd(isFirst, isEnd, subTaskId, mContext, new OchCommonServiceCallback<BaseResponse<Boolean>>() {
|
||||
@Override
|
||||
public void onSuccess(BaseResponse<Boolean> data) {
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "subTaskEnd:"+GsonUtil.jsonFromObject(data));
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "subTaskEnd:" + GsonUtil.jsonFromObject(data));
|
||||
if (mSweeperTaskCallback != null && data != null) {
|
||||
if (data.getData()) {
|
||||
isSubTaskWorking = false;
|
||||
mIsSubTaskWorking = false;
|
||||
isArriveSubTaskEndSite = true;
|
||||
mSweeperTaskCallback.updateSubTaskStatus(TaskStatusEnum.END_SUBTASK, isEnd);
|
||||
if (isEnd) {
|
||||
@@ -680,14 +697,14 @@ public class SweeperTaskModel {
|
||||
/**
|
||||
* 子任务跳过上报
|
||||
*/
|
||||
public void subTaskSkip(boolean isFirst,boolean isEnd,int subTaskId) {
|
||||
SweeperServiceManager.subTaskSkip(isFirst,isEnd,subTaskId, mContext, new OchCommonServiceCallback<BaseResponse<Boolean>>() {
|
||||
public void subTaskSkip(boolean isFirst, boolean isEnd, int subTaskId) {
|
||||
SweeperServiceManager.subTaskSkip(isFirst, isEnd, subTaskId, mContext, new OchCommonServiceCallback<BaseResponse<Boolean>>() {
|
||||
@Override
|
||||
public void onSuccess(BaseResponse<Boolean> data) {
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "subTaskSkip:"+GsonUtil.jsonFromObject(data));
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "subTaskSkip:" + GsonUtil.jsonFromObject(data));
|
||||
if (mSweeperTaskCallback != null && data != null) {
|
||||
if (data.getData()) {
|
||||
isSubTaskWorking=false;
|
||||
mIsSubTaskWorking = false;
|
||||
mSweeperTaskCallback.updateSubTaskStatus(TaskStatusEnum.JUMP_OVER_SUBTASK, isEnd);
|
||||
}
|
||||
}
|
||||
@@ -722,7 +739,7 @@ public class SweeperTaskModel {
|
||||
SweeperServiceManager.mainTaskReset(taskId, mContext, new OchCommonServiceCallback<BaseResponse<Boolean>>() {
|
||||
@Override
|
||||
public void onSuccess(BaseResponse<Boolean> data) {
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "mainTaskReset:"+GsonUtil.jsonFromObject(data));
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "mainTaskReset:" + GsonUtil.jsonFromObject(data));
|
||||
if (mSweeperTaskCallback != null && data != null) {
|
||||
mSweeperTaskCallback.setMainTaskReset(data.getData());
|
||||
}
|
||||
@@ -749,6 +766,7 @@ public class SweeperTaskModel {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//结束自动驾驶
|
||||
public void cancelAutoPilot() {
|
||||
CallerAutoPilotControlManager.INSTANCE.cancelAutoPilot();
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.mogo.och.sweeper.bean.SweeperMainTaskBean;
|
||||
import com.mogo.och.sweeper.bean.SweeperSubTaskDetailBean;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.Body;
|
||||
@@ -16,6 +17,7 @@ import retrofit2.http.Header;
|
||||
import retrofit2.http.Headers;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
import retrofit2.http.QueryMap;
|
||||
|
||||
/**
|
||||
* 清扫车相关接口
|
||||
@@ -43,21 +45,20 @@ public interface ISweeperApiService {
|
||||
* 清扫车子任务列表
|
||||
* @param appId
|
||||
* @param ticket
|
||||
* @param sn
|
||||
* @param taskId
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@GET("/och-sweep/api/task/v1/subTaskList")
|
||||
Observable<BaseResponse<List<SubInfo>>> getSubTaskList(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("carSn") String sn, @Query("taskId") int taskId);
|
||||
Observable<BaseResponse<List<SubInfo>>> getSubTaskList(@Header ("appId") String appId, @Header("ticket") String ticket, @QueryMap Map<String, String> map);
|
||||
/**
|
||||
* 子任务详情 包括子任务轨迹信息
|
||||
* @param appId
|
||||
* @param ticket
|
||||
* @param carSn
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@GET("/och-sweep/api/task/v1/subTaskInfo")
|
||||
Observable<BaseResponse<SweeperSubTaskDetailBean>> getSubTaskDetail(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("carSn") String carSn ,@Query("taskId") int taskId);
|
||||
Observable<BaseResponse<SweeperSubTaskDetailBean>> getSubTaskDetail(@Header ("appId") String appId, @Header("ticket") String ticket, @QueryMap Map<String, String> map);
|
||||
|
||||
/**
|
||||
* 子任务开始
|
||||
@@ -95,10 +96,9 @@ public interface ISweeperApiService {
|
||||
* 主任务重置
|
||||
* @param appId
|
||||
* @param ticket
|
||||
* @param taskId
|
||||
* @return
|
||||
*/
|
||||
@GET("/och-sweep/api/task/v1/mainTaskReset")
|
||||
Observable<BaseResponse<Boolean>> mainTaskReset(@Header ("appId") String appId, @Header("ticket") String ticket,@Query("carSn") String carSn, @Query("taskId") int taskId);
|
||||
Observable<BaseResponse<Boolean>> mainTaskReset(@Header ("appId") String appId, @Header("ticket") String ticket,@QueryMap Map<String, String> map);
|
||||
}
|
||||
|
||||
|
||||
@@ -51,11 +51,14 @@ object SweeperServiceManager {
|
||||
*/
|
||||
@JvmStatic
|
||||
fun getSubTaskList(taskId: Int, context: Context, callback: OchCommonServiceCallback<BaseResponse<MutableList<SubInfo>>>?) {
|
||||
val map= hashMapOf<String,String>()
|
||||
map["carSn"] = MoGoAiCloudClientConfig.getInstance().sn
|
||||
map["taskId"] = taskId.toString()
|
||||
d(SceneConstant.M_SWEEPER + TAG, "getSubTaskDetail:" + GsonUtil.jsonFromObject(map))
|
||||
mService.getSubTaskList(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
MoGoAiCloudClientConfig.getInstance().sn,
|
||||
taskId
|
||||
map
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "getSubTaskList"))
|
||||
@@ -66,11 +69,14 @@ object SweeperServiceManager {
|
||||
*/
|
||||
@JvmStatic
|
||||
fun getSubTaskDetail(subTaskId: Int, context: Context, callback: OchCommonServiceCallback<BaseResponse<SweeperSubTaskDetailBean>>?) {
|
||||
val map= hashMapOf<String,String>()
|
||||
map["carSn"] = MoGoAiCloudClientConfig.getInstance().sn
|
||||
map["taskId"] = subTaskId.toString()
|
||||
d(SceneConstant.M_SWEEPER + TAG, "getSubTaskDetail:" + GsonUtil.jsonFromObject(map))
|
||||
mService.getSubTaskDetail(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
MoGoAiCloudClientConfig.getInstance().sn,
|
||||
subTaskId
|
||||
map
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "getSubTaskList"))
|
||||
@@ -129,11 +135,14 @@ object SweeperServiceManager {
|
||||
*/
|
||||
@JvmStatic
|
||||
fun mainTaskReset(taskId: Int,context: Context, callback: OchCommonServiceCallback<BaseResponse<Boolean>>?) {
|
||||
val map= hashMapOf<String,String>()
|
||||
map["carSn"] = MoGoAiCloudClientConfig.getInstance().sn
|
||||
map["taskId"] = taskId.toString()
|
||||
d(SceneConstant.M_SWEEPER + TAG, "mainTaskReset:" + GsonUtil.jsonFromObject(map))
|
||||
mService.mainTaskReset(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
MoGoAiCloudClientConfig.getInstance().sn,
|
||||
taskId
|
||||
map
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "mainTaskReset"))
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.mogo.och.sweeper.presenter;
|
||||
import android.os.Looper;
|
||||
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.amap.api.navi.model.NaviLatLng;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||
@@ -17,7 +16,6 @@ import com.mogo.eagle.core.function.call.autopilot.CallerSweeperFutianCleanSyste
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.common.module.manager.OCHAdasAbilityManager;
|
||||
import com.mogo.och.common.module.map.AmapNaviToDestinationModel;
|
||||
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil;
|
||||
import com.mogo.och.sweeper.bean.SweeperMainTaskBean;
|
||||
import com.mogo.och.sweeper.bean.SweeperSubTaskBean;
|
||||
@@ -62,8 +60,6 @@ public class SweeperPresenter extends Presenter<SweeperFragment>
|
||||
private static final String TAG = "SweeperPresenter";
|
||||
//当前子任务id
|
||||
private int mSubTaskId = 0;
|
||||
//当前是否最后一个子任务
|
||||
private boolean mIsLastSubtask = false;
|
||||
// 清扫模式回调时间间隔
|
||||
private static final long VEHICLE_STATE_INTERVAL_MILLIS = 500L;
|
||||
// 清扫模式当前时间戳
|
||||
@@ -118,7 +114,8 @@ public class SweeperPresenter extends Presenter<SweeperFragment>
|
||||
@Override
|
||||
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autopilotStatusInfo) {
|
||||
if (autopilotStatusInfo == null) return;
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG,"onAutopilotStatusResponse sate:"+autopilotStatusInfo.getState());
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG,"onAutopilotStatusResponse state:"+autopilotStatusInfo.getState());
|
||||
SweeperTaskModel.getInstance().setAutopilotState(autopilotStatusInfo.getState());
|
||||
switch (autopilotStatusInfo.getState()) {
|
||||
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE://不可自动驾驶
|
||||
runOnUIThread(() -> mView.readyTaskBtn(false, false));
|
||||
@@ -362,8 +359,8 @@ public class SweeperPresenter extends Presenter<SweeperFragment>
|
||||
/**
|
||||
* 获取子任务详情包括轨迹文件信息
|
||||
*/
|
||||
public void getSubTaskDetail(int subTaskId, SubTaskTypeEnum subTaskType) {
|
||||
SweeperTaskModel.getInstance().getSubTaskDetail(subTaskId, subTaskType);
|
||||
public void getSubTaskDetail(boolean isFirst,boolean isEnd,int subTaskId, SubTaskTypeEnum subTaskType,boolean isStartSubtask) {
|
||||
SweeperTaskModel.getInstance().getSubTaskDetail(isFirst,isEnd,subTaskId, subTaskType,isStartSubtask);
|
||||
}
|
||||
/**
|
||||
* 子任务开始上报
|
||||
@@ -379,6 +376,10 @@ public class SweeperPresenter extends Presenter<SweeperFragment>
|
||||
} else {
|
||||
if (subTaskStatus==1){//子任务未执行,则开始执行
|
||||
SweeperTaskModel.getInstance().subTaskStart(isFirst,isEnd,subTaskId, subTaskType);
|
||||
}else{
|
||||
if (subTaskType == SubTaskTypeEnum.AUTOPILOT_SUBTYPE) {
|
||||
SweeperTaskModel.getInstance().startAutopilot();
|
||||
}
|
||||
}
|
||||
}
|
||||
// AutopilotControlParameters parameters = new AutopilotControlParameters();
|
||||
|
||||
@@ -5,6 +5,8 @@ import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||
import com.mogo.och.sweeper.R
|
||||
import com.mogo.och.sweeper.bean.SubInfo
|
||||
@@ -18,6 +20,7 @@ import kotlinx.android.synthetic.main.sweeper_current_task_info.view.*
|
||||
* 清扫车当前任务信息展示
|
||||
*/
|
||||
class SweeperCurrentTaskInfoView : ConstraintLayout {
|
||||
private val TAG:String="SweeperCurrentTaskInfoView"
|
||||
//当前任务操作菜单
|
||||
private var mTaskMenuPopWindow: MenuPopWindow? = null
|
||||
private var presenter: SweeperPresenter? = null
|
||||
@@ -85,7 +88,8 @@ class SweeperCurrentTaskInfoView : ConstraintLayout {
|
||||
* 设置准备就绪按钮时都可以点击
|
||||
*/
|
||||
fun setEnableClickBtn(isClick: Boolean, isPause: Boolean) {
|
||||
if (mSubTaskType.code == SubTaskTypeEnum.MANUAL_DRIVING_SUBTYPE.code) {
|
||||
CallerLogger.d(SceneConstant.M_SWEEPER + TAG, "setEnableClickBtn isClick:${isClick} isPause:${isPause}")
|
||||
if (mSubTaskType.code == SubTaskTypeEnum.MANUAL_DRIVING_SUBTYPE.code) {//人工驾驶子任务
|
||||
tvTaskState.text = "暂未准备"
|
||||
tvTaskState.setBackgroundResource(R.drawable.bg_shape_task_state_not_ready)
|
||||
readyTaskBtn.text = "准备出发"
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
android:background="@drawable/bg_shape_work_mode"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/sweeper_arc"
|
||||
android:visibility="visible"/>
|
||||
android:visibility="gone"/>
|
||||
<!--清扫任务当前面板-->
|
||||
<com.mogo.och.sweeper.view.SweeperCurrentTaskInfoView
|
||||
android:id="@+id/sweeper_current_task_view"
|
||||
@@ -26,7 +26,7 @@
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@+id/sweeper_switch_model_layout"
|
||||
android:layout_marginTop="@dimen/dp_36"
|
||||
android:visibility="visible"
|
||||
android:visibility="gone"
|
||||
android:layout_weight="1"
|
||||
/>
|
||||
<FrameLayout
|
||||
@@ -114,6 +114,6 @@
|
||||
/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
<include layout="@layout/sweeper_no_data_common_view"
|
||||
android:visibility="gone"/>
|
||||
android:visibility="visible"/>
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
@@ -2,8 +2,7 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<com.amap.api.maps.TextureMapView
|
||||
android:id="@+id/sweeperTextureMapView"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
Reference in New Issue
Block a user