Browse Source

更新采集算法

调整保存测量结果api增加手动对齐
master
白凤吉 4 months ago
parent
commit
65cb50eab9
  1. 2
      app/src/main/java/com/iflytop/profilometer/ProfilometerApplication.java
  2. 11
      app/src/main/java/com/iflytop/profilometer/api/measure/MeasureApi.java
  3. 6
      app/src/main/java/com/iflytop/profilometer/core/bluetooth/BleDeviceDriver.java
  4. 7
      app/src/main/java/com/iflytop/profilometer/core/bluetooth/BleDeviceListener.java
  5. 28
      app/src/main/java/com/iflytop/profilometer/core/bluetooth/BleManager.java
  6. 2
      app/src/main/java/com/iflytop/profilometer/core/db/helper/MyDatabaseHelper.java
  7. 114
      app/src/main/java/com/iflytop/profilometer/core/migration/channel/BleDeviceUartChannel.java
  8. 4
      app/src/main/java/com/iflytop/profilometer/core/migration/config/AppConstantConfig.java
  9. 20
      app/src/main/java/com/iflytop/profilometer/core/migration/measure/drawer/RailProfileDrawer.java
  10. 2
      app/src/main/java/com/iflytop/profilometer/core/migration/measure/drawer/type/RailProfileDrawerState.java
  11. 8
      app/src/main/java/com/iflytop/profilometer/core/migration/measure/drawer/type/XYPoint.java
  12. 3
      app/src/main/java/com/iflytop/profilometer/core/migration/type/protocol/TPMIPacket.java
  13. 43
      app/src/main/java/com/iflytop/profilometer/core/migration/type/protocol/TPMIPosReport.java
  14. 9
      app/src/main/java/com/iflytop/profilometer/model/entity/ProfileRecordPointSet.java
  15. 15
      app/src/main/java/com/iflytop/profilometer/service/RailProfileDrawerService.java

2
app/src/main/java/com/iflytop/profilometer/ProfilometerApplication.java

