From 4ee6f05b62ffe82f5d8e79ae85dbf3855fd2f229 Mon Sep 17 00:00:00 2001 From: thesai <1021828630@qq.com> Date: Sun, 18 Feb 2024 10:06:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=BB=91=E5=8A=A8=E9=97=A8=E5=A2=9E=E5=8A=A0{?= =?UTF-8?q?=E6=9C=89=E9=9A=9C=E7=A2=8D=E7=89=A9}=E7=8A=B6=E6=80=81?= =?UTF-8?q?=EF=BC=9B=E5=B1=8F=E8=94=BD=E9=97=A8{=E6=9C=89=E9=9A=9C?= =?UTF-8?q?=E7=A2=8D=E7=89=A9}=E5=AD=97=E6=AE=B5=E5=90=8D=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- component/component_proto/psd.pb.go | 19 ++++++++++++++----- proto/src/component/psd.proto | 1 + sys/device_sys/asd.go | 6 ++++++ 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/component/component_proto/psd.pb.go b/component/component_proto/psd.pb.go index 21dc2e6..9fd808f 100644 --- a/component/component_proto/psd.pb.go +++ b/component/component_proto/psd.pb.go @@ -170,6 +170,7 @@ type AsdState struct { Gmdw bool `protobuf:"varint,1,opt,name=gmdw,proto3" json:"gmdw,omitempty"` //关门到位(实际位置) Kmdw bool `protobuf:"varint,2,opt,name=kmdw,proto3" json:"kmdw,omitempty"` //开门到位(实际位置) Mgj bool `protobuf:"varint,3,opt,name=mgj,proto3" json:"mgj,omitempty"` //门关继电器 + Zaw bool `protobuf:"varint,4,opt,name=zaw,proto3" json:"zaw,omitempty"` //有障碍物 } func (x *AsdState) Reset() { @@ -225,6 +226,13 @@ func (x *AsdState) GetMgj() bool { return false } +func (x *AsdState) GetZaw() bool { + if x != nil { + return x.Zaw + } + return false +} + var File_component_psd_proto protoreflect.FileDescriptor var file_component_psd_proto_rawDesc = []byte{ @@ -238,14 +246,15 @@ var file_component_psd_proto_rawDesc = []byte{ 0x0a, 0x09, 0x55, 0x6e, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x41, 0x73, 0x64, 0x43, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x41, 0x73, 0x64, 0x43, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x4f, 0x70, - 0x65, 0x6e, 0x10, 0x02, 0x22, 0x44, 0x0a, 0x08, 0x41, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, + 0x65, 0x6e, 0x10, 0x02, 0x22, 0x56, 0x0a, 0x08, 0x41, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x67, 0x6d, 0x64, 0x77, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x67, 0x6d, 0x64, 0x77, 0x12, 0x12, 0x0a, 0x04, 0x6b, 0x6d, 0x64, 0x77, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x6b, 0x6d, 0x64, 0x77, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x67, 0x6a, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x6d, 0x67, 0x6a, 0x42, 0x1d, 0x5a, 0x1b, 0x2e, 0x2f, - 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, - 0x65, 0x6e, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x6d, 0x67, 0x6a, 0x12, 0x10, 0x0a, 0x03, 0x7a, 0x61, + 0x77, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x7a, 0x61, 0x77, 0x42, 0x1d, 0x5a, 0x1b, + 0x2e, 0x2f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2f, 0x63, 0x6f, 0x6d, 0x70, + 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( diff --git a/proto/src/component/psd.proto b/proto/src/component/psd.proto index ce4bb1f..4c4a519 100644 --- a/proto/src/component/psd.proto +++ b/proto/src/component/psd.proto @@ -22,4 +22,5 @@ message AsdState { bool kmdw = 2; //开门到位(实际位置) bool mgj = 3; //门关继电器 + bool zaw = 4; //有障碍物 } \ No newline at end of file diff --git a/sys/device_sys/asd.go b/sys/device_sys/asd.go index f0ec2a4..b99e31f 100644 --- a/sys/device_sys/asd.go +++ b/sys/device_sys/asd.go @@ -69,5 +69,11 @@ func (s *AsdSys) Update(world ecs.World) { asdState.Kmdw = false asdState.Gmdw = false } + //障碍物 + if entry.HasComponent(component.AsdHasObstacleTag) { + asdState.Zaw = true + } else { + asdState.Zaw = false + } }) }