[清扫车]上装逻辑修改

This commit is contained in:
bxb
2023-02-08 15:56:38 +08:00
parent 4e2dee116a
commit e6a7d291c6
11 changed files with 231 additions and 135 deletions

View File

@@ -7,8 +7,6 @@ import com.amap.api.navi.model.NaviLatLng
import com.mogo.och.common.module.map.AmapNaviToDestinationModel
import com.mogo.och.sweeper.R
import com.mogo.och.sweeper.bean.TaskInfoBean
import com.mogo.och.sweeper.callback.CleaningModeStateCallback
import com.mogo.och.sweeper.constant.OperateStateEnum
import com.mogo.och.sweeper.constant.TaskMenuTypeEnum
import com.mogo.och.sweeper.presenter.SweeperPresenter
import com.mogo.och.sweeper.ui.adapter.TaskListAdapter
@@ -24,6 +22,7 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
private var mPosition: Int = -1
private val mutableList: MutableList<TaskInfoBean> by lazy { mutableListOf() }
private var subTaskType:Int=1;//1:自动驾驶子任务 2人工驾驶子任务
private var cleanSystemState: ChassisStatesOuterClass.SweeperFuTianTaskSystemStates?=null
//当前经纬度
private var mCurLatitude = 0.0
@@ -101,8 +100,10 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
workModePanelView.visibility = View.VISIBLE
setShowCurrentTaskPanelView(true)
currentTaskPanelView.setData(workModePanelView,mutableList, mPosition,this)
//mock数据
workModePanelView.setSweeperFutianCleanSystemState(subTaskType,SweeperFutianCmdUtil.buildSweeperFuTionCleanSystemStateMockData(),trafficDataView)
workModePanelView.setSweeperFutianCleanSystemState(subTaskType,if(cleanSystemState==null) SweeperFutianCmdUtil.buildSweeperFuTionCleanSystemStateMockData() else cleanSystemState,trafficDataView)
}
currentTaskPanelView.getReadyTaskBtn().setOnClickListener {
mPresenter?.startAutopilot()
}
}
@@ -131,6 +132,7 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
}
fun onSweeperFutianCleanSystemState(cleanSystemState: ChassisStatesOuterClass.SweeperFuTianTaskSystemStates) {
this.cleanSystemState=cleanSystemState
workModePanelView.setSweeperFutianCleanSystemState(subTaskType,cleanSystemState,trafficDataView)
}
/**

View File

@@ -1,16 +1,22 @@
package com.mogo.och.sweeper.presenter;
import android.os.Looper;
import android.util.Log;
import com.elegant.network.utils.GsonUtil;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.mvp.Presenter;
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoSweeperFutianCleanSystemListener;
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.CallerSweeperFutianCleanSystemListenerManager;
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.utils.PinYinUtil;
import com.mogo.och.sweeper.callback.ISweeperADASStatusCallback;
import com.mogo.och.sweeper.callback.ISweeperControllerStatusCallback;
import com.mogo.och.sweeper.fragment.SweeperFragment;
@@ -29,6 +35,8 @@ import mogo_msg.MogoReportMsg;
import planning.RoboSweeperTaskIndexOuterClass;
import system_master.SystemStatusInfo;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS;
/**
* 网约车小巴
*
@@ -143,7 +151,38 @@ public class SweeperPresenter extends Presenter<SweeperFragment>
executor.run();
}
}
public void startAutopilot(){
AutopilotControlParameters parameters = new AutopilotControlParameters();
parameters.isSpeakVoice = true;
parameters.routeID = 164;
parameters.routeName = "bus5KM小董";
parameters.startName = PinYinUtil.getPinYinHeadChar("鹰眼270-13号路口起");
parameters.endName = PinYinUtil.getPinYinHeadChar("老干部演绎中心11223");
parameters.startLatLon = new AutopilotControlParameters
.AutoPilotLonLat( 40.199247410363796,116.73367125257714 );
parameters.endLatLon = new AutopilotControlParameters
.AutoPilotLonLat(40.20237, 116.74481 );
parameters.vehicleType = 10;
if (parameters.autoPilotLine == null) {
parameters.autoPilotLine = new AutopilotControlParameters.AutoPilotLine(
164,
"/home/mogo/data/vehicle_monitor/MapEngine_data/track_record_data/JL/traj_164.csv",
"",
"/home/mogo/data/vehicle_monitor/MapEngine_data/track_record_data/JL/stop_164.txt",
"",
1662021611000L,
"金旅牌XML6606JEVY0",
"",
"",
"",
"",
0L);
}
// CallerLogger.INSTANCE.d( M_BUS + TAG, "开启自动驾驶====" + GsonUtil.jsonFromObject(parameters)
// +" startLatLon="+currentStation.getName()+"endLatLon="+nextStation.getName());
CallerLogger.INSTANCE.d( M_BUS + TAG, "开启自动驾驶====" + GsonUtil.jsonFromObject(parameters));
CallerAutoPilotManager.INSTANCE.startAutoPilot(parameters);
}
/**
* 测试使用
*

View File

@@ -30,10 +30,12 @@ import chassis.ChassisStatesOuterClass;
import chassis.SpecialVehicleTaskCmdOuterClass;
import static com.mogo.och.sweeper.util.SweeperFutianCmdUtil.CLEAN_DIRECTION_BOTH_SIDE;
import static com.mogo.och.sweeper.util.SweeperFutianCmdUtil.CLEAN_DIRECTION_CLOSE;
import static com.mogo.och.sweeper.util.SweeperFutianCmdUtil.CLEAN_DIRECTION_LEFT_SIDE;
import static com.mogo.och.sweeper.util.SweeperFutianCmdUtil.CLEAN_DIRECTION_RIGHT_SIDE;
import static com.mogo.och.sweeper.util.SweeperFutianCmdUtil.CLEAN_INTENSITY_STRAND;
import static com.mogo.och.sweeper.util.SweeperFutianCmdUtil.CLEAN_INTENSITY_STRONG;
import static com.mogo.och.sweeper.util.SweeperFutianCmdUtil.CLEAN_MODE_CLOSE;
import static com.mogo.och.sweeper.util.SweeperFutianCmdUtil.CLEAN_MODE_PURE_DRAW;
import static com.mogo.och.sweeper.util.SweeperFutianCmdUtil.CLEAN_MODE_PURE_SWEEP;
import static com.mogo.och.sweeper.util.SweeperFutianCmdUtil.CLEAN_MODE_PURE_WASH;
@@ -108,18 +110,14 @@ public class SweeperOperatePanelView extends LinearLayout {
};
private boolean isSelectPureSweepMode = false;//用于标注是否选中纯扫
private boolean isFirst=false;//是否首次打开
private static boolean isResetWorkMode=false;//是否点击复位
private static boolean isResetWorkMode = false;//是否点击复位
private CleaningModeStateCallback cleaningModeStateCallback;
private int count=0;
private int count = 0;
private ChassisStatesOuterClass.SweeperFuTianTaskSystemStates mCleanSystemState;//当前作业模式
//设置清扫模式数据
private static ChassisStatesOuterClass.SweeperFuTianTaskSystemStates.Builder builder =
ChassisStatesOuterClass.SweeperFuTianTaskSystemStates.newBuilder();
private static ChassisStatesOuterClass.SweeperFuTianTaskSystemStates mCurrentCleanSystemState;//当前作业模式
private ChassisStatesOuterClass.SweeperFuTianTaskSystemStates mCleanSystemState;//原有的作业模式
public SweeperOperatePanelView(Context context) {
super(context);
@@ -189,25 +187,12 @@ public class SweeperOperatePanelView extends LinearLayout {
&& currentChoosedModeBtnView.getId() == currentClickView.getId();
//是否纯吸View
boolean isPureAbsorptionClick = currentClickView.getId() == R.id.btn_clean_mode_pure_absorption;
builder.setSecuWorkTonSts(isPureAbsorptionClick && !isClickCurrentChoosedModeBtn);
//是否纯洗View
boolean isPureWashClick = currentClickView.getId() == R.id.btn_clean_mode_pure_wash;
builder.setSecuModWashSts(isPureWashClick && !isClickCurrentChoosedModeBtn);
//是否纯扫View
boolean isPureSweepClick = currentClickView.getId() == R.id.btn_clean_mode_pure_sweep;
if (isPureSweepClick){
builder.setSecuWorkTonSts(false);
builder.setSecuModWashSts(false);
builder.setSecuModWashSweepSts(false);
}
//是否洗扫View
boolean isWashSweepClick = currentClickView.getId() == R.id.btn_clean_mode_sweep_wash;
builder.setSecuModWashSweepSts(isWashSweepClick && !isClickCurrentChoosedModeBtn);
if (isPureAbsorptionClick) {
builder.setSecuWorkStandSts(true);
}else{
builder.setSecuWorkStandSts(false);
}
CmdRequestCallback cmdRequestCallback = new CmdRequestCallback() {
@Override
public void onSendCmd() {
@@ -329,14 +314,6 @@ public class SweeperOperatePanelView extends LinearLayout {
boolean isLeftSide = currentClickView.getId() == R.id.btn_clean_direction_left_side;
boolean isRightSide = currentClickView.getId() == R.id.btn_clean_direction_right_side;
boolean isBothSide = currentClickView.getId() == R.id.btn_clean_direction_both_side;
builder.setSecuWorkLeftSts(isLeftSide && !isClickCurrentChoosedDirectionBtn);
builder.setSecuWorkRightSts(isRightSide && !isClickCurrentChoosedDirectionBtn);
builder.setSecuWorkOnBothsidesSts(isBothSide && !isClickCurrentChoosedDirectionBtn);
if (!isClickCurrentChoosedDirectionBtn) {
builder.setSecuWorkStandSts(true);
}else{
builder.setSecuWorkStandSts(false);
}
CmdRequestCallback cmdRequestCallback = new CmdRequestCallback() {
@Override
public void onSendCmd() {
@@ -438,9 +415,7 @@ public class SweeperOperatePanelView extends LinearLayout {
return;
}
boolean isStandardBtnClick = currentClickView.getId() == R.id.btn_clean_intensity_standard;
builder.setSecuWorkStandSts(isStandardBtnClick);
boolean isStrongBtnClick = currentClickView.getId() == R.id.btn_clean_intensity_strong;
builder.setSecuWorkStrongSts(isStrongBtnClick);
CmdRequestCallback cmdRequestCallback = new CmdRequestCallback() {
@Override
public void onSendCmd() {
@@ -596,7 +571,6 @@ public class SweeperOperatePanelView extends LinearLayout {
/**
* 发送命令后等待时展示loading
*
*
* @param timeout
*/
private void showLoadingMask(int timeout) {
@@ -620,7 +594,7 @@ public class SweeperOperatePanelView extends LinearLayout {
));
mLoadingHintBottom.setVisibility(timeout < 0 ? View.INVISIBLE : View.VISIBLE);
if (cleaningModeStateCallback != null && timeout > 0) {
cleaningModeStateCallback.cleaningModeState(OperateStateEnum.STARTING_STATUS, builder.build(), isSelectPureSweepMode);
cleaningModeStateCallback.cleaningModeState(OperateStateEnum.STARTING_STATUS, mCurrentCleanSystemState, isSelectPureSweepMode);
}
});
}
@@ -655,7 +629,7 @@ public class SweeperOperatePanelView extends LinearLayout {
*/
private void showCmdExecuteSuccessToast() {
if (cleaningModeStateCallback != null) {
cleaningModeStateCallback.cleaningModeState(OperateStateEnum.SUCCESS_STATUS, builder.build(), isSelectPureSweepMode);
cleaningModeStateCallback.cleaningModeState(OperateStateEnum.SUCCESS_STATUS,mCurrentCleanSystemState, isSelectPureSweepMode);
}
ToastUtils.showLong("设备已响应,操作成功");
}
@@ -685,26 +659,24 @@ public class SweeperOperatePanelView extends LinearLayout {
});
}
public void setSweeperFutianCleanSystemState(@NonNull ChassisStatesOuterClass.SweeperFuTianTaskSystemStates cleanSystemState,
public void setSweeperFutianCleanSystemState(ChassisStatesOuterClass.SweeperFuTianTaskSystemStates cleanSystemState,
CleaningModeStateCallback cleaningModeStateCallback) {
this.cleaningModeStateCallback = cleaningModeStateCallback;
if (!isFirst){
this.mCleanSystemState=cleanSystemState;
isFirst=true;
}
if (isResetWorkMode){
isResetWorkMode=false;
resetSuccess(cleanSystemState);
}
this.mCleanSystemState = cleanSystemState;
//hideLoadingMask();
// if (isResetWorkMode){
// isResetWorkMode=false;
// resetSuccess(cleanSystemState);
// }
onSyncVehicleStateCallBack(cleanSystemState);
// 有命令正在执行
// if (mCurrentCmdRequestCallback != null) {
// Log.d(TAG, "getSecuWorkLeftSts = " + cleanSystemState.getSecuWorkLeftSts());
// if (mCurrentCmdRequestCallback.onCheckIfCmdSuccess(cleanSystemState)) {
// mCurrentCmdRequestCallback.onCmdSuccess();
// mCurrentCmdRequestCallback = null;
// }
// }
if (mCurrentCmdRequestCallback != null) {
Log.d(TAG, "getSecuWorkLeftSts = " + cleanSystemState.getSecuWorkLeftSts());
if (mCurrentCmdRequestCallback.onCheckIfCmdSuccess(cleanSystemState)) {
mCurrentCmdRequestCallback.onCmdSuccess();
mCurrentCmdRequestCallback = null;
}
}
}
@Override
@@ -826,12 +798,12 @@ public class SweeperOperatePanelView extends LinearLayout {
msg.obj = timeout;
mSweeperOperateCmdHandler.sendMessage(msg);
// Mock Cmd Success
mockSendCmdSuccess();
mockCleanModeSuccess(fuTianCleanCmd);
}
private void mockSendCmdSuccess() {
Message successMsg = Message.obtain();
successMsg.what = MSG_CMD_EXECUTE_MOCK_SUCCESS;
successMsg.what=MSG_CMD_EXECUTE_MOCK_SUCCESS;
mSweeperOperateCmdHandler.sendMessageDelayed(successMsg, 1000L * CMD_EXECUTE_MOCK_SUCCESS_SECONDS);
}
@@ -853,69 +825,67 @@ public class SweeperOperatePanelView extends LinearLayout {
* 复位
*/
private void onOperateReset() {
if (mCleanSystemState!=null){
isResetWorkMode=true;
if (mCleanSystemState != null) {
isResetWorkMode = true;
// 洗扫
if (mCleanSystemState.getSecuModWashSweepSts()){
if (mCurrentCleanSystemState.getSecuModWashSweepSts() || mCurrentCleanSystemState.getSecuModWashSts() || mCurrentCleanSystemState.getSecuWorkTonSts() || SweeperFutianCmdUtil.checkIfCleanModePureSweep(mCurrentCleanSystemState)) {;
sendFuTianTaskCmd(SweeperFutianCmdUtil.buildCleanModeCloseCmd());
}
// 左侧
if (mCurrentCleanSystemState.getSecuWorkLeftSts() || mCurrentCleanSystemState.getSecuWorkRightSts() || mCurrentCleanSystemState.getSecuWorkOnBothsidesSts()) {
sendFuTianTaskCmd(SweeperFutianCmdUtil.buildCleanDirectionCloseCmd());
}
// 洗扫
if (mCurrentCleanSystemState.getSecuModWashSweepSts()) {
count++;
// 发送命令
sendFuTianTaskCmd(SweeperFutianCmdUtil.buildCleanModeCmd(CLEAN_MODE_WASH_SWEEP));
builder.setSecuModWashSweepSts(true);
}
// 纯洗
if (mCleanSystemState.getSecuModWashSts()){
if (mCleanSystemState.getSecuModWashSts()) {
count++;
sendFuTianTaskCmd(SweeperFutianCmdUtil.buildCleanModeCmd(CLEAN_MODE_PURE_WASH));
builder.setSecuModWashSts(true);
}
// 纯吸
if (mCleanSystemState.getSecuWorkTonSts()){
if (mCleanSystemState.getSecuWorkTonSts()) {
count++;
sendFuTianTaskCmd(SweeperFutianCmdUtil.buildCleanModeCmd(CLEAN_MODE_PURE_DRAW));
builder.setSecuWorkTonSts(true);
}
//纯扫
if (SweeperFutianCmdUtil.checkIfCleanModePureSweep(mCleanSystemState)){
if (SweeperFutianCmdUtil.checkIfCleanModePureSweep(mCleanSystemState)) {
count++;
sendFuTianTaskCmd(SweeperFutianCmdUtil.buildCleanModeCmd(CLEAN_MODE_PURE_SWEEP));
builder.setSecuModWashSweepSts(false);
builder.setSecuModWashSts(false);
builder.setSecuWorkTonSts(false);
}
// 左侧
if(mCleanSystemState.getSecuWorkLeftSts()){
if (mCleanSystemState.getSecuWorkLeftSts()) {
count++;
sendFuTianTaskCmd(SweeperFutianCmdUtil.buildCleanDirectionCmd(CLEAN_DIRECTION_LEFT_SIDE));
builder.setSecuWorkLeftSts(true);
}
// 右侧
if(mCleanSystemState.getSecuWorkRightSts()){
if (mCleanSystemState.getSecuWorkRightSts()) {
count++;
sendFuTianTaskCmd(SweeperFutianCmdUtil.buildCleanDirectionCmd(CLEAN_DIRECTION_RIGHT_SIDE));
builder.setSecuWorkRightSts(true);
}
// 两侧
if(mCleanSystemState.getSecuWorkOnBothsidesSts()){
if (mCleanSystemState.getSecuWorkOnBothsidesSts()) {
count++;
sendFuTianTaskCmd(SweeperFutianCmdUtil.buildCleanDirectionCmd(CLEAN_DIRECTION_BOTH_SIDE));
builder.setSecuWorkOnBothsidesSts(true);
}
//标准
if (mCleanSystemState.getSecuWorkStandSts()){
if (mCleanSystemState.getSecuWorkStandSts()) {
count++;
sendFuTianTaskCmd(SweeperFutianCmdUtil.buildCleanIntensityCmd(CLEAN_INTENSITY_STRAND));
builder.setSecuWorkStandSts(true);
}
//强力
if (mCleanSystemState.getSecuWorkStrongSts()){
if (mCleanSystemState.getSecuWorkStrongSts()) {
count++;
sendFuTianTaskCmd(SweeperFutianCmdUtil.buildCleanIntensityCmd(CLEAN_INTENSITY_STRONG));
builder.setSecuWorkStrongSts(true);
}
mCurrentCmdRequestCallback=new CmdRequestCallback() {
mCurrentCmdRequestCallback = new CmdRequestCallback() {
@Override
public void onSendCmd() {
showLoadingMask(count*CMD_EXECUTE_TIMEOUT_SECONDS);
showLoadingMask(count * CMD_EXECUTE_TIMEOUT_SECONDS);
}
@Override
@@ -926,50 +896,49 @@ public class SweeperOperatePanelView extends LinearLayout {
@Override
public boolean onCheckIfCmdSuccess(ChassisStatesOuterClass.SweeperFuTianTaskSystemStates cleanSystemState) {
// 洗扫
if (cleanSystemState.getSecuModWashSweepSts()){
if (cleanSystemState.getSecuModWashSweepSts()) {
count--;
}
// 纯洗
if (cleanSystemState.getSecuModWashSts()){
if (cleanSystemState.getSecuModWashSts()) {
count--;
}
// 纯吸
if (cleanSystemState.getSecuWorkTonSts()){
if (cleanSystemState.getSecuWorkTonSts()) {
count--;
}
//纯扫
if (SweeperFutianCmdUtil.checkIfCleanModePureSweep(cleanSystemState)){
if (SweeperFutianCmdUtil.checkIfCleanModePureSweep(cleanSystemState)) {
count--;
}
// 左侧
if(cleanSystemState.getSecuWorkLeftSts()){
if (cleanSystemState.getSecuWorkLeftSts()) {
count--;
}
// 右侧
if(cleanSystemState.getSecuWorkRightSts()){
if (cleanSystemState.getSecuWorkRightSts()) {
count--;
}
// 两侧
if(cleanSystemState.getSecuWorkOnBothsidesSts()){
if (cleanSystemState.getSecuWorkOnBothsidesSts()) {
count--;
}
//标准
if (cleanSystemState.getSecuWorkStandSts()){
if (cleanSystemState.getSecuWorkStandSts()) {
count--;
}
//强力
if (cleanSystemState.getSecuWorkStrongSts()){
if (cleanSystemState.getSecuWorkStrongSts()) {
count--;
}
return count==0;
return count == 0;
}
@Override
public void onCmdSuccess() {
mCleanSystemState=builder.build();
resetSuccess(mCleanSystemState);
hideLoadingMask();
showCmdExecuteSuccessToast();
resetSuccess(mCurrentCleanSystemState);
hideLoadingMask();
showCmdExecuteSuccessToast();
}
@@ -980,7 +949,7 @@ public class SweeperOperatePanelView extends LinearLayout {
@Override
public void onCmdTimeout() {
runOnUIThread(()->{
runOnUIThread(() -> {
hideLoadingMask();
showCmdExecuteTimeoutToast();
});
@@ -991,27 +960,31 @@ public class SweeperOperatePanelView extends LinearLayout {
// 开启倒计时
Message msg = Message.obtain();
msg.what = MSG_CMD_EXECUTE_COUNT_DOWN;
msg.obj = count*CMD_EXECUTE_TIMEOUT_SECONDS;
msg.obj = count * CMD_EXECUTE_TIMEOUT_SECONDS;
mSweeperOperateCmdHandler.sendMessage(msg);
// Mock Cmd Success
mockSendCmdSuccess();
//mockSendCmdSuccess();
}
}
/**
* 发送指令
*/
private void sendFuTianTaskCmd(SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd fuTianTaskCmd){
private void sendFuTianTaskCmd(SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd fuTianTaskCmd) {
//mock
mockCleanModeSuccess(fuTianTaskCmd);
CallerAutoPilotManager.INSTANCE.sendSweeperFuTianTaskCmd(fuTianTaskCmd);
// log发送命令
logSweeperCmdValue(fuTianTaskCmd);
}
/**
* 重置成功
*/
private void resetSuccess(ChassisStatesOuterClass.SweeperFuTianTaskSystemStates cleanSystemState){
private void resetSuccess(ChassisStatesOuterClass.SweeperFuTianTaskSystemStates cleanSystemState) {
onSyncVehicleStateCallBack(cleanSystemState);
}
private final static SweeperOperateCmdHandler mSweeperOperateCmdHandler = new SweeperOperateCmdHandler();
private static CmdRequestCallback mCurrentCmdRequestCallback;//发送命令后的回调
private static final int MSG_CMD_EXECUTE_COUNT_DOWN = 10001;
@@ -1044,7 +1017,7 @@ public class SweeperOperatePanelView extends LinearLayout {
}
} else if (msg.what == MSG_CMD_EXECUTE_MOCK_SUCCESS) {
if (mCurrentCmdRequestCallback != null) {
if (mCurrentCmdRequestCallback.onCheckIfCmdSuccess(builder.build())) {
if (mCurrentCmdRequestCallback.onCheckIfCmdSuccess(mCurrentCleanSystemState)) {
mCurrentCmdRequestCallback.onCmdSuccess();
mCurrentCmdRequestCallback = null;
}
@@ -1068,4 +1041,91 @@ public class SweeperOperatePanelView extends LinearLayout {
void onCmdTimeout();
}
/**
* 模拟指令操作成功
*/
private void mockCleanModeSuccess(SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd fuTianTaskCmd) {
ChassisStatesOuterClass.SweeperFuTianTaskSystemStates.Builder builder = ChassisStatesOuterClass.SweeperFuTianTaskSystemStates.newBuilder();
chassis.SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd fuTianCleanCmd = fuTianTaskCmd.getRoboSweeperFutianCleanCmd();
if (fuTianCleanCmd.getCleanModeRequirement() == CLEAN_MODE_PURE_SWEEP) {//纯扫
builder.setSecuModWashSweepSts(false);
builder.setSecuModWashSts(false);
builder.setSecuWorkTonSts(false);
mCurrentCleanSystemState=builder.build();
mockSendCmdSuccess();
return;
} else if (fuTianCleanCmd.getCleanModeRequirement() == CLEAN_MODE_WASH_SWEEP) {//洗扫
builder.setSecuModWashSweepSts(!mCurrentCleanSystemState.getSecuModWashSweepSts());
mCurrentCleanSystemState=builder.build();
mockSendCmdSuccess();
return;
} else if (fuTianCleanCmd.getCleanModeRequirement() == CLEAN_MODE_PURE_WASH) {//纯洗
builder.setSecuModWashSts(!mCurrentCleanSystemState.getSecuModWashSts());
mCurrentCleanSystemState=builder.build();
mockSendCmdSuccess();
return;
} else if (fuTianCleanCmd.getCleanModeRequirement() == CLEAN_MODE_PURE_DRAW) {//纯吸
builder.setSecuWorkTonSts(!mCurrentCleanSystemState.getSecuWorkTonSts());
mCurrentCleanSystemState=builder.build();
mockSendCmdSuccess();
return;
}else if(fuTianCleanCmd.getCleanModeRequirement() == CLEAN_MODE_CLOSE){
builder.setSecuModWashSweepSts(false);
builder.setSecuModWashSts(false);
builder.setSecuWorkTonSts(false);
builder.setSecuWorkOnBothsidesSts(false);
builder.setSecuWorkLeftSts(false);
builder.setSecuWorkRightSts(false);
builder.setSecuWorkStandSts(true);
builder.setSecuWorkStrongSts(false);
mCurrentCleanSystemState=builder.build();
mockSendCmdSuccess();
return;
}
if (fuTianCleanCmd.getCleanDirectionRequirement() == CLEAN_DIRECTION_BOTH_SIDE) {//两侧
builder.setSecuWorkOnBothsidesSts(!mCurrentCleanSystemState.getSecuWorkOnBothsidesSts());
builder.setSecuWorkStandSts(true);
builder.setSecuWorkStrongSts(false);
mCurrentCleanSystemState=builder.build();
mockSendCmdSuccess();
return;
} else if (fuTianCleanCmd.getCleanDirectionRequirement() == CLEAN_DIRECTION_LEFT_SIDE) {//左侧
builder.setSecuWorkLeftSts(!mCurrentCleanSystemState.getSecuWorkLeftSts());
builder.setSecuWorkStandSts(true);
builder.setSecuWorkStrongSts(false);
mCurrentCleanSystemState=builder.build();
mockSendCmdSuccess();
return;
} else if (fuTianCleanCmd.getCleanDirectionRequirement() == CLEAN_DIRECTION_RIGHT_SIDE) {//右侧
builder.setSecuWorkRightSts(!mCurrentCleanSystemState.getSecuWorkRightSts());
builder.setSecuWorkStandSts(true);
builder.setSecuWorkStrongSts(false);
mCurrentCleanSystemState=builder.build();
mockSendCmdSuccess();
return;
}else if(fuTianCleanCmd.getCleanDirectionRequirement()==CLEAN_DIRECTION_CLOSE){
builder.setSecuWorkLeftSts(false);
builder.setSecuWorkRightSts(false);
builder.setSecuWorkOnBothsidesSts(false);
builder.setSecuWorkStandSts(true);
builder.setSecuWorkStrongSts(false);
mCurrentCleanSystemState=builder.build();
mockSendCmdSuccess();
return;
}
if (fuTianCleanCmd.getCleanIntensityRequirement()==CLEAN_INTENSITY_STRAND){
builder.setSecuWorkStrongSts(true);
builder.setSecuWorkStandSts(false);
mCurrentCleanSystemState=builder.build();
mockSendCmdSuccess();
return;
}else if(fuTianCleanCmd.getCleanIntensityRequirement()==CLEAN_INTENSITY_STRONG){
builder.setSecuWorkStandSts(true);
builder.setSecuWorkStrongSts(false);
mCurrentCleanSystemState=builder.build();
mockSendCmdSuccess();
}
}
}

View File

@@ -43,7 +43,7 @@ class SweeperOperatePanelPopWindow : PopupWindow {
* 设置清扫模式数据
*/
fun setCleanSystemState(
cleanSystemState: ChassisStatesOuterClass.SweeperFuTianTaskSystemStates,
cleanSystemState: ChassisStatesOuterClass.SweeperFuTianTaskSystemStates?,
cleaningModeStateCallback: CleaningModeStateCallback
) {
mOperatePanelView?.setSweeperFutianCleanSystemState(cleanSystemState, cleaningModeStateCallback)

View File

@@ -13,11 +13,11 @@ public class SweeperFutianCmdUtil {
public static final int CLEAN_MODE_WASH_SWEEP = 2;//作业模式-洗扫
public static final int CLEAN_MODE_PURE_WASH = 3;//作业模式-纯洗
public static final int CLEAN_MODE_PURE_DRAW = 4;//作业模式-纯吸
private static final int CLEAN_MODE_CLOSE = 5;//作业模式-关闭
public static final int CLEAN_MODE_CLOSE = 5;//作业模式-关闭
public static final int CLEAN_DIRECTION_BOTH_SIDE = 1;//清扫方向-两侧
public static final int CLEAN_DIRECTION_LEFT_SIDE = 2;//清扫方向-左侧
public static final int CLEAN_DIRECTION_RIGHT_SIDE = 3;//清扫方向-右侧
private static final int CLEAN_DIRECTION_CLOSE = 4;//清扫方向-关闭
public static final int CLEAN_DIRECTION_CLOSE = 4;//清扫方向-关闭
public static final int CLEAN_INTENSITY_STRAND = 1;//作业强度-标准
public static final int CLEAN_INTENSITY_STRONG = 2;//作业强度-加强

View File

@@ -5,6 +5,7 @@ import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import android.widget.ImageView
import android.widget.TextView
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.och.sweeper.R
import com.mogo.och.sweeper.bean.TaskInfoBean
@@ -83,4 +84,8 @@ class SweeperCurrentTaskInfoView : ConstraintLayout {
fun setEnableClickBtn(isEnable:Boolean){
readyTaskBtn.isSelected= isEnable
}
fun getReadyTaskBtn():TextView{
return readyTaskBtn
}
}

View File

@@ -64,7 +64,7 @@ class SweeperTrafficLightView @JvmOverloads constructor(
override fun disableTrafficLight() {
UiThreadHandler.post {
mCurrentLightId = TrafficLightEnum.BLACK
sweeper_traffic_light_iv.setBackgroundResource(R.drawable.sweeper_light_gay_nor)
sweeper_traffic_light_iv.setImageResource(R.drawable.sweeper_light_gay_nor)
sweeper_traffic_light_time_tv.text = ""
this@SweeperTrafficLightView.visibility = VISIBLE
}
@@ -123,19 +123,19 @@ class SweeperTrafficLightView @JvmOverloads constructor(
UiThreadHandler.post {
when (lightId) {
TrafficLightEnum.RED -> {
sweeper_traffic_light_iv.setBackgroundResource(R.drawable.sweeper_light_red_nor)
sweeper_traffic_light_iv.setImageResource(R.drawable.sweeper_light_red_nor)
this@SweeperTrafficLightView.visibility = VISIBLE
}
TrafficLightEnum.YELLOW -> {
sweeper_traffic_light_iv.setBackgroundResource(R.drawable.sweeper_lightyellow_nor)
sweeper_traffic_light_iv.setImageResource(R.drawable.sweeper_lightyellow_nor)
this@SweeperTrafficLightView.visibility = VISIBLE
}
TrafficLightEnum.GREEN -> {
sweeper_traffic_light_iv.setBackgroundResource(R.drawable.sweeper_light_green_nor)
sweeper_traffic_light_iv.setImageResource(R.drawable.sweeper_light_green_nor)
this@SweeperTrafficLightView.visibility = VISIBLE
}
else -> {
sweeper_traffic_light_iv.setBackgroundResource(R.drawable.sweeper_light_gay_nor)
sweeper_traffic_light_iv.setImageResource(R.drawable.sweeper_light_gay_nor)
this@SweeperTrafficLightView.visibility = VISIBLE
}
}

View File

@@ -39,7 +39,7 @@ class SweeperWorkModeView : ConstraintLayout, CleaningModeStateCallback {
/**
* 设置清扫模式面板
*/
fun setSweeperFutianCleanSystemState(taskType: Int, cleanSystemState: SweeperFuTianTaskSystemStates, trafficDataView: SweeperTrafficDataView) {
fun setSweeperFutianCleanSystemState(taskType: Int, cleanSystemState: SweeperFuTianTaskSystemStates?, trafficDataView: SweeperTrafficDataView) {
mOperatePanelPopWindow?.setCleanSystemState(cleanSystemState, this@SweeperWorkModeView)
//清扫模式选择面板打开关闭处理
ivOpenOperatePanel.setOnClickListener {
@@ -64,7 +64,7 @@ class SweeperWorkModeView : ConstraintLayout, CleaningModeStateCallback {
/**
* 设置清扫模式状态显示和隐藏
*/
fun setShowOrHideCleanSystemState(operateState: OperateStateEnum, cleanSystemState: SweeperFuTianTaskSystemStates) {
fun setShowOrHideCleanSystemState(operateState: OperateStateEnum, cleanSystemState: SweeperFuTianTaskSystemStates?) {
when (operateState.code) {
OperateStateEnum.SYNCING_STATUS.code -> {
groupWorkModelPanel?.visibility = View.GONE
@@ -95,7 +95,7 @@ class SweeperWorkModeView : ConstraintLayout, CleaningModeStateCallback {
}
}
override fun cleaningModeState(operateState: OperateStateEnum, cleanSystemState: SweeperFuTianTaskSystemStates, isSelectPureSweepMode: Boolean) {
override fun cleaningModeState(operateState: OperateStateEnum, cleanSystemState: SweeperFuTianTaskSystemStates?, isSelectPureSweepMode: Boolean) {
this.isSelectPureSweepMode = isSelectPureSweepMode
setShowOrHideCleanSystemState(operateState, cleanSystemState)
}
@@ -103,7 +103,7 @@ class SweeperWorkModeView : ConstraintLayout, CleaningModeStateCallback {
/**
* 设置清扫模式数据
*/
private fun setCleanModeData(cleanSystemState: SweeperFuTianTaskSystemStates) {
private fun setCleanModeData(cleanSystemState: SweeperFuTianTaskSystemStates?) {
if (isSelectPureSweepMode) {
tvCleaningMode?.text = "纯扫模式"
groupWorkModelPanel?.visibility = View.VISIBLE
@@ -113,13 +113,14 @@ class SweeperWorkModeView : ConstraintLayout, CleaningModeStateCallback {
groupWorkModelPanel?.visibility = View.GONE
tvNoDataDesc?.visibility = View.VISIBLE
tvNoDataDesc?.text = "暂无"
return
} else {
groupWorkModelPanel?.visibility = View.VISIBLE
tvNoDataDesc?.visibility = View.GONE
// 作业模式
if (cleanSystemState.secuModWashSweepSts) tvCleaningMode?.text = "洗扫模式"
if (cleanSystemState.secuModWashSts) tvCleaningMode?.text = "纯洗模式"
if (cleanSystemState.secuWorkTonSts) tvCleaningMode?.text = "纯吸模式"
if (cleanSystemState?.secuModWashSweepSts == true) tvCleaningMode?.text = "洗扫模式"
if (cleanSystemState?.secuModWashSts == true) tvCleaningMode?.text = "纯洗模式"
if (cleanSystemState?.secuWorkTonSts == true) tvCleaningMode?.text = "纯吸模式"
if (SweeperFutianCmdUtil.checkIfCleanModePureSweep(cleanSystemState)) tvCleaningMode?.text = "纯扫模式"
}
}
@@ -129,19 +130,19 @@ class SweeperWorkModeView : ConstraintLayout, CleaningModeStateCallback {
} else {
tvCleaningDirection.visibility = View.VISIBLE
// 左侧
if (cleanSystemState.secuWorkLeftSts) tvCleaningDirection?.text = "左侧"
if (cleanSystemState?.secuWorkLeftSts == true) tvCleaningDirection?.text = "左侧"
// 右侧
if (cleanSystemState.secuWorkRightSts) tvCleaningDirection?.text = "右侧"
if (cleanSystemState?.secuWorkRightSts == true) tvCleaningDirection?.text = "右侧"
// 两侧
if (cleanSystemState.secuWorkOnBothsidesSts) tvCleaningDirection?.text = "两侧"
if (cleanSystemState?.secuWorkOnBothsidesSts == true) tvCleaningDirection?.text = "两侧"
}
if (SweeperFutianCmdUtil.checkIfCleanIntensity(cleanSystemState)) {
tvCleaningIntensity.visibility = View.GONE
} else {
tvCleaningIntensity.visibility = View.VISIBLE
// 作业强度
if (cleanSystemState.secuWorkStandSts) tvCleaningIntensity?.text = "标准"
if (cleanSystemState.secuWorkStrongSts) tvCleaningIntensity?.text = "强力"
if (cleanSystemState?.secuWorkStandSts == true) tvCleaningIntensity?.text = "标准"
if (cleanSystemState?.secuWorkStrongSts == true) tvCleaningIntensity?.text = "强力"
}
}
}

View File

@@ -49,16 +49,6 @@
app:layout_constraintBottom_toTopOf="@+id/sweeper_switch_model_layout"
android:visibility="visible"
android:layout_marginBottom="@dimen/dp_30"/>
<!--清扫模式选择面板-->
<com.mogo.och.sweeper.ui.SweeperOperatePanelView
android:id="@+id/module_mogo_och_sweeper_operate_panel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_8"
android:visibility="gone"
app:layout_constraintLeft_toRightOf="@id/sweeper_cl_work_mode"
app:layout_constraintTop_toTopOf="@id/sweeper_cl_work_mode"
tools:visibility="visible" />
<!--切换地图远近事件-->
<FrameLayout
android:id="@+id/sweeper_switch_model_layout"

View File

@@ -27,7 +27,7 @@
android:id="@+id/tvCleaningMode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="纯扫模式"
tools:text="纯扫模式"
android:textSize="@dimen/dp_34"
android:textColor="@color/white"
android:layout_marginTop="@dimen/dp_16"
@@ -40,7 +40,7 @@
android:id="@+id/tvCleaningDirection"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="左侧"
tools:text="左侧"
android:textSize="@dimen/dp_34"
android:textColor="@color/white"
android:layout_marginTop="@dimen/dp_16"
@@ -54,7 +54,7 @@
android:id="@+id/tvCleaningIntensity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="标准"
tools:text="标准"
android:textSize="@dimen/dp_34"
android:textColor="@color/white"
android:layout_marginTop="@dimen/dp_16"

View File

@@ -1,7 +1,6 @@
package com.mogo.eagle.core.function.call.autopilot
import chassis.ChassisStatesOuterClass
import chassis.VehicleStateOuterClass
import com.mogo.eagle.core.function.api.autopilot.IMoGoSweeperFutianCleanSystemListener
import com.mogo.eagle.core.function.call.base.CallerBase
import planning.RoboSweeperTaskIndexOuterClass