merge
This commit is contained in:
1
.idea/gradle.xml
generated
1
.idea/gradle.xml
generated
@@ -89,7 +89,6 @@
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
<option name="useQualifiedModuleNames" value="true" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
|
||||
@@ -157,7 +157,7 @@ ext {
|
||||
gpssimulatordebug : "com.mogo.module:module-gps-simulator-debug:${MOGO_MODULE_GPS_SIMULATOR_DEBUG_VERSION}",
|
||||
gpssimulatornoop : "com.mogo.module:module-gps-simulator-noop:${MOGO_MODULE_GPS_SIMULATOR_NOOP_VERSION}",
|
||||
|
||||
adasapi : "com.zhidao.autopilot.support:adas:1.0.6.9",
|
||||
adasapi : "com.zhidao.autopilot.support:adas:1.0.6.12",
|
||||
adasconfigapi : "com.zhidao.adasconfig:adasconfig:1.1.5.2",
|
||||
|
||||
// 个人中心的SDK
|
||||
|
||||
@@ -221,8 +221,6 @@ public class WebSocketManager implements IMogoWebSocketManager, ISocketMsgSettin
|
||||
Logger.d(TAG, "重置下次上报时机: " + nextDelay);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ dependencies {
|
||||
implementation project(':foudations:mogo-commons')
|
||||
}
|
||||
|
||||
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-8.0.9'
|
||||
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-8.1.1'
|
||||
// implementation 'com.zhidaoauto.machine:map:1.0.0-vr-test-3.4'
|
||||
}
|
||||
|
||||
|
||||
@@ -985,12 +985,16 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
double acceleration = data.optDouble( "acceleration", -1 );
|
||||
double yawRate = data.optDouble( "yawRate", -1 );
|
||||
double speed = data.optDouble( "speed", -1 );
|
||||
long systemTime = data.optLong( "systemTime" );
|
||||
long receiverDataTime = data.optLong( "receiverDataTime" );
|
||||
if ( lon == -1 ) {
|
||||
return;
|
||||
}
|
||||
RTKAutopilotLocationBean bean = new RTKAutopilotLocationBean();
|
||||
bean.setYaw_rate( yawRate );
|
||||
bean.setHeading( heading );
|
||||
bean.setSystemTime( systemTime );
|
||||
bean.setReceiverDataTime( receiverDataTime );
|
||||
bean.setHeading( heading );
|
||||
bean.setAcceleration( acceleration );
|
||||
bean.setAlt( alt );
|
||||
|
||||
@@ -536,6 +536,10 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
|
||||
@Override
|
||||
public void addDynamicAnchorPosition( MogoLatLng latLng, long duration ) {
|
||||
mMarker.addDynamicAnchorPostion( new LonLatPoint( latLng.lon, latLng.lat ), ( int ) duration );
|
||||
try {
|
||||
mMarker.addDynamicAnchorPostion( new LonLatPoint( latLng.lon, latLng.lat ), ( int ) duration );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,6 @@ package com.mogo.module.common.drawer;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
@@ -14,7 +11,7 @@ import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.R;
|
||||
import com.mogo.module.common.constants.DataTypes;
|
||||
import com.mogo.service.adas.entity.ADASRecognizedListResult;
|
||||
import com.mogo.service.adas.entity.ADASRecognizedResult;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -39,7 +36,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
mContext = AbsMogoApplication.getApp();
|
||||
}
|
||||
|
||||
private Map< String, ADASRecognizedListResult > mLastPositions = new ConcurrentHashMap<>();
|
||||
private Map< String, ADASRecognizedResult > mLastPositions = new ConcurrentHashMap<>();
|
||||
|
||||
public static AdasRecognizedResultDrawer getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
@@ -68,13 +65,13 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
return mAdasRecognizedMarkersCaches.containsKey( uniqueKey );
|
||||
}
|
||||
|
||||
public void renderAdasRecognizedResult( List< ADASRecognizedListResult > resultList, boolean machineVision, double curSpeed ) {
|
||||
public void renderAdasRecognizedResult( List< ADASRecognizedResult > resultList, boolean machineVision, double curSpeed ) {
|
||||
if ( resultList == null || resultList.isEmpty() ) {
|
||||
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( mContext ).removeMarkers( DataTypes.TYPE_MARKER_ADAS );
|
||||
return;
|
||||
}
|
||||
purgeAdasRecognizedData( resultList );
|
||||
for ( ADASRecognizedListResult recognizedListResult : resultList ) {
|
||||
for ( ADASRecognizedResult recognizedListResult : resultList ) {
|
||||
if ( recognizedListResult == null ) {
|
||||
continue;
|
||||
}
|
||||
@@ -100,7 +97,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
mAdasRecognizedMarkersCaches.put( uniqueKey, marker );
|
||||
mLastPositions.put( uniqueKey, recognizedListResult );
|
||||
} else {
|
||||
ADASRecognizedListResult lastPosition = mLastPositions.get( uniqueKey );
|
||||
ADASRecognizedResult lastPosition = mLastPositions.get( uniqueKey );
|
||||
mLastPositions.put( uniqueKey, recognizedListResult );
|
||||
if ( lastPosition != null ) {
|
||||
List< MogoLatLng > points = new ArrayList<>();
|
||||
@@ -108,6 +105,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
points.add( new MogoLatLng( lastPosition.lat, lastPosition.lon ) );
|
||||
points.add( endLatLon );
|
||||
if ( DebugConfig.isNotSmooth() ) {
|
||||
marker.setRotateAngle( ( ( float ) recognizedListResult.heading ) );
|
||||
marker.setPosition( recognizedListResult.lat, recognizedListResult.lon );
|
||||
} else {
|
||||
long interval = recognizedListResult.systemTime - lastPosition.systemTime;
|
||||
@@ -117,13 +115,10 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
interval -= 25;
|
||||
marker.startSmoothInMs( points, interval );
|
||||
}
|
||||
} else {
|
||||
marker.setRotateAngle( ( ( float ) recognizedListResult.heading ) );
|
||||
marker.setPosition( recognizedListResult.lat, recognizedListResult.lon );
|
||||
} else {
|
||||
marker.setPosition( recognizedListResult.lat, recognizedListResult.lon );
|
||||
}
|
||||
// marker.setRotateAngle( ( ( float ) recognizedListResult.heading ) );
|
||||
// marker.setPosition( recognizedListResult.lat, recognizedListResult.lon );
|
||||
}
|
||||
showSelfSpeed( mContext,
|
||||
marker,
|
||||
@@ -138,7 +133,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
*
|
||||
* @param resultList
|
||||
*/
|
||||
private void purgeAdasRecognizedData( List< ADASRecognizedListResult > resultList ) {
|
||||
private void purgeAdasRecognizedData( List< ADASRecognizedResult > resultList ) {
|
||||
if ( resultList == null || resultList.isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
@@ -146,7 +141,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
return;
|
||||
}
|
||||
Map< String, IMogoMarker > existMarker = new HashMap<>();
|
||||
for ( ADASRecognizedListResult recognizedListResult : resultList ) {
|
||||
for ( ADASRecognizedResult recognizedListResult : resultList ) {
|
||||
if ( recognizedListResult == null ) {
|
||||
continue;
|
||||
}
|
||||
@@ -170,7 +165,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
}
|
||||
}
|
||||
|
||||
private IMogoMarker drawAdasRecognizedDataMarker( ADASRecognizedListResult recognizedListResult,
|
||||
private IMogoMarker drawAdasRecognizedDataMarker( ADASRecognizedResult recognizedListResult,
|
||||
boolean machineVision,
|
||||
double curSpeed ) {
|
||||
if ( recognizedListResult == null ) {
|
||||
|
||||
@@ -188,16 +188,9 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
|
||||
CloudRoadData lastPosition = mLastPositions.get( uniqueKey );
|
||||
if ( lastPosition != null ) {
|
||||
if ( lastPosition.equals( cloudRoadData ) ) {
|
||||
if ( ( ( int ) cloudRoadData.getSpeed() ) == 0 ) {
|
||||
// MapCameraPosition position = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getMapCameraPosition();
|
||||
// if ( position != null ) {
|
||||
// marker.setRotateAngle( 360 - ( float ) cloudRoadData.getHeading() - position.getBearing() );
|
||||
// } else {
|
||||
// }
|
||||
marker.setRotateAngle( ( ( float ) cloudRoadData.getHeading() ) );
|
||||
}
|
||||
Logger.d( TAG, "保持位置 - %s", uniqueKey );
|
||||
// marker.setPosition( lastPosition.getLat(), lastPosition.getLon() );
|
||||
marker.setRotateAngle( ( ( float ) cloudRoadData.getHeading() ) );
|
||||
marker.setPosition( lastPosition.getLat(), lastPosition.getLon() );
|
||||
} else {
|
||||
List< MogoLatLng > points = new ArrayList<>();
|
||||
points.add( new MogoLatLng( lastPosition.getLat(), lastPosition.getLon() ) );
|
||||
@@ -341,7 +334,7 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
|
||||
private int getVrModel( CloudRoadData data ) {
|
||||
switch ( data.getFromType() ) {
|
||||
case CloudRoadData.FROM_ADAS:
|
||||
return R.raw.taxi;
|
||||
return R.raw.cargrey;
|
||||
case CloudRoadData.FROM_ROAD_UNIT:
|
||||
return R.raw.cargreen;
|
||||
case CloudRoadData.FROM_MY_LOCATION:
|
||||
@@ -395,7 +388,6 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
|
||||
driverInfo.setLat( data.getLat() );
|
||||
driverInfo.setLon( data.getLon() );
|
||||
driverInfo.setSn( data.getSn() );
|
||||
|
||||
ICarsChattingProvider carChatting = CallChatApi.getInstance().getApiProvider();
|
||||
|
||||
if ( carChatting != null ) {
|
||||
|
||||
@@ -67,6 +67,7 @@ import com.mogo.utils.NetworkUtils;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.List;
|
||||
@@ -970,6 +971,16 @@ public class MogoServices implements IMogoMapListener,
|
||||
data.putOpt( "heading", stateInfo.getValues().getHeading() );
|
||||
data.putOpt( "acceleration", stateInfo.getValues().getAcceleration() );
|
||||
data.putOpt( "yawRate", stateInfo.getValues().getYaw_rate() );
|
||||
try {
|
||||
data.putOpt( "systemTime", Long.valueOf( stateInfo.getValues().getSystemTime() ) );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
data.putOpt( "receiverDataTime", Long.valueOf( stateInfo.getValues().getReceiverDataTime() ) );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().syncLocation2Map( data );
|
||||
SnapshotUploadInTime.getInstance().syncAdasLocationInfo( data );
|
||||
} catch ( Exception e ) {
|
||||
|
||||
@@ -60,23 +60,26 @@ public class MogoRTKLocation {
|
||||
}
|
||||
|
||||
public interface RTKLocationListener {
|
||||
void onLocationChanged(List<CloudLocationInfo> cloudLocationInfos);
|
||||
void onLocationChanged(int dataAccuracy, List<CloudLocationInfo> cloudLocationInfos);
|
||||
}
|
||||
|
||||
private void sendLocationData() {
|
||||
|
||||
List<CloudLocationInfo> list = null;
|
||||
int dataAccuracy = 0;
|
||||
if ( DebugConfig.isUseAdasRtkLocationInfo() ) {
|
||||
dataAccuracy = 1;
|
||||
list = new ArrayList<>(SnapshotUploadInTime.getInstance().getSendLocationData());
|
||||
}
|
||||
if ( list == null || list.isEmpty() ) {
|
||||
dataAccuracy = 0;
|
||||
list = new ArrayList<>(cacheList);
|
||||
}
|
||||
if (cacheList != null && cacheList.size() > 0) {
|
||||
cacheList.clear();
|
||||
}
|
||||
if (rtkLocationListener != null) {
|
||||
rtkLocationListener.onLocationChanged(list);
|
||||
rtkLocationListener.onLocationChanged(dataAccuracy, list);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -67,13 +67,13 @@ class SnapshotUploadInTime implements MogoRTKLocation.RTKLocationListener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocationChanged( List< CloudLocationInfo > cloudLocationInfos ) {
|
||||
startSendCarLocationAndAdasRecognizedResult2Server( cloudLocationInfos );
|
||||
public void onLocationChanged( int dataAccuracy, List< CloudLocationInfo > cloudLocationInfos ) {
|
||||
startSendCarLocationAndAdasRecognizedResult2Server( dataAccuracy, cloudLocationInfos );
|
||||
}
|
||||
|
||||
private CloudLocationInfo mLastInfo;
|
||||
|
||||
private void startSendCarLocationAndAdasRecognizedResult2Server( List< CloudLocationInfo > cloudLocationInfo ) {
|
||||
private void startSendCarLocationAndAdasRecognizedResult2Server( int dataAccuracy, List< CloudLocationInfo > cloudLocationInfo ) {
|
||||
CloudLocationInfo lastInfo = null;
|
||||
// 如果数组内容不为空,就用数组最后一个值
|
||||
if ( cloudLocationInfo != null && !cloudLocationInfo.isEmpty() ) {
|
||||
@@ -88,6 +88,7 @@ class SnapshotUploadInTime implements MogoRTKLocation.RTKLocationListener {
|
||||
// 定位点预测纠偏
|
||||
lastInfo = SimpleLocationCorrectStrategy.getInstance().correct( lastInfo );
|
||||
locationResult = new LocationResult();
|
||||
locationResult.dataAccuracy = dataAccuracy;
|
||||
if ( lastInfo != null ) {
|
||||
locationResult.lastCoordinate = lastInfo;
|
||||
locationResult.mortonCode = MortonCode.wrapEncodeMorton( lastInfo.getLon(), lastInfo.getLat() );
|
||||
|
||||
@@ -29,7 +29,12 @@ class LocationResult {
|
||||
public CloudLocationInfo lastCoordinate;
|
||||
|
||||
/**
|
||||
* 内的连续定位点
|
||||
* 连续定位点
|
||||
*/
|
||||
public List< CloudLocationInfo > coordinates;
|
||||
|
||||
/**
|
||||
* 数据来源精度 0 - 普通定位、1 - 高精定位
|
||||
*/
|
||||
public int dataAccuracy = 0;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.mogo.service.adas;
|
||||
|
||||
import com.mogo.service.adas.entity.ADASRecognizedListResult;
|
||||
import com.mogo.service.adas.entity.ADASRecognizedResult;
|
||||
|
||||
import java.util.List;
|
||||
@@ -16,5 +15,5 @@ public interface IMogoAdasRecognizedDataCallback {
|
||||
*
|
||||
* @param resultList 具体识别的物体数据
|
||||
*/
|
||||
void onAdasDataCallback( List< ADASRecognizedListResult > resultList );
|
||||
void onAdasDataCallback( List< ADASRecognizedResult > resultList );
|
||||
}
|
||||
@@ -55,6 +55,10 @@ public class ADASCarStateInfo implements Serializable {
|
||||
//gps 时间
|
||||
private String satelliteTime;
|
||||
|
||||
private String systemTime;
|
||||
//接收到数据的时间
|
||||
private String receiverDataTime;
|
||||
|
||||
public float getGnss_speed() {
|
||||
return gnss_speed;
|
||||
}
|
||||
@@ -119,6 +123,22 @@ public class ADASCarStateInfo implements Serializable {
|
||||
this.yaw_rate = yaw_rate;
|
||||
}
|
||||
|
||||
public String getSystemTime() {
|
||||
return systemTime;
|
||||
}
|
||||
|
||||
public void setSystemTime( String systemTime ) {
|
||||
this.systemTime = systemTime;
|
||||
}
|
||||
|
||||
public String getReceiverDataTime() {
|
||||
return receiverDataTime;
|
||||
}
|
||||
|
||||
public void setReceiverDataTime( String receiverDataTime ) {
|
||||
this.receiverDataTime = receiverDataTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ValuesBean{" +
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
package com.mogo.service.adas.entity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/25
|
||||
*
|
||||
* adas 识别物体参数
|
||||
*/
|
||||
class ADASRecognizedListResult {
|
||||
|
||||
/**
|
||||
* 识别物体类型
|
||||
*/
|
||||
public int type;
|
||||
|
||||
/**
|
||||
* 识别物体唯一标识
|
||||
*/
|
||||
public String uuid;
|
||||
/**
|
||||
* 方向
|
||||
*/
|
||||
public double heading;
|
||||
/**
|
||||
* 速度
|
||||
*/
|
||||
public double speed;
|
||||
/**
|
||||
* x 轴距离
|
||||
*/
|
||||
public double distanceX;
|
||||
|
||||
/**
|
||||
* y 轴距离
|
||||
*/
|
||||
public double distanceY;
|
||||
|
||||
/**
|
||||
* 同一个uuid 1帧内所对应的坐标
|
||||
*/
|
||||
public double lon;
|
||||
public double lat;
|
||||
|
||||
public long systemTime;
|
||||
}
|
||||
@@ -69,4 +69,23 @@ class ADASRecognizedResult {
|
||||
*/
|
||||
public long mortonCode;
|
||||
|
||||
/**
|
||||
* x 轴距离
|
||||
*/
|
||||
public double distanceX;
|
||||
|
||||
/**
|
||||
* y 轴距离
|
||||
*/
|
||||
public double distanceY;
|
||||
|
||||
/**
|
||||
* 实际直线距离
|
||||
*/
|
||||
public double distance;
|
||||
|
||||
/**
|
||||
* 数据来源精度 0 - 普通定位、1 - 高精定位
|
||||
*/
|
||||
public int dataAccuracy;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ dependencies {
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
implementation rootProject.ext.dependencies.adasapi
|
||||
implementation rootProject.ext.dependencies.adasconfigapi
|
||||
implementation "com.zhidao.support.adas:high:1.1.5.2"
|
||||
implementation "com.zhidao.support.adas:high:1.1.5.9"
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
api rootProject.ext.dependencies.mogomap
|
||||
implementation rootProject.ext.dependencies.mogomapapi
|
||||
|
||||
@@ -1,19 +1,14 @@
|
||||
package com.mogo.service.impl.adas;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.commons.utils.MortonCode;
|
||||
import com.mogo.service.adas.entity.ADASRecognizedListResult;
|
||||
import com.mogo.service.adas.entity.ADASRecognizedResult;
|
||||
import com.mogo.service.adas.entity.ADASWarnMessage;
|
||||
import com.mogo.utils.CoordinateUtils;
|
||||
import com.zhidao.support.adas.high.bean.RectInfo;
|
||||
import com.zhidao.autopilotservice.model.AdasAIDLOwnerCarRectModel;
|
||||
import com.zhidao.support.adas.high.bean.WarnMessageInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public
|
||||
/**
|
||||
@@ -40,89 +35,49 @@ class AdasObjectUtils {
|
||||
return warnMessage;
|
||||
}
|
||||
|
||||
public static List< ADASRecognizedResult > fromAdasObject( RectInfo rectInfo ) {
|
||||
if ( rectInfo == null
|
||||
|| rectInfo.getModels() == null
|
||||
|| rectInfo.getModels().isEmpty() ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
List< ADASRecognizedResult > recognizedResults = new ArrayList<>();
|
||||
for ( RectInfo.RectBean model : rectInfo.getModels() ) {
|
||||
try {
|
||||
ADASRecognizedResult result = fromAdasObject( model );
|
||||
if ( result != null ) {
|
||||
recognizedResults.add( result );
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
|
||||
}
|
||||
}
|
||||
return recognizedResults;
|
||||
}
|
||||
|
||||
public static ADASRecognizedResult fromAdasObject( RectInfo.RectBean rectBean ) {
|
||||
if ( rectBean == null ) {
|
||||
return null;
|
||||
}
|
||||
if ( rectBean.getLat() < 1 ) {
|
||||
return null;
|
||||
}
|
||||
ADASRecognizedResult result = new ADASRecognizedResult();
|
||||
result.uuid = rectBean.getUuid();
|
||||
|
||||
|
||||
double amapCoord[] = CoordinateUtils.transformWgsToGcj( rectBean.getLat(), rectBean.getLon() );
|
||||
if ( amapCoord != null ) {
|
||||
result.lat = amapCoord[1];
|
||||
result.lon = amapCoord[0];
|
||||
} else {
|
||||
result.lat = rectBean.getLat();
|
||||
result.lon = rectBean.getLon();
|
||||
}
|
||||
result.type = Integer.valueOf( rectBean.getType() );
|
||||
result.heading = rectBean.getHeading();
|
||||
result.systemTime = Long.valueOf( rectBean.getSystemTime() );
|
||||
result.satelliteTime = Long.valueOf( rectBean.getSatelliteTime() );
|
||||
result.alt = rectBean.getAlt();
|
||||
result.color = rectBean.getColor();
|
||||
result.speed = rectBean.getSpeed();
|
||||
result.carId = rectBean.getCarId();
|
||||
result.mortonCode = MortonCode.wrapEncodeMorton( result.lon, result.lat );
|
||||
return result;
|
||||
}
|
||||
|
||||
public static List< ADASRecognizedListResult > regroupData( List< RectInfo > datums ) {
|
||||
public static List< ADASRecognizedResult > regroupData( List< AdasAIDLOwnerCarRectModel > datums ) {
|
||||
if ( datums == null || datums.isEmpty() ) {
|
||||
return null;
|
||||
}
|
||||
List< ADASRecognizedListResult > recognizedListResults = new ArrayList<>();
|
||||
for ( RectInfo rectInfo : datums ) {
|
||||
if ( rectInfo == null || rectInfo.getModels() == null || rectInfo.getModels().isEmpty() ) {
|
||||
List< ADASRecognizedResult > recognizedListResults = new ArrayList<>();
|
||||
for ( AdasAIDLOwnerCarRectModel model : datums ) {
|
||||
if ( model == null ) {
|
||||
continue;
|
||||
}
|
||||
for ( RectInfo.RectBean model : rectInfo.getModels() ) {
|
||||
if ( model == null || TextUtils.isEmpty( model.getUuid() ) ) {
|
||||
continue;
|
||||
}
|
||||
ADASRecognizedListResult recognizedListResult = new ADASRecognizedListResult();
|
||||
recognizedListResult.heading = model.getHeading();
|
||||
recognizedListResult.speed = model.getSpeed();
|
||||
recognizedListResult.type = Integer.valueOf( model.getType() );
|
||||
recognizedListResult.uuid = model.getUuid();
|
||||
recognizedListResult.distanceX = model.getDistance_x();
|
||||
recognizedListResult.distanceY = model.getDistance_y();
|
||||
double amapCoord[] = CoordinateUtils.transformWgsToGcj( model.getLat(), model.getLon() );
|
||||
recognizedListResult.lat = amapCoord[1];
|
||||
recognizedListResult.lon = amapCoord[0];
|
||||
try {
|
||||
recognizedListResult.systemTime = Long.valueOf( model.getSystemTime() );
|
||||
} catch ( Exception e ) {
|
||||
recognizedListResult.systemTime = System.currentTimeMillis();
|
||||
}
|
||||
ADASRecognizedResult recognizedListResult = fromAdasObject( model );
|
||||
if ( recognizedListResult != null ) {
|
||||
recognizedListResults.add( recognizedListResult );
|
||||
}
|
||||
}
|
||||
return recognizedListResults;
|
||||
}
|
||||
|
||||
public static ADASRecognizedResult fromAdasObject( AdasAIDLOwnerCarRectModel model ) {
|
||||
if ( model == null ) {
|
||||
return null;
|
||||
}
|
||||
ADASRecognizedResult result = new ADASRecognizedResult();
|
||||
result.uuid = model.getUuid();
|
||||
|
||||
double amapCoord[] = CoordinateUtils.transformWgsToGcj( model.getLat(), model.getLon() );
|
||||
if ( amapCoord != null ) {
|
||||
result.lat = amapCoord[1];
|
||||
result.lon = amapCoord[0];
|
||||
} else {
|
||||
result.lat = model.getLat();
|
||||
result.lon = model.getLon();
|
||||
}
|
||||
result.type = Integer.valueOf( model.getType() );
|
||||
result.heading = model.getHeading();
|
||||
result.systemTime = Long.valueOf( model.getSystemTime() );
|
||||
result.satelliteTime = Long.valueOf( model.getSatelliteTime() );
|
||||
result.alt = model.getAlt();
|
||||
result.color = model.getColor();
|
||||
result.speed = model.getSpeed();
|
||||
result.carId = model.getCarId();
|
||||
result.dataAccuracy = model.dataAccuracy;
|
||||
result.distance = model.distance;
|
||||
result.mortonCode = MortonCode.wrapEncodeMorton( result.lon, result.lat );
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ import com.mogo.service.adas.IMogoAdasRecognizedDataCallback;
|
||||
import com.mogo.service.adas.IMogoAdasWarnMessageCallback;
|
||||
import com.mogo.service.adas.RemoteControlAutoPilotParameters;
|
||||
import com.mogo.service.adas.entity.ADASCarStateInfo;
|
||||
import com.mogo.service.adas.entity.ADASRecognizedListResult;
|
||||
import com.mogo.service.adas.entity.ADASRecognizedResult;
|
||||
import com.mogo.service.adas.entity.ADASWarnMessage;
|
||||
import com.mogo.service.adas.entity.AdasOCHData;
|
||||
@@ -46,6 +45,8 @@ import com.zhidao.autopilot.support.api.IAutopilotServiceStatusListener;
|
||||
import com.zhidao.autopilot.support.api.IAutopolitDataCallBack;
|
||||
import com.zhidao.autopilotservice.model.AdasAIDLAutopilotArriveModel;
|
||||
import com.zhidao.autopilotservice.model.AdasAIDLAutopilotStateModel;
|
||||
import com.zhidao.autopilotservice.model.AdasAIDLOwnerCarRectModel;
|
||||
import com.zhidao.autopilotservice.model.AdasAIDLOwnerCarStateModel;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.bean.RectInfo;
|
||||
import com.zhidao.support.adas.high.bean.WarnMessageInfo;
|
||||
@@ -54,10 +55,7 @@ import com.zhidao.support.adas.high.msg.MyMessageFactory;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@@ -112,33 +110,12 @@ public class MogoADASController implements IMogoADASController {
|
||||
|
||||
private IMogoAdasCarDataCallback mMogoAdasCarDataCallback;
|
||||
|
||||
private RectInfo mLastFrameData;
|
||||
private List< AdasAIDLOwnerCarRectModel > mLastFrameData;
|
||||
|
||||
private OnAdasListener mOnAdasListener = new OnAdasListenerAdapter() {
|
||||
|
||||
LogWriter logWriter = null;
|
||||
|
||||
@Override
|
||||
public void onRectData( RectInfo rectInfo ) {
|
||||
// 物体识别返回
|
||||
Logger.d( TAG, "onRectData = %s", rectInfo.toString() );
|
||||
if ( logWriter == null ) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat( "yyyyMMddhhmmss" );
|
||||
String date = sdf.format( new Date() );
|
||||
String path = context.getExternalCacheDir().getAbsolutePath() + "/adaslog/" + date + "/log.txt";
|
||||
Logger.d( TAG, path );
|
||||
logWriter = new LogWriter( path );
|
||||
}
|
||||
mLastFrameData = rectInfo;
|
||||
logWriter.write( GsonUtil.jsonFromObject( rectInfo ) );
|
||||
// 仅在 vr 模式下显示 adas 识别车辆
|
||||
if ( !MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
return;
|
||||
}
|
||||
if ( !MogoApisHandler.getInstance().getApis().getStatusManagerApi().isMainPageLaunched() ) {
|
||||
return;
|
||||
}
|
||||
handleAdasRecognizedData( rectInfo );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -167,34 +144,26 @@ public class MogoADASController implements IMogoADASController {
|
||||
}
|
||||
};
|
||||
|
||||
private long mLastRecordSeconds = 0L;
|
||||
|
||||
|
||||
/**
|
||||
* 缓存容器
|
||||
*/
|
||||
List< RectInfo > mCacheRecognizedDataSet = new ArrayList<>();
|
||||
private IMogoAdasOCHCallback mAdasOCHCallback;
|
||||
|
||||
/**
|
||||
* 处理数据,将识别到的物体分组,然后每1s进行一次回调
|
||||
* 时间:系统时间
|
||||
*
|
||||
* @param rectInfo
|
||||
* @param models
|
||||
*/
|
||||
private void handleAdasRecognizedData( RectInfo rectInfo ) {
|
||||
if ( rectInfo == null
|
||||
|| rectInfo.getModels() == null
|
||||
|| rectInfo.getModels().isEmpty() ) {
|
||||
private void handleAdasRecognizedData( List< AdasAIDLOwnerCarRectModel > models ) {
|
||||
if ( models == null
|
||||
|| models.isEmpty() ) {
|
||||
invokeCallbackPerSecond( null );
|
||||
return;
|
||||
}
|
||||
invokeCallbackPerSecond( Arrays.asList( rectInfo ) );
|
||||
invokeCallbackPerSecond( models );
|
||||
}
|
||||
|
||||
private void invokeCallbackPerSecond( List< RectInfo > data ) {
|
||||
List< RectInfo > newRef = data;
|
||||
List< ADASRecognizedListResult > recognizedListResults = AdasObjectUtils.regroupData( newRef );
|
||||
private void invokeCallbackPerSecond( List< AdasAIDLOwnerCarRectModel > models ) {
|
||||
List< AdasAIDLOwnerCarRectModel > newRef = models;
|
||||
List< ADASRecognizedResult > recognizedListResults = AdasObjectUtils.regroupData( newRef );
|
||||
if ( !mMogoAdasRecognizedDataCallbacks.isEmpty() ) {
|
||||
for ( IMogoAdasRecognizedDataCallback callback : mMogoAdasRecognizedDataCallbacks ) {
|
||||
if ( callback == null ) {
|
||||
@@ -330,27 +299,31 @@ public class MogoADASController implements IMogoADASController {
|
||||
}
|
||||
}
|
||||
|
||||
LogWriter logWriter;
|
||||
@Override
|
||||
@Deprecated
|
||||
public void ownerCarStateInfo( String ownerCarStateInfo ) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ownerCarStateInfo( String ownerCarStateInfo ) {
|
||||
if ( logWriter == null ) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat( "yyyyMMddhhmmss" );
|
||||
String date = sdf.format( new Date() );
|
||||
String path = context.getExternalCacheDir().getAbsolutePath() + "/adaslog/" + date + "/ownerCarStateInfo.txt";
|
||||
Logger.d( TAG, path );
|
||||
logWriter = new LogWriter( path );
|
||||
}
|
||||
logWriter.write( ownerCarStateInfo );
|
||||
ADASCarStateInfo stateInfo = GsonUtil.objectFromJson( ownerCarStateInfo, ADASCarStateInfo.class );
|
||||
try {
|
||||
mLastLon = stateInfo.getValues().getLon();
|
||||
mLastLat = stateInfo.getValues().getLat();
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
public void notifyOwnerCarState( AdasAIDLOwnerCarStateModel ownerCarStateModel ) {
|
||||
ADASCarStateInfo stateInf = new ADASCarStateInfo();
|
||||
stateInf.setAction( "state" );
|
||||
ADASCarStateInfo.ValuesBean bean = new ADASCarStateInfo.ValuesBean();
|
||||
bean.setSatelliteTime( ownerCarStateModel.getSatelliteTime() );
|
||||
bean.setAcceleration( ownerCarStateModel.getAcceleration() );
|
||||
bean.setAlt( ownerCarStateModel.getAlt() );
|
||||
bean.setGnss_speed( ownerCarStateModel.getGnss_speed() );
|
||||
bean.setHeading( ownerCarStateModel.getHeading() );
|
||||
bean.setLat( ownerCarStateModel.getLat() );
|
||||
bean.setLon( ownerCarStateModel.getLon() );
|
||||
bean.setReceiverDataTime( ownerCarStateModel.getReceiverDataTime() );
|
||||
bean.setSystemTime( ownerCarStateModel.getSystemTime() );
|
||||
bean.setYaw_rate( ownerCarStateModel.getYaw_rate() );
|
||||
stateInf.setValues( bean );
|
||||
mLastLon = ownerCarStateModel.getLon();
|
||||
mLastLat = ownerCarStateModel.getLat();
|
||||
if ( mMogoAdasCarDataCallback != null ) {
|
||||
mMogoAdasCarDataCallback.onAdasCarDataCallback( stateInfo );
|
||||
mMogoAdasCarDataCallback.onAdasCarDataCallback( stateInf );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -361,6 +334,28 @@ public class MogoADASController implements IMogoADASController {
|
||||
mAdasOCHCallback.onStateChanged( autopilotStateModel.getState(), autopilotStateModel.getReason() );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyOwnerCarRect( List< AdasAIDLOwnerCarRectModel > ownerCarStateRectList ) {
|
||||
// 物体识别返回
|
||||
Logger.d( TAG, "onRectData = %s", ownerCarStateRectList.toString() );
|
||||
if ( mLastFrameData == null ) {
|
||||
mLastFrameData = new ArrayList<>();
|
||||
}
|
||||
try {
|
||||
mLastFrameData.addAll( ownerCarStateRectList );
|
||||
} catch ( Exception e ) {
|
||||
|
||||
}
|
||||
// 仅在 vr 模式下显示 adas 识别车辆
|
||||
if ( !MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
return;
|
||||
}
|
||||
if ( !MogoApisHandler.getInstance().getApis().getStatusManagerApi().isMainPageLaunched() ) {
|
||||
return;
|
||||
}
|
||||
handleAdasRecognizedData( ownerCarStateRectList );
|
||||
}
|
||||
};
|
||||
AutopilotServiceManage.getInstance().registerAutopilotDataListener( mAutopolitDataCallBack );
|
||||
}
|
||||
@@ -624,10 +619,14 @@ public class MogoADASController implements IMogoADASController {
|
||||
|
||||
@Override
|
||||
public List< ADASRecognizedResult > getLastADASRecognizedResult() {
|
||||
RectInfo rectInfo = mLastFrameData;
|
||||
List< ADASRecognizedResult > recognizedResultList = null;
|
||||
if ( mLastFrameData == null ) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
recognizedResultList = AdasObjectUtils.fromAdasObject( rectInfo );
|
||||
List< AdasAIDLOwnerCarRectModel > data = new ArrayList<>( mLastFrameData );
|
||||
mLastFrameData = null;
|
||||
List< ADASRecognizedResult > recognizedResultList = null;
|
||||
recognizedResultList = AdasObjectUtils.regroupData( data );
|
||||
return recognizedResultList;
|
||||
} catch ( Exception e ) {
|
||||
return null;
|
||||
@@ -681,7 +680,7 @@ public class MogoADASController implements IMogoADASController {
|
||||
|
||||
@Override
|
||||
public int getAutopilotStatus() {
|
||||
if (mockState != -2) {
|
||||
if ( mockState != -2 ) {
|
||||
return mockState;
|
||||
}
|
||||
int status = IMogoAdasOCHCallback.STATUS_AUTOPILOT_DISABLE;
|
||||
@@ -694,16 +693,17 @@ public class MogoADASController implements IMogoADASController {
|
||||
}
|
||||
|
||||
private int mockState = -2;
|
||||
|
||||
@Override
|
||||
public void mockOchStatus( int state, String reason ) {
|
||||
if ( state == -1 ) {
|
||||
if ( mAdasOCHCallback != null ) {
|
||||
mAdasOCHCallback.onArriveAt( new AdasOCHData( 1, 1d, 1d ) );
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
mockState = state;
|
||||
if (mAdasOCHCallback != null) {
|
||||
mAdasOCHCallback.onStateChanged(state, reason);
|
||||
if ( mAdasOCHCallback != null ) {
|
||||
mAdasOCHCallback.onStateChanged( state, reason );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -712,7 +712,7 @@ public class MogoADASController implements IMogoADASController {
|
||||
public void cancelAutopilot() {
|
||||
try {
|
||||
AutopilotServiceManage.getInstance().cancelAutopilot();
|
||||
} catch (RemoteException e) {
|
||||
} catch ( RemoteException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ abstract class OnAdasListenerAdapter implements OnAdasListener {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void onRectData( RectInfo rectInfo ) {
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user