[6.1.0] 刹车停止启动自驾逻辑

This commit is contained in:
wangmingjun
2023-09-18 19:19:01 +08:00
parent bbc5d9bcc7
commit 22593196ef
5 changed files with 68 additions and 6 deletions

View File

@@ -22,4 +22,8 @@ public interface ITaxiControllerStatusCallback {
//停止启动自动驾驶
void stopOpenAutopilotNonManual();
void pauseOpenAutopilotNonManual();
void resumeOpenAutopilotNonManual();
}

View File

@@ -283,6 +283,15 @@ class TaxiFragment : BaseTaxiTabFragment<TaxiFragment, TaxiPresenter>(),
findViewById<View>(R.id.test_bar_route)?.setOnClickListener {
testRouteInfoUpload()
}
findViewById<View>(R.id.test_brake)?.setOnClickListener {
TaxiTaskModel.handleBrakeStatusChange(false)
}
findViewById<View>(R.id.test_resume_brake)?.setOnClickListener {
TaxiTaskModel.handleBrakeStatusChange(true)
}
findViewById<View>(R.id.test_parallel_driver)?.setOnClickListener {
stopAutoStartAutopilot()
}
}
private fun testRouteInfoUpload() {

View File

@@ -9,6 +9,7 @@ import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.mvp.Presenter;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
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;
@@ -170,10 +171,28 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
public void stopOpenAutopilotNonManual() {
runOnUIThread(() -> {
mView.startOrStopLoadingAnim(false);
mView.updateAutopilotStatus(CallerAutoPilotStatusListenerManager.INSTANCE.getState());
mView.stopAutopilotBlinkAnimation();
});
}
@Override
public void pauseOpenAutopilotNonManual() {
runOnUIThread(() -> {
mView.startOrStopLoadingAnim(false);
mView.updateAutopilotStatus(CallerAutoPilotStatusListenerManager.INSTANCE.getState());
mView.pauseAutopilotBlinkAnimation();
});
}
@Override
public void resumeOpenAutopilotNonManual() {
runOnUIThread(() -> {
mView.startOrStopLoadingAnim(true);
mView.resumeAutopilotBlinkAnimation();
});
}
@Override
public void loginSuccess(DriverStatusQueryRespBean data) {

View File

@@ -273,8 +273,12 @@ object TaxiTaskModel {
* brakeStatus: true: 恢复启动自驾
* false: 暂停启动自驾
*/
private fun handleBrakeStatusChange(brakeStatus: Boolean) {
fun handleBrakeStatusChange(brakeStatus: Boolean) {
if (brakeStatus){
mControllerStatusCallback?.resumeOpenAutopilotNonManual()
}else{
mControllerStatusCallback?.pauseOpenAutopilotNonManual()
}
}
private val mMogoAutopilotStatusListener: IMoGoAutopilotStatusListener =
@@ -1480,10 +1484,15 @@ object TaxiTaskModel {
}
fun stopAutoStartAutopilot() {
mControllerStatusCallback?.stopOpenAutopilotNonManual()
mTaxiTaskWithOrderCallbackMap.forEach {
val listener = it.value
listener.onStopAutopilot()
d(
TAG, "stopAutoStartAutopilot = ${mCurrentTaskWithOrder?.currentStatus}"
)
if (QueryCurrentTaskRespBean.isGetTaskType(mCurrentTaskWithOrder)){
mControllerStatusCallback?.stopOpenAutopilotNonManual()
mTaxiTaskWithOrderCallbackMap.forEach {
val listener = it.value
listener.onStopAutopilot()
}
}
}

View File

@@ -51,6 +51,27 @@
android:layout_height="wrap_content"
android:text="Mock模拟轨迹"
android:textSize="12sp" />
<Button
android:id="@+id/test_brake"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Mock刹车"
android:textSize="12sp" />
<Button
android:id="@+id/test_resume_brake"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Mock松开刹车"
android:textSize="12sp" />
<Button
android:id="@+id/test_parallel_driver"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Mock平行驾驶"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout