网约车 修复坐标不一致导致的距离计算和自动驾驶不准确的问题
This commit is contained in:
@@ -137,9 +137,9 @@ class MogoOCHTaxiModel {
|
|||||||
// if ( NetworkUtils.isConnected( mContext ) ) {
|
// if ( NetworkUtils.isConnected( mContext ) ) {
|
||||||
// restoreOrderInfo();
|
// restoreOrderInfo();
|
||||||
// }
|
// }
|
||||||
// if ( NetworkUtils.isConnected( mContext ) ) {
|
if ( NetworkUtils.isConnected( mContext ) ) {
|
||||||
// querryCarStatus();
|
querryCarStatus();
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void querryCarStatus() {
|
public void querryCarStatus() {
|
||||||
@@ -186,15 +186,16 @@ class MogoOCHTaxiModel {
|
|||||||
private void restoreOrderInfo() {
|
private void restoreOrderInfo() {
|
||||||
Logger.d( TAG, "重新查询订单状态" );
|
Logger.d( TAG, "重新查询订单状态" );
|
||||||
mRetryCounter = 0;
|
mRetryCounter = 0;
|
||||||
if ( mCurrentOCHOrder == null ) {
|
// if ( mCurrentOCHOrder == null ) {
|
||||||
// 订单恢复
|
// // 订单恢复
|
||||||
String orderInfo = SharedPrefsMgr.getInstance( mContext ).getString( SP_KEY_OCH_TAXI_ORDER );
|
// String orderInfo = SharedPrefsMgr.getInstance( mContext ).getString( SP_KEY_OCH_TAXI_ORDER );
|
||||||
Logger.d(TAG,"restoreOrderInfo:"+orderInfo);
|
// Logger.d(TAG,"restoreOrderInfo:"+orderInfo);
|
||||||
if ( !TextUtils.isEmpty( orderInfo ) ) {
|
// if ( !TextUtils.isEmpty( orderInfo ) ) {
|
||||||
mCurrentOCHOrder = GsonUtil.objectFromJson( orderInfo, OCHTaxiOrderResponse.class );
|
// mCurrentOCHOrder = GsonUtil.objectFromJson( orderInfo, OCHTaxiOrderResponse.class );
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
query2RestoreOrderStatus(mCurrentOCHOrder == null ? null : mCurrentOCHOrder.orderNo);
|
// query2RestoreOrderStatus(mCurrentOCHOrder == null ? null : mCurrentOCHOrder.orderNo);
|
||||||
|
query2RestoreOrderStatus(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// private void restoreOrderInfo_() {
|
// private void restoreOrderInfo_() {
|
||||||
@@ -236,7 +237,7 @@ class MogoOCHTaxiModel {
|
|||||||
queryOCHOrderStatus( orderNo, new OCHOrderStatusCallback< OCHTaxiOrderResponse2 >() {
|
queryOCHOrderStatus( orderNo, new OCHOrderStatusCallback< OCHTaxiOrderResponse2 >() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess( OCHTaxiOrderResponse2 data ) {
|
public void onSuccess( OCHTaxiOrderResponse2 data ) {
|
||||||
|
Logger.d( TAG, "query2RestoreOrderStatus:"+ data.toString());
|
||||||
if ( data == null || data.data == null) {
|
if ( data == null || data.data == null) {
|
||||||
Logger.d( TAG, "订单已取消或已完成" );
|
Logger.d( TAG, "订单已取消或已完成" );
|
||||||
clearCurrentOCHOrder();
|
clearCurrentOCHOrder();
|
||||||
@@ -332,18 +333,26 @@ class MogoOCHTaxiModel {
|
|||||||
mCurrentOCHOrder.drivingRoutes = new ArrayList<>();
|
mCurrentOCHOrder.drivingRoutes = new ArrayList<>();
|
||||||
OCHTaxiOrderResponse.OCHTaxiStation startStation = new OCHTaxiOrderResponse.OCHTaxiStation();
|
OCHTaxiOrderResponse.OCHTaxiStation startStation = new OCHTaxiOrderResponse.OCHTaxiStation();
|
||||||
List< Double > startStationCoordinate = data.data.startStationCoordinate;
|
List< Double > startStationCoordinate = data.data.startStationCoordinate;
|
||||||
if (startStationCoordinate != null && startStationCoordinate.size()>1){
|
List< Double > startGcjStationCoordinate = data.data.startGcjStationCoordinate;
|
||||||
startStation.lon = startStationCoordinate.get( 0 );
|
if (startStationCoordinate != null && startStationCoordinate.size()>1 &&
|
||||||
startStation.lat = startStationCoordinate.get( 1 );
|
startGcjStationCoordinate!= null && startGcjStationCoordinate.size() > 1){
|
||||||
|
startStation.lon = startGcjStationCoordinate.get( 0 );
|
||||||
|
startStation.lat = startGcjStationCoordinate.get( 1 );
|
||||||
|
startStation.wgsLon = startStationCoordinate.get(0);
|
||||||
|
startStation.wgsLat = startStationCoordinate.get(1);
|
||||||
startStation.siteId = data.data.startStationId;
|
startStation.siteId = data.data.startStationId;
|
||||||
startStation.siteName = data.data.startStation;
|
startStation.siteName = data.data.startStation;
|
||||||
mCurrentOCHOrder.drivingRoutes.add( startStation );
|
mCurrentOCHOrder.drivingRoutes.add( startStation );
|
||||||
}
|
}
|
||||||
OCHTaxiOrderResponse.OCHTaxiStation endStation = new OCHTaxiOrderResponse.OCHTaxiStation();
|
OCHTaxiOrderResponse.OCHTaxiStation endStation = new OCHTaxiOrderResponse.OCHTaxiStation();
|
||||||
List< Double > endStationCoordinate = data.data.endStationCoordinate;
|
List< Double > endStationCoordinate = data.data.endStationCoordinate;
|
||||||
if (endStationCoordinate != null && endStationCoordinate.size()>1){
|
List< Double > endGcjStationCoordinate = data.data.endGcjStationCoordinate;
|
||||||
endStation.lon = endStationCoordinate.get( 0 );
|
if (endStationCoordinate != null && endStationCoordinate.size()>1 &&
|
||||||
endStation.lat = endStationCoordinate.get( 1 );
|
endGcjStationCoordinate!=null && endGcjStationCoordinate.size() > 1){
|
||||||
|
endStation.lon = endGcjStationCoordinate.get( 0 );
|
||||||
|
endStation.lat = endGcjStationCoordinate.get( 1 );
|
||||||
|
endStation.wgsLon = endStationCoordinate.get( 0 );
|
||||||
|
endStation.wgsLat = endStationCoordinate.get( 1 );
|
||||||
endStation.siteId = data.data.endStationId;
|
endStation.siteId = data.data.endStationId;
|
||||||
endStation.siteName = data.data.endStation;
|
endStation.siteName = data.data.endStation;
|
||||||
mCurrentOCHOrder.drivingRoutes.add( endStation );
|
mCurrentOCHOrder.drivingRoutes.add( endStation );
|
||||||
@@ -553,6 +562,7 @@ class MogoOCHTaxiModel {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Logger.d( TAG, "收到新订单" + GsonUtil.jsonFromObject(obj));
|
Logger.d( TAG, "收到新订单" + GsonUtil.jsonFromObject(obj));
|
||||||
|
|
||||||
mCurrentOCHOrder = obj;
|
mCurrentOCHOrder = obj;
|
||||||
cacheOrderInfo2Native( mCurrentOCHOrder );
|
cacheOrderInfo2Native( mCurrentOCHOrder );
|
||||||
Location location = MogoApisHandler.getInstance()
|
Location location = MogoApisHandler.getInstance()
|
||||||
@@ -789,8 +799,8 @@ class MogoOCHTaxiModel {
|
|||||||
|
|
||||||
RemoteControlAutoPilotParameters parameters = new RemoteControlAutoPilotParameters();
|
RemoteControlAutoPilotParameters parameters = new RemoteControlAutoPilotParameters();
|
||||||
parameters.vehicleType = mCurrentOCHOrder.orderType;
|
parameters.vehicleType = mCurrentOCHOrder.orderType;
|
||||||
parameters.startLatLon = new RemoteControlAutoPilotParameters.AutoPilotLonLat( mCurrentOCHOrder.drivingRoutes.get( 0 ).lat, mCurrentOCHOrder.drivingRoutes.get( 0 ).lon );
|
parameters.startLatLon = new RemoteControlAutoPilotParameters.AutoPilotLonLat( mCurrentOCHOrder.drivingRoutes.get( 0 ).wgsLat, mCurrentOCHOrder.drivingRoutes.get( 0 ).wgsLon );
|
||||||
parameters.endLatLon = new RemoteControlAutoPilotParameters.AutoPilotLonLat( mCurrentOCHOrder.drivingRoutes.get( 1 ).lat, mCurrentOCHOrder.drivingRoutes.get( 1 ).lon );
|
parameters.endLatLon = new RemoteControlAutoPilotParameters.AutoPilotLonLat( mCurrentOCHOrder.drivingRoutes.get( 1 ).wgsLat, mCurrentOCHOrder.drivingRoutes.get( 1 ).wgsLon );
|
||||||
MogoApisHandler.getInstance()
|
MogoApisHandler.getInstance()
|
||||||
.getApis()
|
.getApis()
|
||||||
.getAdasControllerApi()
|
.getAdasControllerApi()
|
||||||
@@ -813,7 +823,6 @@ class MogoOCHTaxiModel {
|
|||||||
double distance = CoordinateUtils.calculateLineDistance(
|
double distance = CoordinateUtils.calculateLineDistance(
|
||||||
endStationOCHLocation.lon, endStationOCHLocation.lat,
|
endStationOCHLocation.lon, endStationOCHLocation.lat,
|
||||||
carLocation.getLongitude(), carLocation.getLatitude());
|
carLocation.getLongitude(), carLocation.getLatitude());
|
||||||
Logger.e("lianglihui","剩余里程:"+distance);
|
|
||||||
mCurrentOCHOrder.decreaseTravelDistance(distance);
|
mCurrentOCHOrder.decreaseTravelDistance(distance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ enum OCHOrderStatus {
|
|||||||
UserArriveAtStartStation( 3 ),
|
UserArriveAtStartStation( 3 ),
|
||||||
OnTheWayToEndStation( 4 ),
|
OnTheWayToEndStation( 4 ),
|
||||||
ArriveAtEndStation( 5 ),
|
ArriveAtEndStation( 5 ),
|
||||||
Completed( 6 ),
|
Completed( 6 ),//行程完成
|
||||||
Cancel( 7 );
|
Cancel( 7 );
|
||||||
|
|
||||||
private int code;
|
private int code;
|
||||||
|
|||||||
@@ -33,8 +33,7 @@ class OCHTaxiOrderResponse implements Parcelable {
|
|||||||
* @param distance
|
* @param distance
|
||||||
*/
|
*/
|
||||||
public void decreaseTravelDistance( double distance ) {
|
public void decreaseTravelDistance( double distance ) {
|
||||||
// travelDistance -= ( ( float ) distance / 1000f );
|
travelDistance = ( ( float ) distance / 1000f );
|
||||||
travelDistance = distance;
|
|
||||||
if ( travelDistance < 0 ) {
|
if ( travelDistance < 0 ) {
|
||||||
travelDistance = 0;
|
travelDistance = 0;
|
||||||
}
|
}
|
||||||
@@ -43,9 +42,10 @@ class OCHTaxiOrderResponse implements Parcelable {
|
|||||||
public static class OCHTaxiStation implements Parcelable {
|
public static class OCHTaxiStation implements Parcelable {
|
||||||
public String siteId;
|
public String siteId;
|
||||||
public String siteName;
|
public String siteName;
|
||||||
public double lon;
|
public double lon;// 用于计算距离
|
||||||
public double lat;
|
public double lat;
|
||||||
|
public double wgsLon;//用于自动驾驶
|
||||||
|
public double wgsLat;
|
||||||
public OCHTaxiStation() {
|
public OCHTaxiStation() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,6 +60,8 @@ class OCHTaxiOrderResponse implements Parcelable {
|
|||||||
dest.writeString( this.siteName );
|
dest.writeString( this.siteName );
|
||||||
dest.writeDouble( this.lon );
|
dest.writeDouble( this.lon );
|
||||||
dest.writeDouble( this.lat );
|
dest.writeDouble( this.lat );
|
||||||
|
dest.writeDouble( this.wgsLon );
|
||||||
|
dest.writeDouble( this.wgsLat );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected OCHTaxiStation( Parcel in ) {
|
protected OCHTaxiStation( Parcel in ) {
|
||||||
@@ -67,6 +69,8 @@ class OCHTaxiOrderResponse implements Parcelable {
|
|||||||
this.siteName = in.readString();
|
this.siteName = in.readString();
|
||||||
this.lon = in.readDouble();
|
this.lon = in.readDouble();
|
||||||
this.lat = in.readDouble();
|
this.lat = in.readDouble();
|
||||||
|
this.wgsLon = in.readDouble();
|
||||||
|
this.wgsLat = in.readDouble();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Creator< OCHTaxiStation > CREATOR = new Creator< OCHTaxiStation >() {
|
public static final Creator< OCHTaxiStation > CREATOR = new Creator< OCHTaxiStation >() {
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ class OCHTaxiOrderResponse2 extends BaseData {
|
|||||||
public String startStationId;
|
public String startStationId;
|
||||||
// 起点站点
|
// 起点站点
|
||||||
public List< Double > startStationCoordinate;
|
public List< Double > startStationCoordinate;
|
||||||
|
public List< Double > startGcjStationCoordinate;//高德坐标系 用于距离计算
|
||||||
|
|
||||||
// 目的站名称
|
// 目的站名称
|
||||||
public String endStation;
|
public String endStation;
|
||||||
@@ -43,6 +44,7 @@ class OCHTaxiOrderResponse2 extends BaseData {
|
|||||||
public String endStationId;
|
public String endStationId;
|
||||||
// 终点站点
|
// 终点站点
|
||||||
public List< Double > endStationCoordinate;
|
public List< Double > endStationCoordinate;
|
||||||
|
public List< Double > endGcjStationCoordinate;//高德坐标系 用于距离计算
|
||||||
|
|
||||||
public String orderStartTime;
|
public String orderStartTime;
|
||||||
public String cityCode;
|
public String cityCode;
|
||||||
|
|||||||
@@ -258,10 +258,10 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
|
|||||||
Logger.d( TAG, "更新状态失败2" );
|
Logger.d( TAG, "更新状态失败2" );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
MogoApisHandler.getInstance()
|
// MogoApisHandler.getInstance()
|
||||||
.getApis()
|
// .getApis()
|
||||||
.getRegisterCenterApi()
|
// .getRegisterCenterApi()
|
||||||
.unregisterCarLocationChangedListener( TAG, this );
|
// .unregisterCarLocationChangedListener( TAG, this );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -366,7 +366,6 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCarLocationChanged( MogoLatLng latLng ) {
|
public void onCarLocationChanged( MogoLatLng latLng ) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Location mLocation;
|
private Location mLocation;
|
||||||
@@ -376,7 +375,6 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
|
|||||||
OCHTaxiUiController.getInstance().runOnUIThread( () -> {
|
OCHTaxiUiController.getInstance().runOnUIThread( () -> {
|
||||||
calculateTravelDistance( location );
|
calculateTravelDistance( location );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// //坐标转换
|
// //坐标转换
|
||||||
// MogoLocation loc = new MogoLocation();
|
// MogoLocation loc = new MogoLocation();
|
||||||
// loc.setTime(loc.getTime());
|
// loc.setTime(loc.getTime());
|
||||||
@@ -452,10 +450,13 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
|
|||||||
getPanelView().setVisibility(View.INVISIBLE);
|
getPanelView().setVisibility(View.INVISIBLE);
|
||||||
hideSlidePanel();
|
hideSlidePanel();
|
||||||
changeOperationViewVisible(View.VISIBLE);
|
changeOperationViewVisible(View.VISIBLE);
|
||||||
}else {
|
isSpeakedEndingNotice = false;
|
||||||
|
} else {
|
||||||
getPanelView().setVisibility(View.VISIBLE);
|
getPanelView().setVisibility(View.VISIBLE);
|
||||||
changeOperationViewVisible(View.INVISIBLE);
|
changeOperationViewVisible(View.INVISIBLE);
|
||||||
OCHTaxiUiController.getInstance().setOCHTaxiArriveCallback( this );
|
}
|
||||||
|
if (status == OCHOrderStatus.OnTheWayToStartStation.getCode()){
|
||||||
|
showNotice("收到新订单");
|
||||||
}
|
}
|
||||||
updateOrderStatus();
|
updateOrderStatus();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ MOGO_AICLOUD_SERVICES_APK_VERSION=1.0.0-SNAPSHOT
|
|||||||
# mogoAiCloud sdk services
|
# mogoAiCloud sdk services
|
||||||
MOGO_AICLOUD_SERVICES_SDK_VERSION=1.0.0-SNAPSHOT
|
MOGO_AICLOUD_SERVICES_SDK_VERSION=1.0.0-SNAPSHOT
|
||||||
# 自研地图
|
# 自研地图
|
||||||
MAP_SDK_VERSION=1.0.0-vr-8.5.63
|
MAP_SDK_VERSION=1.0.0-vr-8.5.64
|
||||||
|
|
||||||
|
|
||||||
## 产品库必备配置,产品库自动对versionCode和versionName版本进行升级
|
## 产品库必备配置,产品库自动对versionCode和versionName版本进行升级
|
||||||
|
|||||||
@@ -110,4 +110,7 @@ fix crash
|
|||||||
修改崩溃
|
修改崩溃
|
||||||
|
|
||||||
8.5.63
|
8.5.63
|
||||||
修改infoWindow崩溃
|
修改infoWindow崩溃
|
||||||
|
|
||||||
|
8.5.64
|
||||||
|
修改崩溃
|
||||||
@@ -263,21 +263,22 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
|||||||
// Log.d( "matchRoad", "cost = %s", System.currentTimeMillis() - start );
|
// Log.d( "matchRoad", "cost = %s", System.currentTimeMillis() - start );
|
||||||
|
|
||||||
mLastPositions.put(uniqueKey, recognizedListResult);
|
mLastPositions.put(uniqueKey, recognizedListResult);
|
||||||
if (useCache) {
|
// if (useCache) {
|
||||||
Log.d(TAG, "使用缓存 id : " + uniqueKey);
|
// }
|
||||||
long interval = 45;
|
Log.d(TAG, "使用缓存 id : " + uniqueKey);
|
||||||
if(lastPosition != null){
|
long interval = 45;
|
||||||
interval = computeAnimDuration(lastPosition.systemTime, recognizedListResult.systemTime, lastPosition.satelliteTime, recognizedListResult.satelliteTime);
|
if(lastPosition != null){
|
||||||
}
|
interval = computeAnimDuration(lastPosition.systemTime, recognizedListResult.systemTime, lastPosition.satelliteTime, recognizedListResult.satelliteTime);
|
||||||
final MogoLatLng renderLoc = new MogoLatLng(recognizedListResult.lat, recognizedListResult.lon);
|
|
||||||
long cost = System.currentTimeMillis() - start;
|
|
||||||
final long intervalRef = interval - cost;
|
|
||||||
marker.addDynamicAnchorPosition(renderLoc, (float) recognizedListResult.heading, intervalRef);
|
|
||||||
} else {
|
|
||||||
Log.d(TAG, "未使用缓存 id : " + uniqueKey);
|
|
||||||
marker.setRotateAngle(((float) recognizedListResult.heading));
|
|
||||||
marker.setPosition(recognizedListResult.lat, recognizedListResult.lon);
|
|
||||||
}
|
}
|
||||||
|
final MogoLatLng renderLoc = new MogoLatLng(recognizedListResult.lat, recognizedListResult.lon);
|
||||||
|
long cost = System.currentTimeMillis() - start;
|
||||||
|
final long intervalRef = interval - cost;
|
||||||
|
marker.addDynamicAnchorPosition(renderLoc, (float) recognizedListResult.heading, intervalRef);
|
||||||
|
// else {
|
||||||
|
// Log.d(TAG, "未使用缓存 id : " + uniqueKey);
|
||||||
|
// marker.setRotateAngle(((float) recognizedListResult.heading));
|
||||||
|
// marker.setPosition(recognizedListResult.lat, recognizedListResult.lon);
|
||||||
|
// }
|
||||||
String carColor = recognizedListResult.color;
|
String carColor = recognizedListResult.color;
|
||||||
if (TextUtils.isEmpty(carColor)) {
|
if (TextUtils.isEmpty(carColor)) {
|
||||||
carColor = getModelRenderColor(recognizedListResult.type, FROM_ADAS, recognizedListResult.speed, recognizedListResult.lon, recognizedListResult.lat, recognizedListResult.heading);
|
carColor = getModelRenderColor(recognizedListResult.type, FROM_ADAS, recognizedListResult.speed, recognizedListResult.lon, recognizedListResult.lat, recognizedListResult.heading);
|
||||||
|
|||||||
Reference in New Issue
Block a user