[sweeper-cloud]
refactor: 接收自动驾驶轨迹 加上时间间隔过滤; refactor: 人工驾驶子任务因为MAP问题,先过滤掉; log: 增加 红绿灯 日志打印;
This commit is contained in:
@@ -1,7 +1,13 @@
|
||||
package com.mogo.och.sweepercloud.model;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_SWEEPER;
|
||||
import static com.mogo.och.sweepercloud.util.SweeperCloudTaskUtils.printMessage;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
@@ -50,8 +56,6 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import chassis.ChassisStatesOuterClass;
|
||||
import io.reactivex.exceptions.UndeliverableException;
|
||||
import io.reactivex.functions.Consumer;
|
||||
@@ -61,9 +65,6 @@ import mogo_msg.MogoReportMsg;
|
||||
import planning.RoboSweeperTaskIndexOuterClass;
|
||||
import system_master.SystemStatusInfo;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_SWEEPER;
|
||||
import static com.mogo.och.sweepercloud.util.SweeperCloudTaskUtils.printMessage;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/3/23
|
||||
@@ -95,6 +96,11 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
// 贴边数据当前时间戳
|
||||
private long mWeltDataCurrentTimeMillis;
|
||||
|
||||
// 轨迹数据回调时间间隔
|
||||
private static final long ROUTE_DATA_INTERVAL_MILLIS = 1000L;
|
||||
// 轨迹数据当前时间戳
|
||||
private long mRouteDataCurrentTimeMillis;
|
||||
|
||||
private String longitude;//经度
|
||||
|
||||
private String latitude;//纬度
|
||||
@@ -191,6 +197,15 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
public void onAutopilotRotting(MessagePad.GlobalPathResp routeList) {
|
||||
if (null != routeList && routeList.getWayPointsList() != null && routeList.getWayPointsList().size() > 0) {
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG,"onAutopilotRotting: "+printMessage(routeList));
|
||||
|
||||
// MAP返回路线信息,在1秒内返回了2次,这里加上数据过滤
|
||||
long current = System.currentTimeMillis();
|
||||
if (current - mRouteDataCurrentTimeMillis <= ROUTE_DATA_INTERVAL_MILLIS) {
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG,"onAutopilotRotting: interval <=" + ROUTE_DATA_INTERVAL_MILLIS + " data is abandon");
|
||||
return;
|
||||
}
|
||||
mRouteDataCurrentTimeMillis = current;
|
||||
|
||||
if (mCurrentLineId != mLineId) {//判断是否同一条路线
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG,"onAutopilotRotting: mCurrentLineId"+mCurrentLineId+"mLineId:"+mLineId);
|
||||
mLineId = mCurrentLineId;
|
||||
@@ -415,18 +430,26 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
if (roboSweeperTaskIndex == null) {
|
||||
return;
|
||||
}
|
||||
//没有任务数据时,不处理贴边
|
||||
if (!isHasTaskInfo){
|
||||
return;
|
||||
}
|
||||
|
||||
long current = System.currentTimeMillis();
|
||||
if (current - mWeltDataCurrentTimeMillis <= WELT_DATA_INTERVAL_MILLIS) {
|
||||
return;
|
||||
}
|
||||
mWeltDataCurrentTimeMillis = current;
|
||||
|
||||
//没有任务数据时,不处理贴边
|
||||
if (!isHasTaskInfo){
|
||||
return;
|
||||
}
|
||||
|
||||
//人工子任务 当前因为云控需求时MAP不能获取任务状态,在人工子任务时还是返回的上一个任务的贴边数据
|
||||
// 所以 20230529 暂时过滤掉,待后面MAP处理后这里的过滤可以删除
|
||||
if (mSubTaskType == SweeperTask.TaskModel.MANUAL) {
|
||||
return;
|
||||
}
|
||||
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "mSubTaskType:"+mSubTaskType+"+ onSweeperFutianTaskIndexData:" + printMessage(roboSweeperTaskIndex));
|
||||
handleWeltData(roboSweeperTaskIndex);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -487,11 +510,6 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG,
|
||||
"getCurrentTask:" + printMessage(getTaskReq) + " reqNo:" + reqNo + " messageType:" + SweeperCloudTask.MessageType.PadSendGetTaskReq.getNumber());
|
||||
getAutoPilotControlManager().sendSweeperGetTaskReq(reqNo, getTaskReq);
|
||||
// TODO: 2023/5/5 模拟云控获取任务
|
||||
// UiThreadHandler.postDelayed(() -> {
|
||||
// SweeperCloudTaskUtils.mockSendCloudTaskInfo(SweeperCloudTask.MessageType.PadSendGetTaskReq);
|
||||
// }, 1000);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -70,6 +70,7 @@ class SweeperTrafficLightView @JvmOverloads constructor(
|
||||
sweeper_traffic_light_iv.setImageResource(R.drawable.sweeper_light_gay_nor)
|
||||
sweeper_traffic_light_time_tv.text = ""
|
||||
this@SweeperTrafficLightView.visibility = VISIBLE
|
||||
CallerLogger.d(SceneConstant.M_SWEEPER + TAG,"灯态类型:disableTrafficLight")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user