@ -70,7 +70,7 @@ public class ProfilometerApplication extends Application {
userDao.insertAdminUserIfNotExists();
BaseProfileRecordPointSetDao baseProfileRecordPointSetDao = new BaseProfileRecordPointSetDao(this);
BaseProfileRecordPointSet baseProfileRecordPointSet = baseProfileRecordPointSetDao.getBaseProfileRecordPointSetByCode("60");
BaseProfileRecordPointSet baseProfileRecordPointSet = baseProfileRecordPointSetDao.getBaseProfileRecordPointSetByCode("GX-60");
if (baseProfileRecordPointSet == null) {
baseProfileRecordPointSet = new BaseProfileRecordPointSet();
baseProfileRecordPointSet.setName("60型标准轨");

11
app/src/main/java/com/iflytop/profilometer/api/measure/MeasureApi.java

@ -109,6 +109,17 @@ public class MeasureApi {
profileRecordPointSet.setProfileRecordUuid(profileRecordDescription.getUuid());
profileRecordPointSet.setLeftPoints(JSONUtil.toJsonStr(leftPoint));
profileRecordPointSet.setRightPoints(JSONUtil.toJsonStr(rightPoint));
List<XYPoint> alignPoints = JSONUtil.toList(params.get("alignPoints"), XYPoint.class);
if (alignPoints == null || alignPoints.isEmpty()) {
alignPoints = taskState.getAlignPointSetList();
}
if (alignPoints.isEmpty()) {
List<XYPoint> leftPointsRevers = new ArrayList<>(leftPoint);
Collections.reverse(leftPointsRevers);
alignPoints.addAll(leftPointsRevers);
alignPoints.addAll(rightPoint);
}
profileRecordPointSet.setAlignPoints(JSONUtil.toJsonStr(alignPoints));
profileRecordPointSetDao.insertProfileRecordPointSet(profileRecordPointSet);
return Result.success();

6
app/src/main/java/com/iflytop/profilometer/core/bluetooth/BleDeviceDriver.java

@ -1,14 +1,14 @@
package com.iflytop.profilometer.core.bluetooth;
import com.iflytop.profilometer.core.migration.channel.BleDeviceUartChannel;
import com.iflytop.profilometer.core.migration.config.AppConstantConfig;
import com.iflytop.profilometer.core.migration.factory.TPMIPacketFactory;
import com.iflytop.profilometer.core.migration.measure.AppConstantConfig;
import com.iflytop.profilometer.core.migration.type.DeviceAppearance;
import com.iflytop.profilometer.core.migration.type.protocol.TPMIPacket;
import com.iflytop.profilometer.model.bo.RailProfileMeasureTaskState;
public class BleDeviceDriver {
static final public Integer CMD_OVERTIME = 50;
static final public Integer CMD_OVERTIME = 2000;
private final BleDeviceUartChannel uartChannel;
private RailProfileMeasureTaskState taskState = new RailProfileMeasureTaskState();
@ -56,7 +56,7 @@ public class BleDeviceDriver {
* 启动位移采样启动测量
*/
public void startSampling() {
TPMIPacket packet = TPMIPacketFactory.buildStartPosSampleCmd(AppConstantConfig.POINT_REPORT_PERIOD);
TPMIPacket packet = TPMIPacketFactory.buildStartPosSampleCmd(AppConstantConfig.SAMPLE_PERIOD);
uartChannel.sendCommand(packet, CMD_OVERTIME);
}

7
app/src/main/java/com/iflytop/profilometer/core/bluetooth/BleDeviceListener.java

@ -26,9 +26,10 @@ public class BleDeviceListener implements BleDeviceOnReportListener {
@Override
public void onPosReport(TPMIPosReport report) {
// Log.i(TAG, "位置信息上报:");
// Log.i(TAG, "ARM0角度 " + report.getArm1Angle());
// Log.i(TAG, "ARM1角度" + report.getArm2Angle());
// Log.i(TAG, "位置信息上报:" + report.getIndexAsInt());
// for (int i = 0; i < report.getPosReportNum(); i++) {
// Log.i(TAG, "ARM0角度 " + report.getArm1Angle(i) + " ARM1角度 " + report.getArm2Angle(i));
// }
RailProfileDrawerService railProfileDrawerService = SystemService.getInstance().getRailProfileDrawerService();
railProfileDrawerService.processStateReport(report);
}

28
app/src/main/java/com/iflytop/profilometer/core/bluetooth/BleManager.java

@ -10,6 +10,7 @@ import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothGatt;
import android.bluetooth.BluetoothGattCallback;
import android.bluetooth.BluetoothGattCharacteristic;
import android.bluetooth.BluetoothGattDescriptor;
import android.bluetooth.BluetoothGattService;
import android.bluetooth.BluetoothManager;
import android.bluetooth.BluetoothProfile;
@ -459,14 +460,28 @@ public class BleManager {
@Override
public void onServicesDiscovered(BluetoothGatt gatt, int status) {
if (status == BluetoothGatt.GATT_SUCCESS) {
Log.d(TAG, "服务发现成功,目标服务存在");
// 获取目标服务
BluetoothGattService service = gatt.getService(SERVICE_UUID);
if (service != null) {
Log.d(TAG, "服务发现成功,目标服务存在");
connectionSuccess.set(true);
} else {
Log.e(TAG, "服务发现成功,但未找到目标服务");
connectionSuccess.set(false);
// 获取通知特征
BluetoothGattCharacteristic notifyCharacteristic = service.getCharacteristic(NOTIFY_CHARACTERISTIC_UUID);
if (notifyCharacteristic != null) {
// 启用通知
gatt.setCharacteristicNotification(notifyCharacteristic, true);
// 获取描述符
BluetoothGattDescriptor descriptor = notifyCharacteristic.getDescriptor(CLIENT_CHARACTERISTIC_CONFIG_UUID);
if (descriptor != null) {
descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
gatt.writeDescriptor(descriptor);
} else {
Log.e(TAG, "未发现描述符 " + CLIENT_CHARACTERISTIC_CONFIG_UUID);
}
} else {
Log.e(TAG, "未发现通知特征 " + NOTIFY_CHARACTERISTIC_UUID);
}
}
connectionSuccess.set(true);
} else {
Log.e(TAG, "服务发现失败,错误码:" + status);
connectionSuccess.set(false);
@ -476,6 +491,7 @@ public class BleManager {
}
}
@Override
public void onCharacteristicChanged(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {
if (NOTIFY_CHARACTERISTIC_UUID.equals(characteristic.getUuid())) {
@ -490,7 +506,7 @@ public class BleManager {
public void onCharacteristicWrite(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) {
if (status != BluetoothGatt.GATT_SUCCESS) {
Log.i(TAG, "数据写入失败,错误码:" + status);
}else{
} else {
Log.i(TAG, "数据写入成功" + status);
}
}

2
app/src/main/java/com/iflytop/profilometer/core/db/helper/MyDatabaseHelper.java

@ -7,7 +7,7 @@ import android.database.sqlite.SQLiteOpenHelper;
public class MyDatabaseHelper extends SQLiteOpenHelper {
private static final String DATABASE_NAME = "app.db";
private static final int DATABASE_VERSION = 11; // 升级版本号
private static final int DATABASE_VERSION = 12; // 升级版本号
// 表名
public static final String TABLE_APP_USER = "app_user";

114
app/src/main/java/com/iflytop/profilometer/core/migration/channel/BleDeviceUartChannel.java

@ -9,25 +9,27 @@ import com.iflytop.profilometer.core.migration.type.protocol.TPMIBasicReport;
import com.iflytop.profilometer.core.migration.type.protocol.TPMIPacket;
import com.iflytop.profilometer.core.migration.type.protocol.TPMIPosReport;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
import java.nio.ByteBuffer;
import java.util.concurrent.*;
public class BleDeviceUartChannel {
public interface OnBleReportListener {
void onReportReceived(TPMIPacket packet);
}
private OnBleReportListener reportListener;
private BleDeviceOnReportListener deviceOnReportListener;
private final byte[] buffer = new byte[1024];
private int bufferLen = 0;
private final ByteBuffer receiveBuffer = ByteBuffer.allocate(10240);
private final CommandTransactionContext ctCxt = new CommandTransactionContext();
private final BlockingQueue<TPMIPacket> reportPacketList = new ArrayBlockingQueue<>(100);
private BlockingQueue<TPMIPacket> reportPacketList = new ArrayBlockingQueue<>(100);
private final ExecutorService bleExecutor = Executors.newSingleThreadExecutor(r -> {
Thread t = new Thread(r);
t.setName("ble-handler-thread");
t.setPriority(Thread.MAX_PRIORITY);
return t;
});
public static class CommandTransactionContext {
private TPMIPacket txPacket;
@ -42,7 +44,7 @@ public class BleDeviceUartChannel {
}
synchronized TPMIPacket clearCtCxt() {
var packet = this.rxPacket;
TPMIPacket packet = this.rxPacket;
this.rxPacket = null;
this.txPacket = null;
this.semaphore = null;
@ -50,19 +52,12 @@ public class BleDeviceUartChannel {
return packet;
}
void waitCxt(Integer overtime) throws InterruptedException {
this.semaphore.tryAcquire(overtime, TimeUnit.MILLISECONDS);
void waitCxt(Integer timeoutMs) throws InterruptedException {
this.semaphore.tryAcquire(timeoutMs, TimeUnit.MILLISECONDS);
}
synchronized void trySetReceiptPacket(TPMIPacket packet) {
if (this.txPacket == null) {
// log.warn("rx receipt but no tx packet, ignore");
return;
}
if (this.waitIndex != packet.getIndex()) {
// log.warn("rx receipt but index not match, expect {}, but {}", this.waitIndex, packet.getIndex());
return;
}
if (txPacket == null || waitIndex != packet.getIndex()) return;
this.rxPacket = packet;
this.semaphore.release();
}
@ -80,56 +75,54 @@ public class BleDeviceUartChannel {
this.deviceOnReportListener = listener;
}
public synchronized TPMIPacket sendCommand(TPMIPacket tx, Integer overtime) {
Log.i("BLE", "TX PACKET :" + tx);
public synchronized TPMIPacket sendCommand(TPMIPacket tx, Integer timeoutMs) {
Log.i("BLE", "TX PACKET: " + tx);
ctCxt.newCtCxt(tx);
BleManager.getInstance().sendMessage(tx.rawpacket);
try {
ctCxt.waitCxt(overtime);
} catch (InterruptedException ignored) {
ctCxt.waitCxt(timeoutMs);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
return ctCxt.clearCtCxt();
}
private void handleReceivedData(byte[] data) {
// Log.d("BLE", "收到原始数据: " + Arrays.toString(data));
bleExecutor.execute(() -> processIncomingData(data));
}
// 追加到缓冲区
if (bufferLen + data.length > buffer.length) {
Log.w("BLE", "BLE缓冲区溢出,已清空");
bufferLen = 0;
}
System.arraycopy(data, 0, buffer, bufferLen, data.length);
bufferLen += data.length;
int offset = 0;
while (offset < bufferLen) {
var report = TPMIPacketFactory.analysisRawRxData(buffer, bufferLen, offset);
if (report.result.equals(TPMIPacketFactory.PacketAnalysisResult.SUC)) {
// Log.d("BLE", "BLE协议包解析成功: " + report.packet);
// if (reportListener != null) {
// reportListener.onReportReceived(report.packet);
// }
if (deviceOnReportListener != null) {
dispatchTypedPacket(report.packet);
private void processIncomingData(byte[] data) {
synchronized (receiveBuffer) {
if (receiveBuffer.remaining() < data.length) {
Log.w("BLE", "BLE缓冲区溢出,已清空");
receiveBuffer.clear();
}
receiveBuffer.put(data);
receiveBuffer.flip(); // 切换为读模式
while (receiveBuffer.remaining() > 0) {
int offset = receiveBuffer.position();
var report = TPMIPacketFactory.analysisRawRxData(
receiveBuffer.array(),
receiveBuffer.limit(),
offset
);
if (report.result == TPMIPacketFactory.PacketAnalysisResult.SUC) {
if (reportListener != null) reportListener.onReportReceived(report.packet);
if (deviceOnReportListener != null) dispatchTypedPacket(report.packet);
receiveBuffer.position(offset + report.packet.getPacketLen());
Log.i("BLE","SUC : " + report.packet.getPacketLen());
} else if (report.result == TPMIPacketFactory.PacketAnalysisResult.PACKE_NOT_FULLY_RECEIVED) {
// Log.i("BLE","PACKE_NOT_FULLY_RECEIVED : " + data.length);
break;
} else {
receiveBuffer.position(offset + 1);
}
offset += report.packet.getPacketLen();
} else if (report.result.equals(TPMIPacketFactory.PacketAnalysisResult.CHECKSUM_ERROR)) {
Log.w("BLE", "BLE数据包校验失败,跳过 1 字节");
offset += 1;
} else if (report.result.equals(TPMIPacketFactory.PacketAnalysisResult.PACKE_NOT_FULLY_RECEIVED)) {
break;
} else {
offset += 1;
}
}
// 移除已处理部分数据
if (offset > 0 && offset <= bufferLen) {
System.arraycopy(buffer, offset, buffer, 0, bufferLen - offset);
bufferLen -= offset;
// 保留未解析部分
receiveBuffer.compact(); // 相当于 left shift将未读部分移到开头
}
}
@ -146,12 +139,9 @@ public class BleDeviceUartChannel {
}
private void processRXPacket(TPMIPacket rx) {
if (rx.getPacketType().equals(TPMIPacket.PacketType.RESPONSE)) {
if (rx.getPacketType() == TPMIPacket.PacketType.RESPONSE) {
ctCxt.trySetReceiptPacket(rx);
} else if (rx.getPacketType().equals(TPMIPacket.PacketType.REPORT)) {
/*
* 处理上报包
*/
} else if (rx.getPacketType() == TPMIPacket.PacketType.REPORT) {
reportPacketList.offer(rx);
}
}

4
app/src/main/java/com/iflytop/profilometer/core/migration/measure/AppConstantConfig.java → app/src/main/java/com/iflytop/profilometer/core/migration/config/AppConstantConfig.java

@ -1,9 +1,9 @@
package com.iflytop.profilometer.core.migration.measure;
package com.iflytop.profilometer.core.migration.config;
public class AppConstantConfig {
public static final int HEARTBEAT_INTERVAL = 10000;
//100ms上报一次点位
public static final int POINT_REPORT_PERIOD = 3;
public static final int SAMPLE_PERIOD = 1;
}

20
app/src/main/java/com/iflytop/profilometer/core/migration/measure/drawer/RailProfileDrawer.java

@ -1,5 +1,8 @@
package com.iflytop.profilometer.core.migration.measure.drawer;
import android.util.Log;
import com.iflytop.profilometer.core.migration.config.AppConstantConfig;
import com.iflytop.profilometer.core.migration.measure.drawer.type.MeasureSide;
import com.iflytop.profilometer.core.migration.measure.drawer.type.RailProfileDrawerListener;
import com.iflytop.profilometer.core.migration.measure.drawer.type.RailProfileDrawerState;
@ -7,6 +10,7 @@ import com.iflytop.profilometer.core.migration.measure.drawer.type.RailProfileMe
import com.iflytop.profilometer.core.migration.measure.drawer.type.XYPoint;
public class RailProfileDrawer {
private static final String TAG = "measurer";
/*
* 轮廓绘制启动信号判断相关参数
* 逻辑:
@ -21,7 +25,7 @@ public class RailProfileDrawer {
* 静止判断位置阈值(毫米)
* STILL_JUDGE_THRESHOLD
*/
public static final double PRECISION = 0.2;// mm 满足13cm1500个点
public static final double PRECISION = 0.12;// mm 满足13cm1500个点
public static final int OUTLINE_START_RECORD_SIG_JUDGE_TIME_THRESHOLD = 1500;
public static final int START_OUTLINE_RECORDING_TIMING_JUDGMENT_AREA_HIGHT = 30;
public static final int START_OUTLINE_RECORDING_TIMING_JUDGMENT_AREA_WEIGHT = 50;
@ -37,9 +41,9 @@ public class RailProfileDrawer {
}
Config cfg = new Config(); // 配置
RailProfileDrawerState state = new RailProfileDrawerState();
RailProfileDrawerState state = new RailProfileDrawerState();
RailProfileDrawerListener railProfileDrawerListener;
MeasureSide startSide = MeasureSide.LEFT;
MeasureSide startSide = MeasureSide.LEFT;
public RailProfileDrawer(RailProfileDrawerListener railProfileDrawerListener) {
this.railProfileDrawerListener = railProfileDrawerListener;
@ -48,8 +52,8 @@ public class RailProfileDrawer {
synchronized public void startDraw(double arm1Length, double arm2Length, double pulleyRadius,
double profilometerHight) {
// log.info("startDraw arm1Length:{} arm2Length:{} pulleyRadius:{} profilometerHight:{}", arm1Length, arm2Length,
// pulleyRadius, profilometerHight);
Log.i(TAG, String.format("startDraw arm1Length:%s arm2Length:%s pulleyRadius:%s profilometerHight:%s",
arm1Length, arm2Length, pulleyRadius, profilometerHight));
this.cfg.arm1Length = arm1Length;
this.cfg.arm2Length = arm2Length;
this.cfg.pulleyRadius = pulleyRadius;
@ -141,7 +145,7 @@ public class RailProfileDrawer {
}
if (!expectSide.equals(side)) {
// log.warn("用户启动记录方向错误");
Log.w(TAG, "用户启动记录方向错误");
railProfileDrawerListener.onErrorStartRecordProfileSig();
state.stayStillDurationCnt = 0;
} else {
@ -168,7 +172,7 @@ public class RailProfileDrawer {
// }
// }
if (distance(state.lastPulleyPoint, newPulleyPoint) < 0.002) {
if (distance(state.lastPulleyPoint, newPulleyPoint) < 0.005) {
// log.info("same point, skip");
return;
}
@ -222,7 +226,7 @@ public class RailProfileDrawer {
if (speedNow > 100) {
state.errorSpeedDetectedCnt++;
if (state.errorSpeedDetectedCnt > 3) {
// log.warn("error speed detected, speed:{}", speedNow);
Log.w(TAG, String.format("error speed detected, speed:%s", speedNow));
state.speedNow = speedNow;
if (!state.errorSpeedDetected) {
state.errorSpeedDetected = true;

2
app/src/main/java/com/iflytop/profilometer/core/migration/measure/drawer/type/RailProfileDrawerState.java

@ -17,7 +17,7 @@ public class RailProfileDrawerState {
public boolean errorSpeedDetected = false; // 用户移动滑轮的速度过快
public int errorSpeedDetectedCnt = 0; // 用户移动滑轮的速度过快
// public ZLockList<XYPoint> pulleyPoints = new ZLockList<>(10);
public RefPointFinder pulleyPointsRecordForTangentCalculation = new RefPointFinder(0.01);
public RefPointFinder pulleyPointsRecordForTangentCalculation = new RefPointFinder(0.05);
public RefPointFinder pulleyPointDirectionJudge = new RefPointFinder(0.3); // 滑轮点位方向判断
public ZLockList<XYPoint> leftPulleyRecord = new ZLockList<>(); // 记录滑轮点位

8
app/src/main/java/com/iflytop/profilometer/core/migration/measure/drawer/type/XYPoint.java

@ -44,4 +44,12 @@ public class XYPoint {
}
return false;
}
public void setX(double x) {
this.x = x;
}
public void setY(double y) {
this.y = y;
}
}

3
app/src/main/java/com/iflytop/profilometer/core/migration/type/protocol/TPMIPacket.java

@ -206,6 +206,9 @@ public class TPMIPacket {
return (byte) (rawpacket[P_DATA_LEN_OFF] + FIX_PACKET_LEN);
}
public byte getDataLen() {
return (byte) (rawpacket[P_DATA_LEN_OFF]);
}
public byte getIndex() {
return rawpacket[P_INDEX_OFF];

43
app/src/main/java/com/iflytop/profilometer/core/migration/type/protocol/TPMIPosReport.java

@ -1,30 +1,39 @@
package com.iflytop.profilometer.core.migration.type.protocol;
import androidx.annotation.NonNull;
import cn.hutool.core.lang.Assert;
public class TPMIPosReport extends TPMIPacket {
public TPMIPosReport(byte[] data) {
super(data);
Assert.isTrue(Command.SAMPLE_VAL_REPORT.equals(getCommand()), "Invalid command");
}
public TPMIPosReport(byte[] data) {
super(data);
Assert.isTrue(Command.SAMPLE_VAL_REPORT.equals(getCommand()), "Invalid command");
}
public Integer getPosReportNum() {
return this.getDataLen() / 8;
}
//value:ARM0角度
public Integer getArm1Angle() {
return this.getDataAsInt(0);
}
//value:ARM0角度
public Integer getArm1Angle(Integer off) {
return this.getDataAsInt(off * 2);
}
//value:ARM1角度
public Integer getArm2Angle() {
return this.getDataAsInt(1);
}
//value:ARM1角度
public Integer getArm2Angle(Integer off) {
return this.getDataAsInt(1 + off * 2);
}
@NonNull
public String toString() {
return String.format("ARM0Angle:%d ARM1Angle:%d ", getArm1Angle(), getArm2Angle());
}
StringBuilder sb = new StringBuilder();
sb.append("{");
for (int i = 0; i < getPosReportNum(); i++) {
sb.append("[").append(getArm1Angle(i)).append(",").append(getArm2Angle(i)).append("]");
if (i < getPosReportNum() - 1)
sb.append(", ");
}
sb.append('}');
return sb.toString();
}
}

9
app/src/main/java/com/iflytop/profilometer/model/entity/ProfileRecordPointSet.java

@ -6,6 +6,7 @@ public class ProfileRecordPointSet extends BaseEntity {
private String profileRecordUuid;
private String leftPoints;
private String rightPoints;
private String alignPoints;
public String getProfileRecordUuid() {
return profileRecordUuid;
@ -30,4 +31,12 @@ public class ProfileRecordPointSet extends BaseEntity {
public void setRightPoints(String rightPoints) {
this.rightPoints = rightPoints;
}
public String getAlignPoints() {
return alignPoints;
}
public void setAlignPoints(String alignPoints) {
this.alignPoints = alignPoints;
}
}

15
app/src/main/java/com/iflytop/profilometer/service/RailProfileDrawerService.java

@ -30,7 +30,9 @@ public class RailProfileDrawerService implements RailProfileDrawerListener {
return;
}
if (packet instanceof TPMIPosReport report) {
railProfileDrawer.processRawEncoderData(report.getArm1Angle(), report.getArm2Angle());
for (int i = 0; i < report.getPosReportNum(); i++) {
railProfileDrawer.processRawEncoderData(report.getArm1Angle(i), report.getArm2Angle(i));
}
}
}
@ -80,7 +82,6 @@ public class RailProfileDrawerService implements RailProfileDrawerListener {
*/
@Override
public void onErrorStartRecordProfileSig() {
Log.i("RailProfileDrawerService", "用户启动记录方向错误");
RailProfileMeasureTaskState taskState = SystemService.getInstance().getTaskState();
taskState.setWrongSide(true);
@ -125,11 +126,11 @@ public class RailProfileDrawerService implements RailProfileDrawerListener {
*/
@Override
public void onErrorSpeedDetected() {
Log.i("RailProfileDrawerService", "移动超速,图像可能会发生失真");
Map<String, Object> map = new HashMap<>();
map.put("type", "measure-event");
map.put("data", RailProfileMeasureTaskEvent.SPEED_DETECTED);
WebSocketManager.send(JSONUtil.toJsonStr(map));
// Log.i("RailProfileDrawerService", "移动超速,图像可能会发生失真");
// Map<String, Object> map = new HashMap<>();
// map.put("type", "measure-event");
// map.put("data", RailProfileMeasureTaskEvent.SPEED_DETECTED);
// WebSocketManager.send(JSONUtil.toJsonStr(map));
}
public RailProfileDrawer getRailProfileDrawer() {

Loading…
Cancel
Save