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