$search
00001 """autogenerated by genmsg_py from Color.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import std_msgs.msg 00006 00007 class Color(roslib.message.Message): 00008 _md5sum = "a62a6387c4711f26d641ffa6e12a86e8" 00009 _type = "nxt_msgs/Color" 00010 _has_header = True #flag to mark the presence of a Header object 00011 _full_text = """Header header 00012 float64 intensity 00013 float64 r 00014 float64 g 00015 float64 b 00016 ================================================================================ 00017 MSG: std_msgs/Header 00018 # Standard metadata for higher-level stamped data types. 00019 # This is generally used to communicate timestamped data 00020 # in a particular coordinate frame. 00021 # 00022 # sequence ID: consecutively increasing ID 00023 uint32 seq 00024 #Two-integer timestamp that is expressed as: 00025 # * stamp.secs: seconds (stamp_secs) since epoch 00026 # * stamp.nsecs: nanoseconds since stamp_secs 00027 # time-handling sugar is provided by the client library 00028 time stamp 00029 #Frame this data is associated with 00030 # 0: no frame 00031 # 1: global frame 00032 string frame_id 00033 00034 """ 00035 __slots__ = ['header','intensity','r','g','b'] 00036 _slot_types = ['Header','float64','float64','float64','float64'] 00037 00038 def __init__(self, *args, **kwds): 00039 """ 00040 Constructor. Any message fields that are implicitly/explicitly 00041 set to None will be assigned a default value. The recommend 00042 use is keyword arguments as this is more robust to future message 00043 changes. You cannot mix in-order arguments and keyword arguments. 00044 00045 The available fields are: 00046 header,intensity,r,g,b 00047 00048 @param args: complete set of field values, in .msg order 00049 @param kwds: use keyword arguments corresponding to message field names 00050 to set specific fields. 00051 """ 00052 if args or kwds: 00053 super(Color, self).__init__(*args, **kwds) 00054 #message fields cannot be None, assign default values for those that are 00055 if self.header is None: 00056 self.header = std_msgs.msg._Header.Header() 00057 if self.intensity is None: 00058 self.intensity = 0. 00059 if self.r is None: 00060 self.r = 0. 00061 if self.g is None: 00062 self.g = 0. 00063 if self.b is None: 00064 self.b = 0. 00065 else: 00066 self.header = std_msgs.msg._Header.Header() 00067 self.intensity = 0. 00068 self.r = 0. 00069 self.g = 0. 00070 self.b = 0. 00071 00072 def _get_types(self): 00073 """ 00074 internal API method 00075 """ 00076 return self._slot_types 00077 00078 def serialize(self, buff): 00079 """ 00080 serialize message into buffer 00081 @param buff: buffer 00082 @type buff: StringIO 00083 """ 00084 try: 00085 _x = self 00086 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00087 _x = self.header.frame_id 00088 length = len(_x) 00089 buff.write(struct.pack('<I%ss'%length, length, _x)) 00090 _x = self 00091 buff.write(_struct_4d.pack(_x.intensity, _x.r, _x.g, _x.b)) 00092 except struct.error as se: self._check_types(se) 00093 except TypeError as te: self._check_types(te) 00094 00095 def deserialize(self, str): 00096 """ 00097 unpack serialized message in str into this message instance 00098 @param str: byte array of serialized message 00099 @type str: str 00100 """ 00101 try: 00102 if self.header is None: 00103 self.header = std_msgs.msg._Header.Header() 00104 end = 0 00105 _x = self 00106 start = end 00107 end += 12 00108 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00109 start = end 00110 end += 4 00111 (length,) = _struct_I.unpack(str[start:end]) 00112 start = end 00113 end += length 00114 self.header.frame_id = str[start:end] 00115 _x = self 00116 start = end 00117 end += 32 00118 (_x.intensity, _x.r, _x.g, _x.b,) = _struct_4d.unpack(str[start:end]) 00119 return self 00120 except struct.error as e: 00121 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00122 00123 00124 def serialize_numpy(self, buff, numpy): 00125 """ 00126 serialize message with numpy array types into buffer 00127 @param buff: buffer 00128 @type buff: StringIO 00129 @param numpy: numpy python module 00130 @type numpy module 00131 """ 00132 try: 00133 _x = self 00134 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00135 _x = self.header.frame_id 00136 length = len(_x) 00137 buff.write(struct.pack('<I%ss'%length, length, _x)) 00138 _x = self 00139 buff.write(_struct_4d.pack(_x.intensity, _x.r, _x.g, _x.b)) 00140 except struct.error as se: self._check_types(se) 00141 except TypeError as te: self._check_types(te) 00142 00143 def deserialize_numpy(self, str, numpy): 00144 """ 00145 unpack serialized message in str into this message instance using numpy for array types 00146 @param str: byte array of serialized message 00147 @type str: str 00148 @param numpy: numpy python module 00149 @type numpy: module 00150 """ 00151 try: 00152 if self.header is None: 00153 self.header = std_msgs.msg._Header.Header() 00154 end = 0 00155 _x = self 00156 start = end 00157 end += 12 00158 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00159 start = end 00160 end += 4 00161 (length,) = _struct_I.unpack(str[start:end]) 00162 start = end 00163 end += length 00164 self.header.frame_id = str[start:end] 00165 _x = self 00166 start = end 00167 end += 32 00168 (_x.intensity, _x.r, _x.g, _x.b,) = _struct_4d.unpack(str[start:end]) 00169 return self 00170 except struct.error as e: 00171 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00172 00173 _struct_I = roslib.message.struct_I 00174 _struct_3I = struct.Struct("<3I") 00175 _struct_4d = struct.Struct("<4d")