$search
00001 """autogenerated by genmsg_py from ChannelFloat32.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 00006 class ChannelFloat32(roslib.message.Message): 00007 _md5sum = "3d40139cdd33dfedcb71ffeeeb42ae7f" 00008 _type = "sensor_msgs/ChannelFloat32" 00009 _has_header = False #flag to mark the presence of a Header object 00010 _full_text = """# This message is used by the PointCloud message to hold optional data 00011 # associated with each point in the cloud. The length of the values 00012 # array should be the same as the length of the points array in the 00013 # PointCloud, and each value should be associated with the corresponding 00014 # point. 00015 00016 # Channel names in existing practice include: 00017 # "u", "v" - row and column (respectively) in the left stereo image. 00018 # This is opposite to usual conventions but remains for 00019 # historical reasons. The newer PointCloud2 message has no 00020 # such problem. 00021 # "rgb" - For point clouds produced by color stereo cameras. uint8 00022 # (R,G,B) values packed into the least significant 24 bits, 00023 # in order. 00024 # "intensity" - laser or pixel intensity. 00025 # "distance" 00026 00027 # The channel name should give semantics of the channel (e.g. 00028 # "intensity" instead of "value"). 00029 string name 00030 00031 # The values array should be 1-1 with the elements of the associated 00032 # PointCloud. 00033 float32[] values 00034 00035 """ 00036 __slots__ = ['name','values'] 00037 _slot_types = ['string','float32[]'] 00038 00039 def __init__(self, *args, **kwds): 00040 """ 00041 Constructor. Any message fields that are implicitly/explicitly 00042 set to None will be assigned a default value. The recommend 00043 use is keyword arguments as this is more robust to future message 00044 changes. You cannot mix in-order arguments and keyword arguments. 00045 00046 The available fields are: 00047 name,values 00048 00049 @param args: complete set of field values, in .msg order 00050 @param kwds: use keyword arguments corresponding to message field names 00051 to set specific fields. 00052 """ 00053 if args or kwds: 00054 super(ChannelFloat32, self).__init__(*args, **kwds) 00055 #message fields cannot be None, assign default values for those that are 00056 if self.name is None: 00057 self.name = '' 00058 if self.values is None: 00059 self.values = [] 00060 else: 00061 self.name = '' 00062 self.values = [] 00063 00064 def _get_types(self): 00065 """ 00066 internal API method 00067 """ 00068 return self._slot_types 00069 00070 def serialize(self, buff): 00071 """ 00072 serialize message into buffer 00073 @param buff: buffer 00074 @type buff: StringIO 00075 """ 00076 try: 00077 _x = self.name 00078 length = len(_x) 00079 buff.write(struct.pack('<I%ss'%length, length, _x)) 00080 length = len(self.values) 00081 buff.write(_struct_I.pack(length)) 00082 pattern = '<%sf'%length 00083 buff.write(struct.pack(pattern, *self.values)) 00084 except struct.error as se: self._check_types(se) 00085 except TypeError as te: self._check_types(te) 00086 00087 def deserialize(self, str): 00088 """ 00089 unpack serialized message in str into this message instance 00090 @param str: byte array of serialized message 00091 @type str: str 00092 """ 00093 try: 00094 end = 0 00095 start = end 00096 end += 4 00097 (length,) = _struct_I.unpack(str[start:end]) 00098 start = end 00099 end += length 00100 self.name = str[start:end] 00101 start = end 00102 end += 4 00103 (length,) = _struct_I.unpack(str[start:end]) 00104 pattern = '<%sf'%length 00105 start = end 00106 end += struct.calcsize(pattern) 00107 self.values = struct.unpack(pattern, str[start:end]) 00108 return self 00109 except struct.error as e: 00110 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00111 00112 00113 def serialize_numpy(self, buff, numpy): 00114 """ 00115 serialize message with numpy array types into buffer 00116 @param buff: buffer 00117 @type buff: StringIO 00118 @param numpy: numpy python module 00119 @type numpy module 00120 """ 00121 try: 00122 _x = self.name 00123 length = len(_x) 00124 buff.write(struct.pack('<I%ss'%length, length, _x)) 00125 length = len(self.values) 00126 buff.write(_struct_I.pack(length)) 00127 pattern = '<%sf'%length 00128 buff.write(self.values.tostring()) 00129 except struct.error as se: self._check_types(se) 00130 except TypeError as te: self._check_types(te) 00131 00132 def deserialize_numpy(self, str, numpy): 00133 """ 00134 unpack serialized message in str into this message instance using numpy for array types 00135 @param str: byte array of serialized message 00136 @type str: str 00137 @param numpy: numpy python module 00138 @type numpy: module 00139 """ 00140 try: 00141 end = 0 00142 start = end 00143 end += 4 00144 (length,) = _struct_I.unpack(str[start:end]) 00145 start = end 00146 end += length 00147 self.name = str[start:end] 00148 start = end 00149 end += 4 00150 (length,) = _struct_I.unpack(str[start:end]) 00151 pattern = '<%sf'%length 00152 start = end 00153 end += struct.calcsize(pattern) 00154 self.values = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length) 00155 return self 00156 except struct.error as e: 00157 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00158 00159 _struct_I = roslib.message.struct_I