00001 """autogenerated by genmsg_py from TopologicalGraph.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005 import geometry_msgs.msg
00006 import topological_nav_msgs.msg
00007
00008 class TopologicalGraph(roslib.message.Message):
00009 _md5sum = "a0ab3936a4c52a67e3590fae99c61eb4"
00010 _type = "topological_nav_msgs/TopologicalGraph"
00011 _has_header = False
00012 _full_text = """# A 2d topological map consists of a set of local occupancy grids together with
00013 # the transformations between coordinate frames of overlapping grids. This ROS
00014 # message represents the structure of the topological map, i.e., all the
00015 # information except the grids themselves. You can get individual grids by
00016 # calling the GetLocalGrid service on the mapper.
00017
00018 TopologicalMapNode[] nodes
00019 TopologicalMapEdge[] edges
00020 ================================================================================
00021 MSG: topological_nav_msgs/TopologicalMapNode
00022 # Info stored with a node in a 2d topological map
00023
00024 # Id of this node in the topological map
00025 uint32 id
00026
00027 # Dimensions of local grid. The local grid covers the rectangle between
00028 # (0,0) and (x_size, y_size) in the grid's frame
00029 float32 x_size
00030 float32 y_size
00031
00032 # Resolution of the local occupancy grid
00033 float32 resolution
00034
00035
00036 ================================================================================
00037 MSG: topological_nav_msgs/TopologicalMapEdge
00038 # Info stored with an edge in 2d topological map
00039
00040 # Id of this edge in the topological map
00041 uint32 id
00042
00043 # Id of the source node
00044 uint32 src
00045
00046 # Id of the destination node
00047 uint32 dest
00048
00049 # Pose of origin of destination node's coordinate frame
00050 # represented in the source node's coordinate frame
00051 geometry_msgs/Pose offset
00052
00053 ================================================================================
00054 MSG: geometry_msgs/Pose
00055 # A representation of pose in free space, composed of postion and orientation.
00056 Point position
00057 Quaternion orientation
00058
00059 ================================================================================
00060 MSG: geometry_msgs/Point
00061 # This contains the position of a point in free space
00062 float64 x
00063 float64 y
00064 float64 z
00065
00066 ================================================================================
00067 MSG: geometry_msgs/Quaternion
00068 # This represents an orientation in free space in quaternion form.
00069
00070 float64 x
00071 float64 y
00072 float64 z
00073 float64 w
00074
00075 """
00076 __slots__ = ['nodes','edges']
00077 _slot_types = ['topological_nav_msgs/TopologicalMapNode[]','topological_nav_msgs/TopologicalMapEdge[]']
00078
00079 def __init__(self, *args, **kwds):
00080 """
00081 Constructor. Any message fields that are implicitly/explicitly
00082 set to None will be assigned a default value. The recommend
00083 use is keyword arguments as this is more robust to future message
00084 changes. You cannot mix in-order arguments and keyword arguments.
00085
00086 The available fields are:
00087 nodes,edges
00088
00089 @param args: complete set of field values, in .msg order
00090 @param kwds: use keyword arguments corresponding to message field names
00091 to set specific fields.
00092 """
00093 if args or kwds:
00094 super(TopologicalGraph, self).__init__(*args, **kwds)
00095
00096 if self.nodes is None:
00097 self.nodes = []
00098 if self.edges is None:
00099 self.edges = []
00100 else:
00101 self.nodes = []
00102 self.edges = []
00103
00104 def _get_types(self):
00105 """
00106 internal API method
00107 """
00108 return self._slot_types
00109
00110 def serialize(self, buff):
00111 """
00112 serialize message into buffer
00113 @param buff: buffer
00114 @type buff: StringIO
00115 """
00116 try:
00117 length = len(self.nodes)
00118 buff.write(_struct_I.pack(length))
00119 for val1 in self.nodes:
00120 _x = val1
00121 buff.write(_struct_I3f.pack(_x.id, _x.x_size, _x.y_size, _x.resolution))
00122 length = len(self.edges)
00123 buff.write(_struct_I.pack(length))
00124 for val1 in self.edges:
00125 _x = val1
00126 buff.write(_struct_3I.pack(_x.id, _x.src, _x.dest))
00127 _v1 = val1.offset
00128 _v2 = _v1.position
00129 _x = _v2
00130 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00131 _v3 = _v1.orientation
00132 _x = _v3
00133 buff.write(_struct_4d.pack(_x.x, _x.y, _x.z, _x.w))
00134 except struct.error, se: self._check_types(se)
00135 except TypeError, te: self._check_types(te)
00136
00137 def deserialize(self, str):
00138 """
00139 unpack serialized message in str into this message instance
00140 @param str: byte array of serialized message
00141 @type str: str
00142 """
00143 try:
00144 end = 0
00145 start = end
00146 end += 4
00147 (length,) = _struct_I.unpack(str[start:end])
00148 self.nodes = []
00149 for i in xrange(0, length):
00150 val1 = topological_nav_msgs.msg.TopologicalMapNode()
00151 _x = val1
00152 start = end
00153 end += 16
00154 (_x.id, _x.x_size, _x.y_size, _x.resolution,) = _struct_I3f.unpack(str[start:end])
00155 self.nodes.append(val1)
00156 start = end
00157 end += 4
00158 (length,) = _struct_I.unpack(str[start:end])
00159 self.edges = []
00160 for i in xrange(0, length):
00161 val1 = topological_nav_msgs.msg.TopologicalMapEdge()
00162 _x = val1
00163 start = end
00164 end += 12
00165 (_x.id, _x.src, _x.dest,) = _struct_3I.unpack(str[start:end])
00166 _v4 = val1.offset
00167 _v5 = _v4.position
00168 _x = _v5
00169 start = end
00170 end += 24
00171 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00172 _v6 = _v4.orientation
00173 _x = _v6
00174 start = end
00175 end += 32
00176 (_x.x, _x.y, _x.z, _x.w,) = _struct_4d.unpack(str[start:end])
00177 self.edges.append(val1)
00178 return self
00179 except struct.error, e:
00180 raise roslib.message.DeserializationError(e)
00181
00182
00183 def serialize_numpy(self, buff, numpy):
00184 """
00185 serialize message with numpy array types into buffer
00186 @param buff: buffer
00187 @type buff: StringIO
00188 @param numpy: numpy python module
00189 @type numpy module
00190 """
00191 try:
00192 length = len(self.nodes)
00193 buff.write(_struct_I.pack(length))
00194 for val1 in self.nodes:
00195 _x = val1
00196 buff.write(_struct_I3f.pack(_x.id, _x.x_size, _x.y_size, _x.resolution))
00197 length = len(self.edges)
00198 buff.write(_struct_I.pack(length))
00199 for val1 in self.edges:
00200 _x = val1
00201 buff.write(_struct_3I.pack(_x.id, _x.src, _x.dest))
00202 _v7 = val1.offset
00203 _v8 = _v7.position
00204 _x = _v8
00205 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00206 _v9 = _v7.orientation
00207 _x = _v9
00208 buff.write(_struct_4d.pack(_x.x, _x.y, _x.z, _x.w))
00209 except struct.error, se: self._check_types(se)
00210 except TypeError, te: self._check_types(te)
00211
00212 def deserialize_numpy(self, str, numpy):
00213 """
00214 unpack serialized message in str into this message instance using numpy for array types
00215 @param str: byte array of serialized message
00216 @type str: str
00217 @param numpy: numpy python module
00218 @type numpy: module
00219 """
00220 try:
00221 end = 0
00222 start = end
00223 end += 4
00224 (length,) = _struct_I.unpack(str[start:end])
00225 self.nodes = []
00226 for i in xrange(0, length):
00227 val1 = topological_nav_msgs.msg.TopologicalMapNode()
00228 _x = val1
00229 start = end
00230 end += 16
00231 (_x.id, _x.x_size, _x.y_size, _x.resolution,) = _struct_I3f.unpack(str[start:end])
00232 self.nodes.append(val1)
00233 start = end
00234 end += 4
00235 (length,) = _struct_I.unpack(str[start:end])
00236 self.edges = []
00237 for i in xrange(0, length):
00238 val1 = topological_nav_msgs.msg.TopologicalMapEdge()
00239 _x = val1
00240 start = end
00241 end += 12
00242 (_x.id, _x.src, _x.dest,) = _struct_3I.unpack(str[start:end])
00243 _v10 = val1.offset
00244 _v11 = _v10.position
00245 _x = _v11
00246 start = end
00247 end += 24
00248 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00249 _v12 = _v10.orientation
00250 _x = _v12
00251 start = end
00252 end += 32
00253 (_x.x, _x.y, _x.z, _x.w,) = _struct_4d.unpack(str[start:end])
00254 self.edges.append(val1)
00255 return self
00256 except struct.error, e:
00257 raise roslib.message.DeserializationError(e)
00258
00259 _struct_I = roslib.message.struct_I
00260 _struct_4d = struct.Struct("<4d")
00261 _struct_3I = struct.Struct("<3I")
00262 _struct_I3f = struct.Struct("<I3f")
00263 _struct_3d = struct.Struct("<3d")