[sweeper-cloud]联调问题修改

This commit is contained in:
bxb
2023-05-19 20:33:40 +08:00
parent 0fdd1c24da
commit 08db6490f1
10 changed files with 86 additions and 56 deletions

View File

@@ -12,6 +12,6 @@ public interface ISweeperControllerStatusCallback {
void onVRModeChanged(boolean isVRMode);
// 自车定位
void onCarLocationChanged(MogoLocation location);
//开始开启自动驾驶
void startOpenAutopilot();
//自动驾驶状态
void onAutopilotState(int state);
}

View File

@@ -183,7 +183,9 @@ public abstract class BaseSweeperTabFragment<V extends IView, P extends Presente
mapBizView.onCreate(savedInstanceState);
mMapWeltView.onCreateView(savedInstanceState);
}
public void setAutoState(int state){
mTrafficDataView.setAutoState(state);
}
/**
* 消息盒子
*/
@@ -483,18 +485,6 @@ public abstract class BaseSweeperTabFragment<V extends IView, P extends Presente
public void setTaskDataToFragmentCallback(ISweeperTaskDataToFragmentCallback mTaskDataToFragmentCallback) {
this.mTaskDataToFragmentCallback = mTaskDataToFragmentCallback;
}
/**
* 模拟pad获取正在执行的任务
*/
public void mockCloudTaskInfo() {
SweeperCloudTaskUtils.mockSendCloudTaskInfo(SweeperCloudTask.MessageType.CloudPushTask);
}
/**
* 模拟云端发送任务信息
*/
public void mockSendCloudTaskInfo() {
SweeperCloudTaskUtils.mockSendCloudTaskInfo(SweeperCloudTask.MessageType.CloudPushTask);
}
/**
* 结束子任务
*/

View File

