diff --git a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Protobuf/PSource/bsp_IV.pb.h b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Protobuf/PSource/bsp_IV.pb.h
index 19a5a37..f9f6b60 100644
--- a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Protobuf/PSource/bsp_IV.pb.h
+++ b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Protobuf/PSource/bsp_IV.pb.h
@@ -19,6 +19,7 @@ typedef struct _IV_struct_define {
int32_t laser_sensor_3_measure_distance;
int32_t kinfe_complete_signal;
int32_t kinfe_position;
+ int32_t max_laser_sensor;
} IV_struct_define;
@@ -27,8 +28,8 @@ extern "C" {
#endif
/* Initializer values for message structs */
-#define IV_struct_define_init_default {0, 0, 0, 0, 0, 0, 0, 0}
-#define IV_struct_define_init_zero {0, 0, 0, 0, 0, 0, 0, 0}
+#define IV_struct_define_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0}
+#define IV_struct_define_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0}
/* Field tags (for use in manual encoding/decoding) */
#define IV_struct_define_Robot_Move_Speed_tag 1
@@ -39,6 +40,7 @@ extern "C" {
#define IV_struct_define_laser_sensor_3_measure_distance_tag 6
#define IV_struct_define_kinfe_complete_signal_tag 7
#define IV_struct_define_kinfe_position_tag 8
+#define IV_struct_define_max_laser_sensor_tag 9
/* Struct field encoding specification for nanopb */
#define IV_struct_define_FIELDLIST(X, a) \
@@ -49,7 +51,8 @@ X(a, STATIC, SINGULAR, INT32, laser_sensor_1_measure_distance, 4) \
X(a, STATIC, SINGULAR, INT32, laser_sensor_2_measure_distance, 5) \
X(a, STATIC, SINGULAR, INT32, laser_sensor_3_measure_distance, 6) \
X(a, STATIC, SINGULAR, INT32, kinfe_complete_signal, 7) \
-X(a, STATIC, SINGULAR, INT32, kinfe_position, 8)
+X(a, STATIC, SINGULAR, INT32, kinfe_position, 8) \
+X(a, STATIC, SINGULAR, INT32, max_laser_sensor, 9)
#define IV_struct_define_CALLBACK NULL
#define IV_struct_define_DEFAULT NULL
@@ -60,7 +63,7 @@ extern const pb_msgdesc_t IV_struct_define_msg;
/* Maximum encoded size of messages (where known) */
#define BSP_IV_PB_H_MAX_SIZE IV_struct_define_size
-#define IV_struct_define_size 86
+#define IV_struct_define_size 97
#ifdef __cplusplus
} /* extern "C" */
diff --git a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Protobuf/Proto/bsp_IV.proto b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Protobuf/Proto/bsp_IV.proto
index ff58af4..a9b3b82 100644
--- a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Protobuf/Proto/bsp_IV.proto
+++ b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Protobuf/Proto/bsp_IV.proto
@@ -13,5 +13,5 @@ message IV_struct_define{
int32 laser_sensor_3_measure_distance = 6;
int32 kinfe_complete_signal = 7;
int32 kinfe_position = 8;
-
+ int32 max_laser_sensor = 9;
};
diff --git a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/FSM.c b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/FSM.c
index cc2ba46..968859d 100644
--- a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/FSM.c
+++ b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/FSM.c
@@ -192,9 +192,9 @@ void Automatic_Laser_Scanning()
int32_t b = GV.ZHR29_200_measure_results.laser_sensor_2_measure_distance;
int32_t c = GV.ZHR29_200_measure_results.laser_sensor_3_measure_distance;
- int32_t max = (a > b) ? ((a > c) ? a : c) : ((b > c) ? b : c);
+ int32_t max = (a < b) ? ((a < c) ? a : c) : ((b < c) ? b : c);
- MaxLaserSensor = (max > MaxLaserSensor) ? max : MaxLaserSensor; // 取出激光雷达最大值
+ MaxLaserSensor = (max < MaxLaserSensor) ? max : MaxLaserSensor;
#if 0
if (RISE_KINFE_STATE == ScanState)
@@ -525,6 +525,7 @@ void IV_Control()
IV.laser_sensor_3_measure_distance = GV.ZHR29_200_measure_results.laser_sensor_3_measure_distance;
IV.kinfe_complete_signal = IsAllowRotation;
IV.kinfe_position = (KinfePosition == 1000) ? KinfePosition : (GV.LS_FrontEnd_Motor.Real_Position - KinfePosition);// 这里上传的是原始数据,需要APP上缩小20000倍
+ IV.max_laser_sensor = MaxLaserSensor;
}
void Robot_Control()
diff --git a/diaoerqiege/diaoerqige_V1.0/app/src/main/java/bsp_IV.proto b/diaoerqiege/diaoerqige_V1.0/app/src/main/java/bsp_IV.proto
index 140f4c7..7e5f609 100644
--- a/diaoerqiege/diaoerqige_V1.0/app/src/main/java/bsp_IV.proto
+++ b/diaoerqiege/diaoerqige_V1.0/app/src/main/java/bsp_IV.proto
@@ -13,4 +13,5 @@ message IV_struct_define
int32 laser_sensor_3_measure_distance = 6;
int32 kinfe_complete_signal = 7;
int32 kinfe_position = 8;
+ int32 max_laser_sensor = 9;
};
diff --git a/diaoerqiege/diaoerqige_V1.0/app/src/main/java/com/example/diaoerqiegeapp/models/BspIV.java b/diaoerqiege/diaoerqige_V1.0/app/src/main/java/com/example/diaoerqiegeapp/models/BspIV.java
index a93ee56..14e7275 100644
--- a/diaoerqiege/diaoerqige_V1.0/app/src/main/java/com/example/diaoerqiegeapp/models/BspIV.java
+++ b/diaoerqiege/diaoerqige_V1.0/app/src/main/java/com/example/diaoerqiegeapp/models/BspIV.java
@@ -76,6 +76,12 @@ public final class BspIV {
* @return The kinfePosition.
*/
int getKinfePosition();
+
+ /**
+ * int32 max_laser_sensor = 9;
+ * @return The maxLaserSensor.
+ */
+ int getMaxLaserSensor();
}
/**
* Protobuf type {@code IV_struct_define}
@@ -202,6 +208,17 @@ public final class BspIV {
return kinfePosition_;
}
+ public static final int MAX_LASER_SENSOR_FIELD_NUMBER = 9;
+ private int maxLaserSensor_ = 0;
+ /**
+ * int32 max_laser_sensor = 9;
+ * @return The maxLaserSensor.
+ */
+ @java.lang.Override
+ public int getMaxLaserSensor() {
+ return maxLaserSensor_;
+ }
+
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
@@ -240,6 +257,9 @@ public final class BspIV {
if (kinfePosition_ != 0) {
output.writeInt32(8, kinfePosition_);
}
+ if (maxLaserSensor_ != 0) {
+ output.writeInt32(9, maxLaserSensor_);
+ }
getUnknownFields().writeTo(output);
}
@@ -281,6 +301,10 @@ public final class BspIV {
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(8, kinfePosition_);
}
+ if (maxLaserSensor_ != 0) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeInt32Size(9, maxLaserSensor_);
+ }
size += getUnknownFields().getSerializedSize();
memoizedSize = size;
return size;
@@ -313,6 +337,8 @@ public final class BspIV {
!= other.getKinfeCompleteSignal()) return false;
if (getKinfePosition()
!= other.getKinfePosition()) return false;
+ if (getMaxLaserSensor()
+ != other.getMaxLaserSensor()) return false;
if (!getUnknownFields().equals(other.getUnknownFields())) return false;
return true;
}
@@ -341,6 +367,8 @@ public final class BspIV {
hash = (53 * hash) + getKinfeCompleteSignal();
hash = (37 * hash) + KINFE_POSITION_FIELD_NUMBER;
hash = (53 * hash) + getKinfePosition();
+ hash = (37 * hash) + MAX_LASER_SENSOR_FIELD_NUMBER;
+ hash = (53 * hash) + getMaxLaserSensor();
hash = (29 * hash) + getUnknownFields().hashCode();
memoizedHashCode = hash;
return hash;
@@ -480,6 +508,7 @@ public final class BspIV {
laserSensor3MeasureDistance_ = 0;
kinfeCompleteSignal_ = 0;
kinfePosition_ = 0;
+ maxLaserSensor_ = 0;
return this;
}
@@ -537,6 +566,9 @@ public final class BspIV {
if (((from_bitField0_ & 0x00000080) != 0)) {
result.kinfePosition_ = kinfePosition_;
}
+ if (((from_bitField0_ & 0x00000100) != 0)) {
+ result.maxLaserSensor_ = maxLaserSensor_;
+ }
}
@java.lang.Override
@@ -575,6 +607,9 @@ public final class BspIV {
if (other.getKinfePosition() != 0) {
setKinfePosition(other.getKinfePosition());
}
+ if (other.getMaxLaserSensor() != 0) {
+ setMaxLaserSensor(other.getMaxLaserSensor());
+ }
this.mergeUnknownFields(other.getUnknownFields());
onChanged();
return this;
@@ -641,6 +676,11 @@ public final class BspIV {
bitField0_ |= 0x00000080;
break;
} // case 64
+ case 72: {
+ maxLaserSensor_ = input.readInt32();
+ bitField0_ |= 0x00000100;
+ break;
+ } // case 72
default: {
if (!super.parseUnknownField(input, extensionRegistry, tag)) {
done = true; // was an endgroup tag
@@ -914,6 +954,38 @@ public final class BspIV {
return this;
}
+ private int maxLaserSensor_ ;
+ /**
+ * int32 max_laser_sensor = 9;
+ * @return The maxLaserSensor.
+ */
+ @java.lang.Override
+ public int getMaxLaserSensor() {
+ return maxLaserSensor_;
+ }
+ /**
+ * int32 max_laser_sensor = 9;
+ * @param value The maxLaserSensor to set.
+ * @return This builder for chaining.
+ */
+ public Builder setMaxLaserSensor(int value) {
+
+ maxLaserSensor_ = value;
+ bitField0_ |= 0x00000100;
+ onChanged();
+ return this;
+ }
+ /**
+ * int32 max_laser_sensor = 9;
+ * @return This builder for chaining.
+ */
+ public Builder clearMaxLaserSensor() {
+ bitField0_ = (bitField0_ & ~0x00000100);
+ maxLaserSensor_ = 0;
+ onChanged();
+ return this;
+ }
+
// @@protoc_insertion_point(builder_scope:IV_struct_define)
}
@@ -979,15 +1051,15 @@ public final class BspIV {
descriptor;
static {
java.lang.String[] descriptorData = {
- "\n\014bsp_IV.proto\"\214\002\n\020IV_struct_define\022\030\n\020R" +
+ "\n\014bsp_IV.proto\"\246\002\n\020IV_struct_define\022\030\n\020R" +
"obot_Move_Speed\030\001 \001(\001\022\025\n\rRF_Angle_Roll\030\002" +
" \001(\005\022\025\n\rRemote_Status\030\003 \001(\005\022\'\n\037laser_sen" +
"sor_1_measure_distance\030\004 \001(\005\022\'\n\037laser_se" +
"nsor_2_measure_distance\030\005 \001(\005\022\'\n\037laser_s" +
"ensor_3_measure_distance\030\006 \001(\005\022\035\n\025kinfe_" +
"complete_signal\030\007 \001(\005\022\026\n\016kinfe_position\030" +
- "\010 \001(\005B%\n!com.example.diaoerqiegeapp.mode" +
- "lsP\000b\006proto3"
+ "\010 \001(\005\022\030\n\020max_laser_sensor\030\t \001(\005B%\n!com.e" +
+ "xample.diaoerqiegeapp.modelsP\000b\006proto3"
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
@@ -998,7 +1070,7 @@ public final class BspIV {
internal_static_IV_struct_define_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_IV_struct_define_descriptor,
- new java.lang.String[] { "RobotMoveSpeed", "RFAngleRoll", "RemoteStatus", "LaserSensor1MeasureDistance", "LaserSensor2MeasureDistance", "LaserSensor3MeasureDistance", "KinfeCompleteSignal", "KinfePosition", });
+ new java.lang.String[] { "RobotMoveSpeed", "RFAngleRoll", "RemoteStatus", "LaserSensor1MeasureDistance", "LaserSensor2MeasureDistance", "LaserSensor3MeasureDistance", "KinfeCompleteSignal", "KinfePosition", "MaxLaserSensor", });
descriptor.resolveAllFeaturesImmutable();
}
diff --git a/diaoerqiege/diaoerqige_V1.0/app/src/main/java/com/example/diaoerqiegeapp/services/USBSerialPortHelper.java b/diaoerqiege/diaoerqige_V1.0/app/src/main/java/com/example/diaoerqiegeapp/services/USBSerialPortHelper.java
index 79b26d5..c43991f 100644
--- a/diaoerqiege/diaoerqige_V1.0/app/src/main/java/com/example/diaoerqiegeapp/services/USBSerialPortHelper.java
+++ b/diaoerqiege/diaoerqige_V1.0/app/src/main/java/com/example/diaoerqiegeapp/services/USBSerialPortHelper.java
@@ -366,6 +366,15 @@ public class USBSerialPortHelper implements SerialInputOutputManager.Listener {
{
activityPolish.mainBinding.kinfePosition.setText(String.format("%.2f", (double)_toReceiveIV1.getKinfePosition() / 20000));
}
+
+ if (_toReceiveIV1.getMaxLaserSensor() == -255)
+ {
+ activityPolish.mainBinding.maxLaserSensor.setText("未扫描");
+ }
+ else
+ {
+ activityPolish.mainBinding.maxLaserSensor.setText((String.format("%.1f", _toReceiveIV1.getMaxLaserSensor() / 100.0)));
+ }
}
}
diff --git a/diaoerqiege/diaoerqige_V1.0/app/src/main/res/layout/activity_polish.xml b/diaoerqiege/diaoerqige_V1.0/app/src/main/res/layout/activity_polish.xml
index e48994e..7d58d4d 100644
--- a/diaoerqiege/diaoerqige_V1.0/app/src/main/res/layout/activity_polish.xml
+++ b/diaoerqiege/diaoerqige_V1.0/app/src/main/res/layout/activity_polish.xml
@@ -314,6 +314,47 @@
android:textSize="10dp" />
+
+
+
+
+
+
+
+
+
+
diff --git a/diaoerqiege/diaoerqige_V1.0/app/src/main/res/values/strings.xml b/diaoerqiege/diaoerqige_V1.0/app/src/main/res/values/strings.xml
index 89f2de4..684659f 100644
--- a/diaoerqiege/diaoerqige_V1.0/app/src/main/res/values/strings.xml
+++ b/diaoerqiege/diaoerqige_V1.0/app/src/main/res/values/strings.xml
@@ -13,6 +13,7 @@
下降\n高度
车体\n速度
刀具\n位置
+ 扫描\n极值\n
夹刀\n信号
右侧\n补偿