Commit f2e07035 authored by p x's avatar p x
Browse files

调整偏移量

parent 101e1aa2
...@@ -36,7 +36,7 @@ public class VehicleInfoDto { ...@@ -36,7 +36,7 @@ public class VehicleInfoDto {
//档位 //档位
@Order(7) @Order(7)
private short tapPos ; private byte tapPos ;
//方向盘转角 //方向盘转角
@Order(8) @Order(8)
private double steeringAngle; private double steeringAngle;
......
...@@ -8,7 +8,7 @@ import java.lang.annotation.Target; ...@@ -8,7 +8,7 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME) // 注解在运行时可用 @Retention(RetentionPolicy.RUNTIME) // 注解在运行时可用
@Target(ElementType.FIELD) // 注解只能用于字段(属性) @Target(ElementType.FIELD) // 注解只能用于字段(属性)
public @interface OffsetDef { public @interface OffsetDef {
double value() default 1; double value() default 1;//偏移量
int type() default 1; //1:除法 2:乘法; int type() default 2; //1:除法 2:乘法;
int minValidLength() default 0; int minValidLength() default 0;//数据最小位数,不够补0
} }
...@@ -216,7 +216,7 @@ public class Parse { ...@@ -216,7 +216,7 @@ public class Parse {
Class<?> type = field.getType(); Class<?> type = field.getType();
if(offsetDef!=null) { if(offsetDef!=null) {
double offset =offsetDef.value(); double offset =offsetDef.value();
int type1 =offsetDef.type(); int ofsetType =offsetDef.type();
int minValidLength =offsetDef.minValidLength(); int minValidLength =offsetDef.minValidLength();
//startindex //startindex
...@@ -254,7 +254,8 @@ public class Parse { ...@@ -254,7 +254,8 @@ public class Parse {
tField.set(target, (float)f); tField.set(target, (float)f);
} }
}else { }else {
double f =(Integer)o*offset; // double f =(Integer)o*offset;
float f = (float) ((Integer)o*offset);
tField.set(target, (float)f); tField.set(target, (float)f);
} }
}else if(type==long.class) { }else if(type==long.class) {
...@@ -329,13 +330,5 @@ public class Parse { ...@@ -329,13 +330,5 @@ public class Parse {
} }
} }
public static byte[] convoter(Byte[] bytes) {
byte [] bs = new byte[bytes.length];
int i=0;
for(Byte b :bytes ) {
bs[i++] = b;
}
return bs;
}
} }
...@@ -27,26 +27,26 @@ public class VehicleInfo { ...@@ -27,26 +27,26 @@ public class VehicleInfo {
private long timestampGNSS; private long timestampGNSS;
//GNSS 速度 单位:0.01 m/s //GNSS 速度 单位:0.01 m/s
@Order(4) @Order(4)
@OffsetDef(value=36,type=2) @OffsetDef(value=0.036,type=2)
private int velocityGNSS; private int velocityGNSS;
//位置 //位置
@Order(5) @Order(5)
private Position position; private Position position;
//航向角 单位为 1e-4 ° //航向角 单位为 1e-4 °
@Order(6) @Order(6)
@OffsetDef(value=10000) @OffsetDef(value=0.0001,type = 2)
private long heading; private int heading;
//档位 //档位
@Order(7) @Order(7)
private short tapPos ; private byte tapPos ;
//方向盘转角 单位为 1e-4 ° //方向盘转角 单位为 1e-4 °
@Order(8) @Order(8)
@OffsetDef(value=10000) @OffsetDef(value=0.0001)
private long steeringAngle; private long steeringAngle;
//当前车速 单位:0.01m/s //当前车速 单位:0.01m/s
@Order(9) @Order(9)
@OffsetDef(value=36,type=2) @OffsetDef(value=0.036,type=2)
private int velocity; private int velocity;
//纵向加速度 单位:0.01m/s //纵向加速度 单位:0.01m/s
@Order(10) @Order(10)
...@@ -98,7 +98,7 @@ public class VehicleInfo { ...@@ -98,7 +98,7 @@ public class VehicleInfo {
//车辆驾驶模式 //车辆驾驶模式
@Order(21) @Order(21)
private short driveMode; private byte driveMode;
//目的地位置 //目的地位置
@Order(22) @Order(22)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment