Merge remote-tracking branch 'origin/dev_hengyang_base' into dev_hengyang_base

This commit is contained in:
wujifei
2021-06-16 20:11:36 +08:00
10 changed files with 59 additions and 24 deletions

View File

@@ -77,9 +77,11 @@ public class MockIntentHandler implements IntentHandler {
final int oper = intent.getIntExtra("oper", -1);
switch (oper) {
case 1:
// 展示自车位置
MarkerServiceHandler.getMapUIController().showMyLocation(intent.getBooleanExtra("status", true));
break;
case 2:
// 发起求助
boolean status = intent.getBooleanExtra("status", false);
MarkerServiceHandler.getMogoStatusManager().setSeekHelping(TAG, status);
break;
@@ -403,7 +405,6 @@ public class MockIntentHandler implements IntentHandler {
.syncLocation2Map(null);
break;
case 40:
double[][] coors = new double[][]{{40.17511749267578, 116.74359130859375},
{40.20258331298828, 116.74071502685547},
{40.202598571777344, 116.74067687988281},
@@ -444,7 +445,6 @@ public class MockIntentHandler implements IntentHandler {
{40.20254135131836, 116.74005889892578},
{40.20252990722656, 116.74007415771484},
{40.20254898071289, 116.74008178710938},
{40.20254135131836, 116.74005889892578},
{40.20252227783203, 116.74006652832031},
{40.20254898071289, 116.74002838134766},
@@ -542,12 +542,8 @@ public class MockIntentHandler implements IntentHandler {
.getMapUIController()
.openVrMode(false);
break;
case 46:// 模拟 自车周边数据
// String json = "{\"allList\":[{\"type\":3,\"uuid\":\"10009-5152\",\"lat\":40.1990809296,\"lon\":116.7393252195,\"speed\":0.0,\"heading\":0.0,\"systemTime\":1614329151909,\"vehicleType\":0,\"distance\":576.0,\"fromType\":3,\"isOnline\":0},{\"type\":3,\"uuid\":\"10009-5161\",\"lat\":40.1990827227,\"lon\":116.739325826,\"speed\":0.0,\"heading\":0.0,\"systemTime\":1614329151909,\"vehicleType\":0,\"distance\":576.0,\"fromType\":3,\"isOnline\":0}],\"nearList\":[],\"time\":1614329152238}";
// SnapshotSetDataDrawer.getInstance().renderSnapshotData(GsonUtil.objectFromJson(json, MogoSnapshotSetData.class)); //todo 需要重新模拟一个test数据
break;
case 47:// 模拟鹰眼模式下绘制车辆周边的数据
mTimeTickHandler.sendEmptyMessageDelayed(1, 0L);
case 46:// 模拟鹰眼模式下绘制车辆周边数据
// mTimeTickHandler.sendEmptyMessageDelayed(1, 0L);
break;
case 48:// 模拟3D模型绘制
MogoMarkerOptions options = new MogoMarkerOptions()
@@ -603,8 +599,8 @@ public class MockIntentHandler implements IntentHandler {
DebugConfig.setSelfCarSpeedYOffset(intent.getIntExtra("yOffset", 20));
break;
case 51:// 模拟路口车辆移动
mLocationMockHandler.sendEmptyMessageDelayed(100, 0L);
mLocationMockHandler.sendEmptyMessageDelayed(101, 1000L);
// mLocationMockHandler.sendEmptyMessageDelayed(100, 0L);
// mLocationMockHandler.sendEmptyMessageDelayed(101, 1000L);
break;
case 52:
// 打开连调工控机、ADAS的控制面板
@@ -616,7 +612,7 @@ public class MockIntentHandler implements IntentHandler {
DebugConfig.setUseAdasRecognize(isUseAdasRecognize);
break;
case 54:
mTimeTickCarHandler.sendEmptyMessageDelayed(1, 0L);
// mTimeTickCarHandler.sendEmptyMessageDelayed(1, 0L);
break;
case 55:
//开启模拟数据Mock用于验证算法准确性

View File

@@ -20,6 +20,8 @@ import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XObuEventEntity;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.service.MarkerServiceHandler;
import com.mogo.module.service.receiver.MogoReceiver;
import com.mogo.module.v2x.listener.V2XLocationListener;
import com.mogo.module.v2x.scenario.scene.obu.V2XObuEventScenario;
import com.mogo.module.v2x.utils.ADASUtils;
@@ -96,6 +98,13 @@ public class V2XObuManager implements IObuCallback, Handler.Callback {
NebulaObuClient.getInstance().registerObu(100);
NebulaObuClient.getInstance().registerObuListener(listener);
// UiThreadHandler.postDelayed( () -> {
// //TODO 测试
// MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(3, MogoReceiver.ACTION_V2X_FRONT_WARNING);
// handleSdkObu(1);
//
// }, 5_000L );
IntentFilter filter = new IntentFilter("com.mogo.launcher.v2x.action.EXCHANGE_OBU_TYPE");
context.registerReceiver(obuTypeExchangeReceiver, filter);
}
@@ -137,7 +146,7 @@ public class V2XObuManager implements IObuCallback, Handler.Callback {
Logger.d("liyz", "onWarningInfo type ------> " + info.getWarningtype() + "--size = " + infoList.size());
if (info.getWarningtype() == 3) {
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
handleSdkObu();
handleSdkObu(2);
}
}
}
@@ -145,14 +154,23 @@ public class V2XObuManager implements IObuCallback, Handler.Callback {
}
};
private void handleSdkObu() {
private void handleSdkObu(int type) {
V2XMessageEntity<V2XObuEventEntity> messageEntity = new V2XMessageEntity<>();
messageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_OBU_EVENT);
// 前车紧急制动预警
V2XObuEventEntity urgencyEvent = new V2XObuEventEntity();
urgencyEvent.setType(ObuConstant.TYPE_URGENCY_COLLISION_WARNING);
urgencyEvent.setDesc(V2XObuEventScenario.URGENCY_COLLISION_WARN_TEXT);
if (type == 1) { //交叉路口碰撞预警 TODO
urgencyEvent.setType(ObuConstant.TYPE_CROSS_COLLISION_WARNING);
urgencyEvent.setDesc(V2XObuEventScenario.URGENCY_CROING_WARN_TEXT);
} else if (type == 2) { // 前车紧急制动预警
urgencyEvent.setType(ObuConstant.TYPE_URGENCY_COLLISION_WARNING);
urgencyEvent.setDesc(V2XObuEventScenario.URGENCY_COLLISION_WARN_TEXT);
} else {
urgencyEvent.setType(ObuConstant.TYPE_URGENCY_COLLISION_WARNING);
urgencyEvent.setDesc(V2XObuEventScenario.URGENCY_COLLISION_WARN_TEXT);
}
messageEntity.setContent(urgencyEvent);
V2XObuEventScenario.getInstance().init(messageEntity);
}

View File

@@ -44,6 +44,8 @@ public class V2XObuEventScenario extends AbsV2XScenario<V2XObuEventEntity> imple
public static final String URGENCY_COLLISION_WARN_TEXT_ONE = "前车急刹,注意保持安全距离!";
public static final String URGENCY_COLLISION_WARN_TEXT = "前车急刹";
public static final String URGENCY_CROING_WARN_TEXT = "交叉路口碰撞预警";
private static final int MSG_CLOSE_OBU_WINDOW = 1001;
private static final int DEFAULT_EXPIRE_TIME = 20_000;
@@ -110,7 +112,12 @@ public class V2XObuEventScenario extends AbsV2XScenario<V2XObuEventEntity> imple
} else {
optimalSpeedMarker.clearPOI();
}
} else if (v2XMessageEntity.getContent().getType() == ObuConstant.TYPE_CROSS_COLLISION_WARNING) {
AIAssist.getInstance(V2XServiceManager.getContext()).speakTTSVoice(URGENCY_CROING_WARN_TEXT);
} else if (v2XMessageEntity.getContent().getType() == ObuConstant.TYPE_URGENCY_COLLISION_WARNING) {
AIAssist.getInstance(V2XServiceManager.getContext()).speakTTSVoice(URGENCY_COLLISION_WARN_TEXT_ONE);
}
show();
}
@@ -121,7 +128,7 @@ public class V2XObuEventScenario extends AbsV2XScenario<V2XObuEventEntity> imple
*/
@Override
public void show() {
AIAssist.getInstance(V2XServiceManager.getContext()).speakTTSVoice(URGENCY_COLLISION_WARN_TEXT_ONE);
// AIAssist.getInstance(V2XServiceManager.getContext()).speakTTSVoice(URGENCY_COLLISION_WARN_TEXT_ONE);
showWindow();
if (handler.hasMessages(MSG_CLOSE_OBU_WINDOW)) {
handler.removeMessages(MSG_CLOSE_OBU_WINDOW);

View File

@@ -66,7 +66,7 @@ public class V2XObuEventWindow extends FrameLayout implements IV2XWindow<V2XObuE
@Override
public void show(V2XObuEventEntity entity) {
Logger.d(MODULE_NAME, "ObuEventWindow show " + entity);
Logger.d("liyz", "ObuEventWindow show " + entity + "--type = " + entity.getType());
Logger.d("liyz", "ObuEventWindow show " + entity);
switch (entity.getType()) {
case ObuConstant
.TYPE_OPTIMAL_SPEED_ADVISORY:
@@ -83,6 +83,13 @@ public class V2XObuEventWindow extends FrameLayout implements IV2XWindow<V2XObuE
tvType.setText("前车急刹");
tvType.setBackgroundResource(R.drawable.bg_v2x_event_type_read);
break;
case ObuConstant.TYPE_CROSS_COLLISION_WARNING:
// 交叉路口碰撞预警
ivTypeIcon.setImageResource(R.drawable.v2x_icon_ahead_car_brake);
tvDesc.setText(entity.getDesc());
tvType.setText("交叉路口碰撞预警");
tvType.setBackgroundResource(R.drawable.bg_v2x_event_type_read);
break;
case ObuConstant.TYPE_CHANGE_LIGHT_FOR_VIP:
// vip变灯提醒
ivTypeIcon.setImageResource(R.drawable.v2x_icon_obu_traffic_light);

View File

@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="@dimen/module_v2x_brake_tip_width"
android:layout_width="wrap_content"
android:layout_height="@dimen/module_v2x_brake_tip_height"
android:layout_marginTop="@dimen/dp_20"
android:layout_gravity="center_horizontal"
android:background="@drawable/v2x_front_warning_bg">
<!-- @dimen/module_v2x_brake_tip_width-->
<ImageView
android:id="@+id/ivObuTypeIcon"
android:layout_width="@dimen/module_v2x_brake_image_width"
@@ -46,6 +46,7 @@
android:text="前车急刹"
android:textColor="@color/v2x_white"
android:textSize="@dimen/dp_32"
android:paddingRight="@dimen/module_v2x_brake_image_margin_left"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="@+id/tvObuType"
app:layout_constraintTop_toBottomOf="@+id/tvObuType" />