$search
00001 """autogenerated by genmsg_py from Test.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import roslisp_tutorials.msg 00006 00007 class Test(roslib.message.Message): 00008 _md5sum = "c56ee95e9378267df41b719464b064be" 00009 _type = "roslisp_tutorials/Test" 00010 _has_header = False #flag to mark the presence of a Header object 00011 _full_text = """Point[2] location 00012 int32[] orientation 00013 ================================================================================ 00014 MSG: roslisp_tutorials/Point 00015 float32 x 00016 float32 y 00017 float32 z 00018 00019 """ 00020 __slots__ = ['location','orientation'] 00021 _slot_types = ['roslisp_tutorials/Point[2]','int32[]'] 00022 00023 def __init__(self, *args, **kwds): 00024 """ 00025 Constructor. Any message fields that are implicitly/explicitly 00026 set to None will be assigned a default value. The recommend 00027 use is keyword arguments as this is more robust to future message 00028 changes. You cannot mix in-order arguments and keyword arguments. 00029 00030 The available fields are: 00031 location,orientation 00032 00033 @param args: complete set of field values, in .msg order 00034 @param kwds: use keyword arguments corresponding to message field names 00035 to set specific fields. 00036 """ 00037 if args or kwds: 00038 super(Test, self).__init__(*args, **kwds) 00039 #message fields cannot be None, assign default values for those that are 00040 if self.location is None: 00041 self.location = [roslisp_tutorials.msg.Point(),roslisp_tutorials.msg.Point()] 00042 if self.orientation is None: 00043 self.orientation = [] 00044 else: 00045 self.location = [roslisp_tutorials.msg.Point(),roslisp_tutorials.msg.Point()] 00046 self.orientation = [] 00047 00048 def _get_types(self): 00049 """ 00050 internal API method 00051 """ 00052 return self._slot_types 00053 00054 def serialize(self, buff): 00055 """ 00056 serialize message into buffer 00057 @param buff: buffer 00058 @type buff: StringIO 00059 """ 00060 try: 00061 for val1 in self.location: 00062 _x = val1 00063 buff.write(_struct_3f.pack(_x.x, _x.y, _x.z)) 00064 length = len(self.orientation) 00065 buff.write(_struct_I.pack(length)) 00066 pattern = '<%si'%length 00067 buff.write(struct.pack(pattern, *self.orientation)) 00068 except struct.error as se: self._check_types(se) 00069 except TypeError as te: self._check_types(te) 00070 00071 def deserialize(self, str): 00072 """ 00073 unpack serialized message in str into this message instance 00074 @param str: byte array of serialized message 00075 @type str: str 00076 """ 00077 try: 00078 end = 0 00079 self.location = [] 00080 for i in range(0, 2): 00081 val1 = roslisp_tutorials.msg.Point() 00082 _x = val1 00083 start = end 00084 end += 12 00085 (_x.x, _x.y, _x.z,) = _struct_3f.unpack(str[start:end]) 00086 self.location.append(val1) 00087 start = end 00088 end += 4 00089 (length,) = _struct_I.unpack(str[start:end]) 00090 pattern = '<%si'%length 00091 start = end 00092 end += struct.calcsize(pattern) 00093 self.orientation = struct.unpack(pattern, str[start:end]) 00094 return self 00095 except struct.error as e: 00096 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00097 00098 00099 def serialize_numpy(self, buff, numpy): 00100 """ 00101 serialize message with numpy array types into buffer 00102 @param buff: buffer 00103 @type buff: StringIO 00104 @param numpy: numpy python module 00105 @type numpy module 00106 """ 00107 try: 00108 for val1 in self.location: 00109 _x = val1 00110 buff.write(_struct_3f.pack(_x.x, _x.y, _x.z)) 00111 length = len(self.orientation) 00112 buff.write(_struct_I.pack(length)) 00113 pattern = '<%si'%length 00114 buff.write(self.orientation.tostring()) 00115 except struct.error as se: self._check_types(se) 00116 except TypeError as te: self._check_types(te) 00117 00118 def deserialize_numpy(self, str, numpy): 00119 """ 00120 unpack serialized message in str into this message instance using numpy for array types 00121 @param str: byte array of serialized message 00122 @type str: str 00123 @param numpy: numpy python module 00124 @type numpy: module 00125 """ 00126 try: 00127 end = 0 00128 self.location = [] 00129 for i in range(0, 2): 00130 val1 = roslisp_tutorials.msg.Point() 00131 _x = val1 00132 start = end 00133 end += 12 00134 (_x.x, _x.y, _x.z,) = _struct_3f.unpack(str[start:end]) 00135 self.location.append(val1) 00136 start = end 00137 end += 4 00138 (length,) = _struct_I.unpack(str[start:end]) 00139 pattern = '<%si'%length 00140 start = end 00141 end += struct.calcsize(pattern) 00142 self.orientation = numpy.frombuffer(str[start:end], dtype=numpy.int32, count=length) 00143 return self 00144 except struct.error as e: 00145 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00146 00147 _struct_I = roslib.message.struct_I 00148 _struct_3f = struct.Struct("<3f")