_Triangles.py
Go to the documentation of this file.
00001 """autogenerated by genpy from rve_msgs/Triangles.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006 
00007 import rve_msgs.msg
00008 import std_msgs.msg
00009 
00010 class Triangles(genpy.Message):
00011   _md5sum = "0c8c3d6d2bcb1918c4431ebfd0edcb2c"
00012   _type = "rve_msgs/Triangles"
00013   _has_header = False #flag to mark the presence of a Header object
00014   _full_text = """Vector3[] positions
00015 Vector3[] normals
00016 std_msgs/ColorRGBA[] colors
00017 ================================================================================
00018 MSG: rve_msgs/Vector3
00019 float32 x
00020 float32 y
00021 float32 z
00022 
00023 ================================================================================
00024 MSG: std_msgs/ColorRGBA
00025 float32 r
00026 float32 g
00027 float32 b
00028 float32 a
00029 
00030 """
00031   __slots__ = ['positions','normals','colors']
00032   _slot_types = ['rve_msgs/Vector3[]','rve_msgs/Vector3[]','std_msgs/ColorRGBA[]']
00033 
00034   def __init__(self, *args, **kwds):
00035     """
00036     Constructor. Any message fields that are implicitly/explicitly
00037     set to None will be assigned a default value. The recommend
00038     use is keyword arguments as this is more robust to future message
00039     changes.  You cannot mix in-order arguments and keyword arguments.
00040 
00041     The available fields are:
00042        positions,normals,colors
00043 
00044     :param args: complete set of field values, in .msg order
00045     :param kwds: use keyword arguments corresponding to message field names
00046     to set specific fields.
00047     """
00048     if args or kwds:
00049       super(Triangles, self).__init__(*args, **kwds)
00050       #message fields cannot be None, assign default values for those that are
00051       if self.positions is None:
00052         self.positions = []
00053       if self.normals is None:
00054         self.normals = []
00055       if self.colors is None:
00056         self.colors = []
00057     else:
00058       self.positions = []
00059       self.normals = []
00060       self.colors = []
00061 
00062   def _get_types(self):
00063     """
00064     internal API method
00065     """
00066     return self._slot_types
00067 
00068   def serialize(self, buff):
00069     """
00070     serialize message into buffer
00071     :param buff: buffer, ``StringIO``
00072     """
00073     try:
00074       length = len(self.positions)
00075       buff.write(_struct_I.pack(length))
00076       for val1 in self.positions:
00077         _x = val1
00078         buff.write(_struct_3f.pack(_x.x, _x.y, _x.z))
00079       length = len(self.normals)
00080       buff.write(_struct_I.pack(length))
00081       for val1 in self.normals:
00082         _x = val1
00083         buff.write(_struct_3f.pack(_x.x, _x.y, _x.z))
00084       length = len(self.colors)
00085       buff.write(_struct_I.pack(length))
00086       for val1 in self.colors:
00087         _x = val1
00088         buff.write(_struct_4f.pack(_x.r, _x.g, _x.b, _x.a))
00089     except struct.error as se: self._check_types(se)
00090     except TypeError as te: self._check_types(te)
00091 
00092   def deserialize(self, str):
00093     """
00094     unpack serialized message in str into this message instance
00095     :param str: byte array of serialized message, ``str``
00096     """
00097     try:
00098       if self.positions is None:
00099         self.positions = None
00100       if self.normals is None:
00101         self.normals = None
00102       if self.colors is None:
00103         self.colors = None
00104       end = 0
00105       start = end
00106       end += 4
00107       (length,) = _struct_I.unpack(str[start:end])
00108       self.positions = []
00109       for i in range(0, length):
00110         val1 = rve_msgs.msg.Vector3()
00111         _x = val1
00112         start = end
00113         end += 12
00114         (_x.x, _x.y, _x.z,) = _struct_3f.unpack(str[start:end])
00115         self.positions.append(val1)
00116       start = end
00117       end += 4
00118       (length,) = _struct_I.unpack(str[start:end])
00119       self.normals = []
00120       for i in range(0, length):
00121         val1 = rve_msgs.msg.Vector3()
00122         _x = val1
00123         start = end
00124         end += 12
00125         (_x.x, _x.y, _x.z,) = _struct_3f.unpack(str[start:end])
00126         self.normals.append(val1)
00127       start = end
00128       end += 4
00129       (length,) = _struct_I.unpack(str[start:end])
00130       self.colors = []
00131       for i in range(0, length):
00132         val1 = std_msgs.msg.ColorRGBA()
00133         _x = val1
00134         start = end
00135         end += 16
00136         (_x.r, _x.g, _x.b, _x.a,) = _struct_4f.unpack(str[start:end])
00137         self.colors.append(val1)
00138       return self
00139     except struct.error as e:
00140       raise genpy.DeserializationError(e) #most likely buffer underfill
00141 
00142 
00143   def serialize_numpy(self, buff, numpy):
00144     """
00145     serialize message with numpy array types into buffer
00146     :param buff: buffer, ``StringIO``
00147     :param numpy: numpy python module
00148     """
00149     try:
00150       length = len(self.positions)
00151       buff.write(_struct_I.pack(length))
00152       for val1 in self.positions:
00153         _x = val1
00154         buff.write(_struct_3f.pack(_x.x, _x.y, _x.z))
00155       length = len(self.normals)
00156       buff.write(_struct_I.pack(length))
00157       for val1 in self.normals:
00158         _x = val1
00159         buff.write(_struct_3f.pack(_x.x, _x.y, _x.z))
00160       length = len(self.colors)
00161       buff.write(_struct_I.pack(length))
00162       for val1 in self.colors:
00163         _x = val1
00164         buff.write(_struct_4f.pack(_x.r, _x.g, _x.b, _x.a))
00165     except struct.error as se: self._check_types(se)
00166     except TypeError as te: self._check_types(te)
00167 
00168   def deserialize_numpy(self, str, numpy):
00169     """
00170     unpack serialized message in str into this message instance using numpy for array types
00171     :param str: byte array of serialized message, ``str``
00172     :param numpy: numpy python module
00173     """
00174     try:
00175       if self.positions is None:
00176         self.positions = None
00177       if self.normals is None:
00178         self.normals = None
00179       if self.colors is None:
00180         self.colors = None
00181       end = 0
00182       start = end
00183       end += 4
00184       (length,) = _struct_I.unpack(str[start:end])
00185       self.positions = []
00186       for i in range(0, length):
00187         val1 = rve_msgs.msg.Vector3()
00188         _x = val1
00189         start = end
00190         end += 12
00191         (_x.x, _x.y, _x.z,) = _struct_3f.unpack(str[start:end])
00192         self.positions.append(val1)
00193       start = end
00194       end += 4
00195       (length,) = _struct_I.unpack(str[start:end])
00196       self.normals = []
00197       for i in range(0, length):
00198         val1 = rve_msgs.msg.Vector3()
00199         _x = val1
00200         start = end
00201         end += 12
00202         (_x.x, _x.y, _x.z,) = _struct_3f.unpack(str[start:end])
00203         self.normals.append(val1)
00204       start = end
00205       end += 4
00206       (length,) = _struct_I.unpack(str[start:end])
00207       self.colors = []
00208       for i in range(0, length):
00209         val1 = std_msgs.msg.ColorRGBA()
00210         _x = val1
00211         start = end
00212         end += 16
00213         (_x.r, _x.g, _x.b, _x.a,) = _struct_4f.unpack(str[start:end])
00214         self.colors.append(val1)
00215       return self
00216     except struct.error as e:
00217       raise genpy.DeserializationError(e) #most likely buffer underfill
00218 
00219 _struct_I = genpy.struct_I
00220 _struct_4f = struct.Struct("<4f")
00221 _struct_3f = struct.Struct("<3f")


rve_msgs
Author(s): Josh Faust
autogenerated on Wed Dec 11 2013 14:30:38