Merge branch 'dev_sweeper-d_230423_3.1.0' of http://gitlab.zhidaoauto.com/SCA/L4HA/AndroidApp/MoGoEagleEye into dev_sweeper-d_230423_3.1.0
Conflicts: OCH/sweeper/sweeper-cloud/src/main/res/layout/sweeper_base_fragment.xml
This commit is contained in:
@@ -922,6 +922,22 @@ class MoGoAutopilotControlProvider :
|
||||
}
|
||||
}
|
||||
|
||||
override fun setIsSubscribeM1StitchedVideo(isSubscribe: Boolean) {
|
||||
if (isSubscribe) {
|
||||
AdasManager.getInstance().subscribeInterface(
|
||||
Constants.TERMINAL_ROLE.DRIVER,
|
||||
Constants.SUBSCRIBE_TYPE.SUBSCRIBE,
|
||||
MessageType.TYPE_RECEIVE_M1_STITCHED_VIDEO
|
||||
)
|
||||
} else {
|
||||
AdasManager.getInstance().subscribeInterface(
|
||||
Constants.TERMINAL_ROLE.DRIVER,
|
||||
Constants.SUBSCRIBE_TYPE.UNSUBSCRIBE,
|
||||
MessageType.TYPE_RECEIVE_M1_STITCHED_VIDEO
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun sendRoboBusJinlvM1FrontDoorCmd(switchCmd: Int): Boolean {
|
||||
return AdasManager.getInstance().sendRoboBusJinlvM1FrontDoorCmd(switchCmd)
|
||||
}
|
||||
|
||||
@@ -742,6 +742,20 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* M1拼接视频 10Hz
|
||||
* 此接口需要订阅,默认不发送数据
|
||||
* 订阅调用:{@link AdasManager#subscribeInterface(int, int, MessageType)}
|
||||
* 订阅参数:AdasManager.getInstance().subscribeInterface(Constants.TERMINAL_ROLE.DRIVER, Constants.SUBSCRIBE_TYPE.SUBSCRIBE, MessageType。TYPE_RECEIVE_M1_STITCHED_VIDEO);
|
||||
* 取消订阅参数:AdasManager.getInstance().subscribeInterface(Constants.TERMINAL_ROLE.DRIVER, Constants.SUBSCRIBE_TYPE.UNSUBSCRIBE, MessageType。TYPE_RECEIVE_M1_STITCHED_VIDEO);
|
||||
*
|
||||
* @param header 头
|
||||
* @param data 数据
|
||||
*/
|
||||
override fun onM1StitchedVideo(header: MessagePad.Header, data: ByteArray) {
|
||||
CallerRoboBusJinlvM1StitchedVideoListenerManager.invokeRoboBusJinlvM1StitchedVideo(data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否可以启动自动驾驶
|
||||
* 使用方法查看:app_ipc_monitoring/uiMainActivity/onAutopilotAbility
|
||||
|
||||
@@ -15,31 +15,34 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.bumptech.glide.request.target.CustomTarget;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoRoboBusJinlvM1StitchedVideoListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoSweeperFutianBackCameraVideoListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerRoboBusJinlvM1StitchedVideoListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerSweeperFutianBackCameraVideoListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp;
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||
|
||||
/**
|
||||
* 清扫车摄像头展示View
|
||||
* 清扫车摄像头展示View 10Hz
|
||||
* M1拼接视频展示View 10Hz 需要订阅(连接成功后订阅才生效):CallerAutoPilotControlManager.setIsSubscribeM1StitchedVideo(isSubscribe)
|
||||
*/
|
||||
public class SweeperVideoView extends AppCompatImageView implements IMoGoSweeperFutianBackCameraVideoListener {
|
||||
private static final String TAG = SweeperVideoView.class.getSimpleName();
|
||||
public class MogoVideoView extends AppCompatImageView implements IMoGoSweeperFutianBackCameraVideoListener, IMoGoRoboBusJinlvM1StitchedVideoListener {
|
||||
private static final String TAG = MogoVideoView.class.getSimpleName();
|
||||
private final RequestOptions requestOptions = new RequestOptions()
|
||||
.priority(Priority.HIGH)
|
||||
.skipMemoryCache(true)
|
||||
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||
.dontAnimate();
|
||||
|
||||
public SweeperVideoView(@NonNull Context context) {
|
||||
public MogoVideoView(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public SweeperVideoView(@NonNull Context context, @Nullable AttributeSet attrs) {
|
||||
public MogoVideoView(@NonNull Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public SweeperVideoView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
public MogoVideoView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
@@ -47,12 +50,14 @@ public class SweeperVideoView extends AppCompatImageView implements IMoGoSweeper
|
||||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
CallerSweeperFutianBackCameraVideoListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerRoboBusJinlvM1StitchedVideoListenerManager.INSTANCE.addListener(TAG, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
CallerSweeperFutianBackCameraVideoListenerManager.INSTANCE.removeListener(this);
|
||||
CallerRoboBusJinlvM1StitchedVideoListenerManager.INSTANCE.removeListener(this);
|
||||
}
|
||||
|
||||
private final CustomTarget<Bitmap> target = new CustomTarget<Bitmap>() {
|
||||
@@ -60,7 +65,7 @@ public class SweeperVideoView extends AppCompatImageView implements IMoGoSweeper
|
||||
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
|
||||
//回调内容
|
||||
if (!resource.isRecycled()) {
|
||||
SweeperVideoView.this.setImageBitmap(resource);
|
||||
MogoVideoView.this.setImageBitmap(resource);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,18 +75,28 @@ public class SweeperVideoView extends AppCompatImageView implements IMoGoSweeper
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onSweeperFutianBackCameraVideo(@NonNull byte[] data) {
|
||||
private void draw(@NonNull byte[] data) {
|
||||
ThreadUtils.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
GlideApp.with(SweeperVideoView.this)
|
||||
GlideApp.with(MogoVideoView.this)
|
||||
.asBitmap()
|
||||
.load(data)
|
||||
.placeholder(SweeperVideoView.this.getDrawable())
|
||||
.placeholder(MogoVideoView.this.getDrawable())
|
||||
.apply(requestOptions)
|
||||
.into(target);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSweeperFutianBackCameraVideo(@NonNull byte[] data) {
|
||||
draw(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRoboBusJinlvM1StitchedVideo(@NonNull byte[] data) {
|
||||
draw(data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -367,6 +367,12 @@ interface IMoGoAutopilotControlProvider : IMoGoFunctionServerProvider {
|
||||
*/
|
||||
fun setIsDrawPointCloud(isDrawPointCloud: Boolean)
|
||||
|
||||
/**
|
||||
* 设置M1拼接视频接口订阅
|
||||
* @param isSubscribe 是否订阅
|
||||
*/
|
||||
fun setIsSubscribeM1StitchedVideo(isSubscribe: Boolean)
|
||||
|
||||
fun sendRoboBusJinlvM1FrontDoorCmd(switchCmd: Int): Boolean
|
||||
|
||||
fun sendRoboBusJinlvM1AirConditionerCmd(
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.mogo.eagle.core.function.api.autopilot
|
||||
|
||||
/**
|
||||
* M1拼接视频 10Hz
|
||||
*/
|
||||
interface IMoGoRoboBusJinlvM1StitchedVideoListener {
|
||||
/**
|
||||
* 金旅M1拼接视频数据 10Hz 每一帧为一张图片
|
||||
*/
|
||||
fun onRoboBusJinlvM1StitchedVideo(data: ByteArray)
|
||||
}
|
||||
@@ -511,6 +511,14 @@ object CallerAutoPilotControlManager {
|
||||
providerApi?.setIsDrawPointCloud(isDrawPointCloud)
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置M1拼接视频接口订阅(连接成功后订阅才生效)
|
||||
* @param isSubscribe 是否订阅
|
||||
*/
|
||||
fun setIsSubscribeM1StitchedVideo(isSubscribe: Boolean) {
|
||||
providerApi?.setIsSubscribeM1StitchedVideo(isSubscribe)
|
||||
}
|
||||
|
||||
fun sendRoboBusJinlvM1FrontDoorCmd(switchCmd: Int): Boolean {
|
||||
return providerApi?.sendRoboBusJinlvM1FrontDoorCmd(switchCmd) ?: false
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.mogo.eagle.core.function.call.autopilot
|
||||
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoRoboBusJinlvM1StitchedVideoListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
|
||||
/**
|
||||
* 清扫车(福田)后摄像头视频数据
|
||||
*/
|
||||
object CallerRoboBusJinlvM1StitchedVideoListenerManager : CallerBase<IMoGoRoboBusJinlvM1StitchedVideoListener>() {
|
||||
|
||||
/**
|
||||
* 后摄像头视频数据
|
||||
*/
|
||||
fun invokeRoboBusJinlvM1StitchedVideo(data: ByteArray) {
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.onRoboBusJinlvM1StitchedVideo(data)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,6 @@
|
||||
package com.mogo.eagle.core.function.call.autopilot
|
||||
|
||||
import chassis.ChassisStatesOuterClass
|
||||
import chassis.VehicleStateOuterClass
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoSweeperFutianBackCameraVideoListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoSweeperFutianCleanSystemListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,6 +31,7 @@ enum MessageType
|
||||
MsgTypeChassisStates = 0x1000b; //重构后的底盘状态, 透传
|
||||
MsgTypeFunctionStates = 0x1000c; //重构后的功能状态, 透传
|
||||
MsgTypeBackCameraVideo = 0x1000d; //清扫车后部摄像头视频 10hz
|
||||
MsgTypeM1StitchedVideo = 0x1000e; //m1拼接视频 10hz
|
||||
|
||||
MsgTypeBasicInfoReq = 0x10100; //自动驾驶设备基础信息请求
|
||||
MsgTypeBasicInfoResp = 0x10101; //自动驾驶设备基础信息应答
|
||||
@@ -646,6 +647,9 @@ message PlanningCmd
|
||||
//message definition for MsgTypeBackCameraVideo
|
||||
//payload:jpeg data
|
||||
|
||||
//message definition for MsgTypeM1StitchedVideo
|
||||
//payload:jpeg data
|
||||
|
||||
//message definition for MsgTypeV2nCongestionEvent
|
||||
//refer to RSI_PB in mogo_v2x.proto for details
|
||||
|
||||
|
||||
@@ -259,6 +259,8 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
// dispatchHandlers.put(MessagePad.MessageType.MsgTypePlanningDecisionState, new DispatchHandler(MessagePad.MessageType.MsgTypePlanningDecisionState, this));
|
||||
//清扫车后摄像头数据
|
||||
dispatchHandlers.put(MessagePad.MessageType.MsgTypeBackCameraVideo, new DispatchHandler(MessagePad.MessageType.MsgTypeBackCameraVideo, this));
|
||||
//M1拼接视频
|
||||
dispatchHandlers.put(MessagePad.MessageType.MsgTypeM1StitchedVideo, new DispatchHandler(MessagePad.MessageType.MsgTypeM1StitchedVideo, this));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,6 +4,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.support.obu.ObuScene;
|
||||
import com.zhidao.support.adas.high.common.MessageType;
|
||||
import com.zhidao.support.adas.high.common.ProtocolStatus;
|
||||
import com.zhjt.mogo.adas.data.bean.AutopilotStatistics;
|
||||
import com.zhjt.mogo.adas.data.sweeper.SweeperCloudTask;
|
||||
@@ -357,6 +358,18 @@ public interface OnAdasListener {
|
||||
*/
|
||||
void onBagManagerCmd(MessagePad.Header header, BagManagerOuterClass.BagManager bagManager);
|
||||
|
||||
/**
|
||||
* M1拼接视频 10Hz
|
||||
* 此接口需要订阅,默认不发送数据
|
||||
* 订阅调用:{@link AdasManager#subscribeInterface(int, int, MessageType)}
|
||||
* 订阅参数:AdasManager.getInstance().subscribeInterface(Constants.TERMINAL_ROLE.DRIVER, Constants.SUBSCRIBE_TYPE.SUBSCRIBE, MessageType。TYPE_RECEIVE_M1_STITCHED_VIDEO);
|
||||
* 取消订阅参数:AdasManager.getInstance().subscribeInterface(Constants.TERMINAL_ROLE.DRIVER, Constants.SUBSCRIBE_TYPE.UNSUBSCRIBE, MessageType。TYPE_RECEIVE_M1_STITCHED_VIDEO);
|
||||
*
|
||||
* @param header 头
|
||||
* @param data 数据
|
||||
*/
|
||||
void onM1StitchedVideo(@NonNull MessagePad.Header header, @NonNull byte[] data);
|
||||
|
||||
/**
|
||||
* 是否有能力启动自动驾驶
|
||||
*
|
||||
|
||||
@@ -4,7 +4,10 @@ import mogo.telematics.pad.MessagePad;
|
||||
|
||||
/**
|
||||
* 工控机发送或接收的类型
|
||||
* 工控机接收接口必须包含TYPE_RECEIVE
|
||||
* 工控机接收接口必须包含:TYPE_RECEIVE
|
||||
* 目前收发相同的Type:
|
||||
* * MessagePad.MessageType.MsgTypeBagManagerCmd
|
||||
* * MessagePad.MessageType.MsgTypeTaskCmd
|
||||
*
|
||||
* @author nie yunlong
|
||||
* @description 请求值
|
||||
@@ -26,6 +29,7 @@ public enum MessageType {
|
||||
TYPE_RECEIVE_CHASSIS_STATES(MessagePad.MessageType.MsgTypeChassisStates, "底盘状态"),
|
||||
TYPE_RECEIVE_FUNCTION_STATES(MessagePad.MessageType.MsgTypeFunctionStates, "重构后功能状态"),
|
||||
TYPE_RECEIVE_BACK_CAMERA_VIDEO(MessagePad.MessageType.MsgTypeBackCameraVideo, "清扫车后摄像头"),
|
||||
TYPE_RECEIVE_M1_STITCHED_VIDEO(MessagePad.MessageType.MsgTypeM1StitchedVideo, "M1拼接视频"),
|
||||
|
||||
TYPE_RECEIVE_BASIC_INFO_REQ(MessagePad.MessageType.MsgTypeBasicInfoReq, "自动驾驶设备基础信息请求"),
|
||||
TYPE_SEND_BASIC_INFO_RESP(MessagePad.MessageType.MsgTypeBasicInfoResp, "自动驾驶设备基础信息应答"),
|
||||
|
||||
@@ -9,7 +9,7 @@ import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
import com.zhidao.support.adas.high.protocol.RawData;
|
||||
|
||||
/**
|
||||
* 清扫车后摄像头
|
||||
* 清扫车后摄像头 10Hz
|
||||
*/
|
||||
public class BackCameraVideoMessage extends MyAbstractMessageHandler {
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.zhidao.support.adas.high.msg;
|
||||
|
||||
import android.os.SystemClock;
|
||||
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import com.zhidao.support.adas.high.AdasChannel;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
import com.zhidao.support.adas.high.protocol.RawData;
|
||||
|
||||
/**
|
||||
* M1拼接视频 10Hz
|
||||
*/
|
||||
public class M1StitchedVideoMessage extends MyAbstractMessageHandler {
|
||||
|
||||
public M1StitchedVideoMessage() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlerMsg(RawData raw, OnAdasListener adasListener) throws InvalidProtocolBufferException {
|
||||
int len = raw.getPackageLengthValue() - raw.getOffsetValue();
|
||||
byte[] data = new byte[len];
|
||||
System.arraycopy(raw.originalData.toByteArray(), raw.getOffsetValue(), data, 0, len);
|
||||
AdasChannel.calculateTimeConsumingOnDispatchRaw("M1StitchedVideoMessage", raw.receiveTime);
|
||||
long nowTime = 0;
|
||||
if (CupidLogUtils.isEnableLog())
|
||||
nowTime = SystemClock.elapsedRealtime();
|
||||
if (adasListener != null) {
|
||||
adasListener.onM1StitchedVideo(raw.getHeader(), data);
|
||||
}
|
||||
AdasChannel.calculateTimeConsumingBusiness("M1StitchedVideoMessage", nowTime);
|
||||
}
|
||||
}
|
||||
@@ -39,6 +39,7 @@ public class MyMessageFactory implements IMyMessageFactory {
|
||||
private IMsg backCameraVideoMessage;//清扫车后摄像头
|
||||
private IMsg pointCloudMessage;//3D点云
|
||||
private IMsg sweeperCloudTaskMessage;//云控下发清扫车任务指令
|
||||
private IMsg m1StitchedVideoMessage;//M1拼接视频
|
||||
|
||||
private final AutopilotReview autopilotReview;
|
||||
|
||||
@@ -204,7 +205,13 @@ public class MyMessageFactory implements IMyMessageFactory {
|
||||
sweeperCloudTaskMessage = new SweeperCloudTaskMessage();
|
||||
}
|
||||
return sweeperCloudTaskMessage;
|
||||
} else {
|
||||
} else if (messageType == MessageType.TYPE_RECEIVE_M1_STITCHED_VIDEO.typeCode) {
|
||||
//清扫车后摄像头
|
||||
if (m1StitchedVideoMessage == null) {
|
||||
m1StitchedVideoMessage = new M1StitchedVideoMessage();
|
||||
}
|
||||
return m1StitchedVideoMessage;
|
||||
} else {
|
||||
//MessageType.TYPE_DEFAULT.typeCode
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -188,6 +188,7 @@ public class FpgaSocket implements IWebSocket {
|
||||
void onWebSocketConnectFailed(String t);
|
||||
|
||||
void onMessage(String message);
|
||||
|
||||
//TODO 计算耗时 临时测试
|
||||
void onMessage(long receiveTime, ByteString bytes) throws InvalidProtocolBufferException;
|
||||
}
|
||||
@@ -364,16 +365,18 @@ public class FpgaSocket implements IWebSocket {
|
||||
* @param isInitiative 是否是主动断开
|
||||
* @param code code
|
||||
*/
|
||||
private void close(boolean isInitiative, int code) {
|
||||
private synchronized void close(boolean isInitiative, int code) {
|
||||
isConnected.set(false);
|
||||
String closeReason = null;
|
||||
if (isInitiative) {
|
||||
closeReason = "用户主动关闭";
|
||||
}
|
||||
boolean isClose = mWebSocket.close(code, closeReason);
|
||||
CupidLogUtils.i(TAG, "WebSocket " + (isInitiative ? "主动" : "被动") + "断开连接是否成功= " + isClose);
|
||||
if (!isInitiative) {
|
||||
mWebSocket.cancel();
|
||||
if (mWebSocket != null) {
|
||||
String closeReason = null;
|
||||
if (isInitiative) {
|
||||
closeReason = "用户主动关闭";
|
||||
}
|
||||
boolean isClose = mWebSocket.close(code, closeReason);
|
||||
CupidLogUtils.i(TAG, "WebSocket " + (isInitiative ? "主动" : "被动") + "断开连接是否成功= " + isClose);
|
||||
if (!isInitiative) {
|
||||
mWebSocket.cancel();
|
||||
}
|
||||
}
|
||||
mWebSocket = null;
|
||||
}
|
||||
|
||||
@@ -138,7 +138,8 @@ public class SubscribeInterface {
|
||||
MessageType[] types = MessageType.values();
|
||||
if (types.length > 0) {
|
||||
for (MessageType messageType : types) {
|
||||
if (messageType.name().toLowerCase().contains("type_receive")) {
|
||||
//连接成功后只有M1拼接视频接收接口默认不进行订阅,其他接收接口默认自动订阅
|
||||
if (messageType != MessageType.TYPE_RECEIVE_M1_STITCHED_VIDEO && messageType.name().toLowerCase().contains("type_receive")) {
|
||||
subscribedInterface.put(messageType, messageType.typeCode.getNumber());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user