@@ -332,10 +332,16 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
*/
fun onSweeperCloudAutopilotBootable(taskId: String, subTaskId: String, isBootableResp: SweeperBootable.IsBootableResp) {
mLoadingDialog.hideLoading()
if (isBootableResp.code == SweeperCommon.Code.SUCCEED) {
ToastUtils.showLong("上报云控成功")
} else {
ToastUtils.showLong("上报云控失败")
//如果云端要更新的任务和本地缓存任务不是同一个,在无法进行任务列表状态更新
mTaskInfo?.let {
if (it.taskId != taskId) {
return
}
if (isBootableResp.code == SweeperCommon.Code.SUCCEED) {
ToastUtils.showLong("上报云控成功")
} else {
ToastUtils.showLong("上报云控失败")
}
}
}

View File

@@ -302,7 +302,7 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
SweeperTask.TaskInfo taskInfo) {
CallerLogger.INSTANCE.d(M_SWEEPER + TAG,
"messageType: " + messageType.getNumber() + " sysTime" + sysTime + " reqNo" + reqNo + " onSweeperFutianCloudTask" + taskInfo == null ? "null" : printMessage(taskInfo) + " mSweeperTaskCallback" + mSweeperTaskCallback);
"messageType: " + messageType.getNumber() + " sysTime" + sysTime + " reqNo" + reqNo + " onSweeperFutianCloudTask" + (taskInfo == null ? "null" : printMessage(taskInfo)) + " mSweeperTaskCallback" + mSweeperTaskCallback);
if (mSweeperTaskCallback != null) {
msgTypeAndReqNo.put(messageType.getNumber(), reqNo);
mSweeperTaskCallback.onSweeperCloudTask(messageType, taskInfo);
@@ -556,6 +556,9 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
public void onAutopilotStatusResponse(@NonNull AutopilotStatusInfo autoPilotStatusInfo) {
//CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "onAutopilotStatusResponse state:" + autoPilotStatusInfo.getState());
this.mAutopilotState = autoPilotStatusInfo.getState();
if (mControllerStatusCallback!=null){
mControllerStatusCallback.onAutopilotState(autoPilotStatusInfo.getState());
}
switch (autoPilotStatusInfo.getState()) {
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE://不可自动驾驶
break;

View File

@@ -83,6 +83,11 @@ public class SweeperPresenter extends Presenter<SweeperFragment>
}
}
@Override
public void onAutopilotState(int state) {
ThreadUtils.runOnUiThread(() ->mView.setAutoState(state));
}
/**
* 获取自动驾驶状态
* @return
@@ -90,12 +95,6 @@ public class SweeperPresenter extends Presenter<SweeperFragment>
public int getAutopilotState() {
return SweeperTaskModel.getInstance().getAutopilotState();
}
@Override
public void startOpenAutopilot() {
}
/**
* 清除路线缓存数据
*/

View File

@@ -30,9 +30,10 @@ object SweeperCloudTaskUtils {
*/
@JvmStatic
fun mockQueryCurrentTaskInfo() {
UiThreadHandler.getsUiHandler().postDelayed({
mockSendCloudTaskInfo(MessageType.PadSendGetTaskReq)
},1000)
// UiThreadHandler.getsUiHandler().postDelayed({
// mockSendCloudTaskInfo(MessageType.PadSendGetTaskReq)
// },1000)
SweeperTaskModel.getInstance().getCurrentTask()
}
/**

View File

@@ -12,10 +12,7 @@ import chassis.Chassis.LightSwitch
import chassis.ChassisStatesOuterClass.BMSSystemStates
import chassis.ChassisStatesOuterClass.SweeperFuTianTaskSystemStates
import com.elegant.utils.UiThreadHandler
import com.mogo.eagle.core.function.api.autopilot.IMoGoBatteryManagementSystemListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisGearStateListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLamplightListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoSweeperFutianCleanSystemListener
import com.mogo.eagle.core.function.api.autopilot.*
import com.mogo.eagle.core.function.call.autopilot.*
import com.mogo.eagle.core.function.hmi.ui.widget.TapPositionView
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
@@ -32,16 +29,15 @@ class SweeperTrafficDataView : ConstraintLayout,
IMoGoBatteryManagementSystemListener,
IMoGoChassisLamplightListener,
IMoGoChassisGearStateListener,
IMoGoSweeperFutianCleanSystemListener
{
IMoGoSweeperFutianCleanSystemListener {
private var tapPositionView //方向盘下方的档位
: TapPositionView? = null
private var speedImage //速度图标
: ImageView? = null
private var speedTextView //速度值
: TextView? = null
private var sweeperTurnSignal //转向灯
: TurnSignalView? = null
private var sweeperAutoState //自动驾驶状态
: TextView? = null
private var tvBattery //电量百分比展示
: TextView? = null
private var ivBgWaterWarning //水位预警背景图
@@ -72,7 +68,7 @@ class SweeperTrafficDataView : ConstraintLayout,
tapPositionView = findViewById(R.id.sweeperTrafficPosition)
speedImage = findViewById(R.id.sweeperSpeedImage)
speedTextView = findViewById(R.id.sweeperSpeedText)
sweeperTurnSignal = findViewById(R.id.sweeperTurnSignal)
sweeperAutoState = findViewById(R.id.sweeperAutoState)
tvBattery = findViewById(R.id.tvBattery)
ivBgWaterWarning = findViewById(R.id.sweeperIvBgWaterWarning)
ivWater = findViewById(R.id.sweeperIvWater)
@@ -92,7 +88,7 @@ class SweeperTrafficDataView : ConstraintLayout,
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerBatteryManagementSystemListenerManager.removeListener(TAG )
CallerBatteryManagementSystemListenerManager.removeListener(TAG)
CallerChassisLamplightListenerManager.removeListener(TAG)
CallerChassisGearStateListenerManager.removeListener(TAG)
CallerSweeperFutianCleanSystemListenerManager.removeListener(TAG)
@@ -101,7 +97,7 @@ class SweeperTrafficDataView : ConstraintLayout,
override fun onSweeperFutianTaskIndexData(roboSweeperTaskIndex: RoboSweeperTaskIndexOuterClass.RoboSweeperTaskIndex) {}
override fun onSweeperFutianCleanSystemState(cleanSystemState: SweeperFuTianTaskSystemStates) {
val current = System.currentTimeMillis()
if (current - mCurrentTimeWaterMillis <=VEHICLE_STATE_INTERVAL_MILLIS) {
if (current - mCurrentTimeWaterMillis <= VEHICLE_STATE_INTERVAL_MILLIS) {
return
}
mCurrentTimeWaterMillis = current
@@ -121,23 +117,49 @@ class SweeperTrafficDataView : ConstraintLayout,
@SuppressLint("SetTextI18n")
override fun onBatteryManagementSystemStates(states: BMSSystemStates) {
val current = System.currentTimeMillis()
if (current - mCurrentTimeBatteryMillis <=VEHICLE_STATE_INTERVAL_MILLIS) {
if (current - mCurrentTimeBatteryMillis <= VEHICLE_STATE_INTERVAL_MILLIS) {
return
}
mCurrentTimeBatteryMillis = current
d(SceneConstant.M_SWEEPER + TAG, "电量:${states.bmsSoc}")
UiThreadHandler.post{
UiThreadHandler.post {
tvBattery?.text = "${states.bmsSoc.roundToInt()}%"
}
}
/**
* 车辆转向灯
* @param directionLight
*/
override fun onAutopilotLightSwitchData(lightSwitch: LightSwitch?) {
//转向灯状态 0是正常 1是左转 2是右转
if (lightSwitch != null) {
sweeperTurnSignal?.setTurnLight(lightSwitch)
}
/**
* 设置自动驾驶状态
*/
fun setAutoState(state: Int) {
when (state) {
//不可自动驾驶
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE -> {
sweeperAutoState?.text="自动驾驶"
sweeperAutoState?.setBackgroundResource(R.drawable.icon_not_auto)
}
//人工驾驶
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE -> {
sweeperAutoState?.text="人工驾驶"
sweeperAutoState?.setBackgroundResource(R.drawable.icon_auto)
}
//自动驾驶中
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING -> {
sweeperAutoState?.text="自动驾驶"
sweeperAutoState?.setBackgroundResource(R.drawable.icon_auto)
}
//平行驾驶
IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING -> {
sweeperAutoState?.text="平行驾驶"
sweeperAutoState?.setBackgroundResource(R.drawable.icon_auto)
}
}
}
@@ -148,6 +170,7 @@ class SweeperTrafficDataView : ConstraintLayout,
override fun onAutopilotBrakeLightData(brakeLight: Boolean) {
d(TAG, "刹车灯:$brakeLight")
}
/**
* 方向盘下方的档位
* @param gear
@@ -158,9 +181,11 @@ class SweeperTrafficDataView : ConstraintLayout,
tapPositionView?.updateWithGear(gear)
}
}
fun getSpeedImage():ImageView?{
return speedImage
fun getSpeedImage(): ImageView? {
return speedImage
}
/**
* 速度设置
*/

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -68,21 +68,27 @@
app:layout_constraintBottom_toBottomOf="@+id/sweeperTrafficPosition"
android:layout_marginStart="@dimen/dp_34"
/>
<com.mogo.och.sweepercloud.view.TurnSignalView
android:id="@+id/sweeperTurnSignal"
android:layout_width="@dimen/dp_200"
android:layout_height="wrap_content"
<TextView
android:id="@+id/sweeperAutoState"
android:layout_width="@dimen/dp_168"
android:layout_height="@dimen/dp_58"
app:layout_constraintTop_toBottomOf="@+id/sweeperTrafficPosition"
app:layout_constraintLeft_toRightOf="@+id/sweeperSpeedImage"
android:layout_marginTop="@dimen/dp_10"/>
android:layout_marginTop="@dimen/dp_20"
android:gravity="center"
android:textColor="@color/white"
android:textSize="@dimen/dp_28"
android:text="自动驾驶"
android:background="@drawable/icon_not_auto"
android:layout_marginStart="@dimen/dp_20"/>
<View
android:id="@+id/line2"
android:layout_width="@dimen/dp_1"
android:layout_height="@dimen/dp_34"
app:layout_constraintStart_toEndOf="@+id/sweeperTurnSignal"
app:layout_constraintTop_toTopOf="@+id/sweeperTurnSignal"
app:layout_constraintBottom_toBottomOf="@+id/sweeperTurnSignal"
android:layout_marginStart="@dimen/dp_12"
app:layout_constraintStart_toEndOf="@+id/sweeperAutoState"
app:layout_constraintTop_toTopOf="@+id/sweeperAutoState"
app:layout_constraintBottom_toBottomOf="@+id/sweeperAutoState"
android:layout_marginStart="@dimen/dp_26"
android:background="#414869"/>
<com.mogo.och.sweepercloud.view.SweeperTrafficLightView
android:id="@+id/sweeperTrafficLight"
@@ -136,7 +142,7 @@
android:layout_gravity="center"
android:gravity="center"
android:layout_marginEnd="@dimen/dp_36"
app:layout_constraintTop_toBottomOf="@+id/sweeperTurnSignal"
app:layout_constraintTop_toBottomOf="@+id/sweeperAutoState"
>
<ImageView
android:id="@+id/sweeperIvBgWaterWarning"