diff --git a/cgv_connector.proto b/cgv_connector.proto index 0a7e924d8551cd82fb9db4123d4aca65c98bb074..6231318bb6cc17c66ec3b71529ed6ca4e825b552 100644 --- a/cgv_connector.proto +++ b/cgv_connector.proto @@ -42,6 +42,19 @@ message Object { ROBOT = 6; COLLABORATION_ZONE = 7; } + enum State { + STATE_UNKNOWN = 0; + + // robot states + STATE_IDLE = 101; + STATE_PICKING = 102; + STATE_PLACING = 103; + STATE_MOVING = 104; + + // object + STATE_STATIONARY = 200; + STATE_PICKED = 201; + } string id = 1; Type type = 2; @@ -49,7 +62,8 @@ message Object { Size size = 4; Orientation orientation = 5; Color color = 6; - bool active = 7; + State state = 7; + string owner = 8; } // the scene is stored within the ROS side and sent to clients diff --git a/cgv_connector_pb2.py b/cgv_connector_pb2.py index 9434e423b4734a1d254103b53af74a141fd6a50c..e2b7ef00ad451dd3337a4ec1138f0cf4dab5fff4 100644 --- a/cgv_connector_pb2.py +++ b/cgv_connector_pb2.py @@ -19,7 +19,7 @@ DESCRIPTOR = _descriptor.FileDescriptor( syntax='proto3', serialized_options=b'\n\030de.tudresden.inf.st.cetiP\001', create_key=_descriptor._internal_create_key, - serialized_pb=b'\n\x13\x63gv_connector.proto\"\x81\x04\n\x06Object\x12\n\n\x02id\x18\x01 \x01(\t\x12\x1a\n\x04type\x18\x02 \x01(\x0e\x32\x0c.Object.Type\x12\x1d\n\x03pos\x18\x03 \x01(\x0b\x32\x10.Object.Position\x12\x1a\n\x04size\x18\x04 \x01(\x0b\x32\x0c.Object.Size\x12(\n\x0borientation\x18\x05 \x01(\x0b\x32\x13.Object.Orientation\x12\x1c\n\x05\x63olor\x18\x06 \x01(\x0b\x32\r.Object.Color\x12\x0e\n\x06\x61\x63tive\x18\x07 \x01(\x08\x1a+\n\x08Position\x12\t\n\x01x\x18\x01 \x01(\x01\x12\t\n\x01y\x18\x02 \x01(\x01\x12\t\n\x01z\x18\x03 \x01(\x01\x1a\x35\n\x04Size\x12\x0e\n\x06length\x18\x01 \x01(\x01\x12\r\n\x05width\x18\x02 \x01(\x01\x12\x0e\n\x06height\x18\x03 \x01(\x01\x1a\x39\n\x0bOrientation\x12\t\n\x01x\x18\x01 \x01(\x01\x12\t\n\x01y\x18\x02 \x01(\x01\x12\t\n\x01z\x18\x03 \x01(\x01\x12\t\n\x01w\x18\x04 \x01(\x01\x1a(\n\x05\x43olor\x12\t\n\x01r\x18\x01 \x01(\x02\x12\t\n\x01g\x18\x02 \x01(\x02\x12\t\n\x01\x62\x18\x03 \x01(\x02\"s\n\x04Type\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x07\n\x03\x42OX\x10\x01\x12\x07\n\x03\x42IN\x10\x02\x12\x07\n\x03\x41RM\x10\x03\x12\x15\n\x11\x44ROP_OFF_LOCATION\x10\x04\x12\t\n\x05HUMAN\x10\x05\x12\t\n\x05ROBOT\x10\x06\x12\x16\n\x12\x43OLLABORATION_ZONE\x10\x07\"!\n\x05Scene\x12\x18\n\x07objects\x18\x01 \x03(\x0b\x32\x07.Object\"\x17\n\tSelection\x12\n\n\x02id\x18\x01 \x01(\t\"}\n\x07\x43ommand\x12%\n\x0cpickAndPlace\x18\x01 \x01(\x0b\x32\r.PickAndPlaceH\x00\x12%\n\x0c\x63onfigChange\x18\x02 \x01(\x0b\x32\r.ConfigChangeH\x00\x12\x1d\n\x08\x65vacuate\x18\x03 \x01(\x0b\x32\t.EvacuateH\x00\x42\x05\n\x03msg\"@\n\x0cPickAndPlace\x12\x0f\n\x07idRobot\x18\x01 \x01(\t\x12\x0e\n\x06idPick\x18\x02 \x01(\t\x12\x0f\n\x07idPlace\x18\x03 \x01(\t\"D\n\x0c\x43onfigChange\x12\x1b\n\x13idCollaborationZone\x18\x01 \x01(\t\x12\x17\n\x0fidRobotNewOwner\x18\x02 \x01(\t\"8\n\x08\x45vacuate\x12\x0f\n\x07idRobot\x18\x01 \x01(\t\x12\x1b\n\x13idCollaborationZone\x18\x02 \x01(\t\"\x8d\x01\n\x0cReachability\x12\x0f\n\x07idRobot\x18\x01 \x01(\t\x12\x31\n\x07objects\x18\x02 \x03(\x0b\x32 .Reachability.ObjectReachability\x1a\x39\n\x12ObjectReachability\x12\x10\n\x08idObject\x18\x01 \x01(\t\x12\x11\n\treachable\x18\x02 \x01(\x08\x42\x1c\n\x18\x64\x65.tudresden.inf.st.cetiP\x01\x62\x06proto3' + serialized_pb=b'\n\x13\x63gv_connector.proto\"\xad\x05\n\x06Object\x12\n\n\x02id\x18\x01 \x01(\t\x12\x1a\n\x04type\x18\x02 \x01(\x0e\x32\x0c.Object.Type\x12\x1d\n\x03pos\x18\x03 \x01(\x0b\x32\x10.Object.Position\x12\x1a\n\x04size\x18\x04 \x01(\x0b\x32\x0c.Object.Size\x12(\n\x0borientation\x18\x05 \x01(\x0b\x32\x13.Object.Orientation\x12\x1c\n\x05\x63olor\x18\x06 \x01(\x0b\x32\r.Object.Color\x12\x1c\n\x05state\x18\x07 \x01(\x0e\x32\r.Object.State\x12\r\n\x05owner\x18\x08 \x01(\t\x1a+\n\x08Position\x12\t\n\x01x\x18\x01 \x01(\x01\x12\t\n\x01y\x18\x02 \x01(\x01\x12\t\n\x01z\x18\x03 \x01(\x01\x1a\x35\n\x04Size\x12\x0e\n\x06length\x18\x01 \x01(\x01\x12\r\n\x05width\x18\x02 \x01(\x01\x12\x0e\n\x06height\x18\x03 \x01(\x01\x1a\x39\n\x0bOrientation\x12\t\n\x01x\x18\x01 \x01(\x01\x12\t\n\x01y\x18\x02 \x01(\x01\x12\t\n\x01z\x18\x03 \x01(\x01\x12\t\n\x01w\x18\x04 \x01(\x01\x1a(\n\x05\x43olor\x12\t\n\x01r\x18\x01 \x01(\x02\x12\t\n\x01g\x18\x02 \x01(\x02\x12\t\n\x01\x62\x18\x03 \x01(\x02\"s\n\x04Type\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x07\n\x03\x42OX\x10\x01\x12\x07\n\x03\x42IN\x10\x02\x12\x07\n\x03\x41RM\x10\x03\x12\x15\n\x11\x44ROP_OFF_LOCATION\x10\x04\x12\t\n\x05HUMAN\x10\x05\x12\t\n\x05ROBOT\x10\x06\x12\x16\n\x12\x43OLLABORATION_ZONE\x10\x07\"\x8c\x01\n\x05State\x12\x11\n\rSTATE_UNKNOWN\x10\x00\x12\x0e\n\nSTATE_IDLE\x10\x65\x12\x11\n\rSTATE_PICKING\x10\x66\x12\x11\n\rSTATE_PLACING\x10g\x12\x10\n\x0cSTATE_MOVING\x10h\x12\x15\n\x10STATE_STATIONARY\x10\xc8\x01\x12\x11\n\x0cSTATE_PICKED\x10\xc9\x01\"!\n\x05Scene\x12\x18\n\x07objects\x18\x01 \x03(\x0b\x32\x07.Object\"\x17\n\tSelection\x12\n\n\x02id\x18\x01 \x01(\t\"}\n\x07\x43ommand\x12%\n\x0cpickAndPlace\x18\x01 \x01(\x0b\x32\r.PickAndPlaceH\x00\x12%\n\x0c\x63onfigChange\x18\x02 \x01(\x0b\x32\r.ConfigChangeH\x00\x12\x1d\n\x08\x65vacuate\x18\x03 \x01(\x0b\x32\t.EvacuateH\x00\x42\x05\n\x03msg\"@\n\x0cPickAndPlace\x12\x0f\n\x07idRobot\x18\x01 \x01(\t\x12\x0e\n\x06idPick\x18\x02 \x01(\t\x12\x0f\n\x07idPlace\x18\x03 \x01(\t\"D\n\x0c\x43onfigChange\x12\x1b\n\x13idCollaborationZone\x18\x01 \x01(\t\x12\x17\n\x0fidRobotNewOwner\x18\x02 \x01(\t\"8\n\x08\x45vacuate\x12\x0f\n\x07idRobot\x18\x01 \x01(\t\x12\x1b\n\x13idCollaborationZone\x18\x02 \x01(\t\"\x8d\x01\n\x0cReachability\x12\x0f\n\x07idRobot\x18\x01 \x01(\t\x12\x31\n\x07objects\x18\x02 \x03(\x0b\x32 .Reachability.ObjectReachability\x1a\x39\n\x12ObjectReachability\x12\x10\n\x08idObject\x18\x01 \x01(\t\x12\x11\n\treachable\x18\x02 \x01(\x08\x42\x1c\n\x18\x64\x65.tudresden.inf.st.cetiP\x01\x62\x06proto3' ) @@ -74,11 +74,61 @@ _OBJECT_TYPE = _descriptor.EnumDescriptor( ], containing_type=None, serialized_options=None, - serialized_start=422, - serialized_end=537, + serialized_start=451, + serialized_end=566, ) _sym_db.RegisterEnumDescriptor(_OBJECT_TYPE) +_OBJECT_STATE = _descriptor.EnumDescriptor( + name='State', + full_name='Object.State', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='STATE_UNKNOWN', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='STATE_IDLE', index=1, number=101, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='STATE_PICKING', index=2, number=102, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='STATE_PLACING', index=3, number=103, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='STATE_MOVING', index=4, number=104, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='STATE_STATIONARY', index=5, number=200, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='STATE_PICKED', index=6, number=201, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=569, + serialized_end=709, +) +_sym_db.RegisterEnumDescriptor(_OBJECT_STATE) + _OBJECT_POSITION = _descriptor.Descriptor( name='Position', @@ -121,8 +171,8 @@ _OBJECT_POSITION = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=221, - serialized_end=264, + serialized_start=250, + serialized_end=293, ) _OBJECT_SIZE = _descriptor.Descriptor( @@ -166,8 +216,8 @@ _OBJECT_SIZE = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=266, - serialized_end=319, + serialized_start=295, + serialized_end=348, ) _OBJECT_ORIENTATION = _descriptor.Descriptor( @@ -218,8 +268,8 @@ _OBJECT_ORIENTATION = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=321, - serialized_end=378, + serialized_start=350, + serialized_end=407, ) _OBJECT_COLOR = _descriptor.Descriptor( @@ -263,8 +313,8 @@ _OBJECT_COLOR = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=380, - serialized_end=420, + serialized_start=409, + serialized_end=449, ) _OBJECT = _descriptor.Descriptor( @@ -318,9 +368,16 @@ _OBJECT = _descriptor.Descriptor( is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor( - name='active', full_name='Object.active', index=6, - number=7, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, + name='state', full_name='Object.state', index=6, + number=7, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='owner', full_name='Object.owner', index=7, + number=8, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), @@ -330,6 +387,7 @@ _OBJECT = _descriptor.Descriptor( nested_types=[_OBJECT_POSITION, _OBJECT_SIZE, _OBJECT_ORIENTATION, _OBJECT_COLOR, ], enum_types=[ _OBJECT_TYPE, + _OBJECT_STATE, ], serialized_options=None, is_extendable=False, @@ -338,7 +396,7 @@ _OBJECT = _descriptor.Descriptor( oneofs=[ ], serialized_start=24, - serialized_end=537, + serialized_end=709, ) @@ -369,8 +427,8 @@ _SCENE = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=539, - serialized_end=572, + serialized_start=711, + serialized_end=744, ) @@ -401,8 +459,8 @@ _SELECTION = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=574, - serialized_end=597, + serialized_start=746, + serialized_end=769, ) @@ -452,8 +510,8 @@ _COMMAND = _descriptor.Descriptor( create_key=_descriptor._internal_create_key, fields=[]), ], - serialized_start=599, - serialized_end=724, + serialized_start=771, + serialized_end=896, ) @@ -498,8 +556,8 @@ _PICKANDPLACE = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=726, - serialized_end=790, + serialized_start=898, + serialized_end=962, ) @@ -537,8 +595,8 @@ _CONFIGCHANGE = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=792, - serialized_end=860, + serialized_start=964, + serialized_end=1032, ) @@ -576,8 +634,8 @@ _EVACUATE = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=862, - serialized_end=918, + serialized_start=1034, + serialized_end=1090, ) @@ -615,8 +673,8 @@ _REACHABILITY_OBJECTREACHABILITY = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=1005, - serialized_end=1062, + serialized_start=1177, + serialized_end=1234, ) _REACHABILITY = _descriptor.Descriptor( @@ -653,8 +711,8 @@ _REACHABILITY = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=921, - serialized_end=1062, + serialized_start=1093, + serialized_end=1234, ) _OBJECT_POSITION.containing_type = _OBJECT @@ -666,7 +724,9 @@ _OBJECT.fields_by_name['pos'].message_type = _OBJECT_POSITION _OBJECT.fields_by_name['size'].message_type = _OBJECT_SIZE _OBJECT.fields_by_name['orientation'].message_type = _OBJECT_ORIENTATION _OBJECT.fields_by_name['color'].message_type = _OBJECT_COLOR +_OBJECT.fields_by_name['state'].enum_type = _OBJECT_STATE _OBJECT_TYPE.containing_type = _OBJECT +_OBJECT_STATE.containing_type = _OBJECT _SCENE.fields_by_name['objects'].message_type = _OBJECT _COMMAND.fields_by_name['pickAndPlace'].message_type = _PICKANDPLACE _COMMAND.fields_by_name['configChange'].message_type = _CONFIGCHANGE diff --git a/utils.py b/utils.py index 271200a0deda43e37fd7c69d45ac3f759585bc9c..d758ac2f0410916899dcaa7fee6d708a58516e7d 100644 --- a/utils.py +++ b/utils.py @@ -51,7 +51,7 @@ def format_scene(scene: cgv_connector_pb2.Scene): for obj in scene.objects: if obj.type != cgv_connector_pb2.Object.Type.DROP_OFF_LOCATION and obj.type != cgv_connector_pb2.Object.Type.UNKNOWN: pos = obj.pos - result += f"\n<{cgv_connector_pb2.Object.Type.Name(obj.type):20} {obj.id:15} at ({pos.x:6.2} {pos.y:6.2} {pos.z:6.2}) {obj.active}>" + result += f"\n<{cgv_connector_pb2.Object.Type.Name(obj.type):20} {obj.id:15} at ({pos.x:6.2} {pos.y:6.2} {pos.z:6.2}) {obj.state}>" # result += str(obj) # result = scene return result