00001 """autogenerated by genpy from nao_msgs/BlinkGoal.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 genpy
00008 import std_msgs.msg
00009
00010 class BlinkGoal(genpy.Message):
00011 _md5sum = "5e5d3c2ba9976dc121a0bb6ef7c66d79"
00012 _type = "nao_msgs/BlinkGoal"
00013 _has_header = False
00014 _full_text = """# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======
00015 # Goal: colours to use for blinking, plus blinking rate mean and sd
00016 # Result: true if robot is still blinking (call was pre-empted by another user)
00017 # Feedback: last blinked colour
00018 std_msgs/ColorRGBA[] colors
00019 std_msgs/ColorRGBA bg_color
00020 duration blink_duration
00021 float32 blink_rate_mean
00022 float32 blink_rate_sd
00023
00024 ================================================================================
00025 MSG: std_msgs/ColorRGBA
00026 float32 r
00027 float32 g
00028 float32 b
00029 float32 a
00030
00031 """
00032 __slots__ = ['colors','bg_color','blink_duration','blink_rate_mean','blink_rate_sd']
00033 _slot_types = ['std_msgs/ColorRGBA[]','std_msgs/ColorRGBA','duration','float32','float32']
00034
00035 def __init__(self, *args, **kwds):
00036 """
00037 Constructor. Any message fields that are implicitly/explicitly
00038 set to None will be assigned a default value. The recommend
00039 use is keyword arguments as this is more robust to future message
00040 changes. You cannot mix in-order arguments and keyword arguments.
00041
00042 The available fields are:
00043 colors,bg_color,blink_duration,blink_rate_mean,blink_rate_sd
00044
00045 :param args: complete set of field values, in .msg order
00046 :param kwds: use keyword arguments corresponding to message field names
00047 to set specific fields.
00048 """
00049 if args or kwds:
00050 super(BlinkGoal, self).__init__(*args, **kwds)
00051
00052 if self.colors is None:
00053 self.colors = []
00054 if self.bg_color is None:
00055 self.bg_color = std_msgs.msg.ColorRGBA()
00056 if self.blink_duration is None:
00057 self.blink_duration = genpy.Duration()
00058 if self.blink_rate_mean is None:
00059 self.blink_rate_mean = 0.
00060 if self.blink_rate_sd is None:
00061 self.blink_rate_sd = 0.
00062 else:
00063 self.colors = []
00064 self.bg_color = std_msgs.msg.ColorRGBA()
00065 self.blink_duration = genpy.Duration()
00066 self.blink_rate_mean = 0.
00067 self.blink_rate_sd = 0.
00068
00069 def _get_types(self):
00070 """
00071 internal API method
00072 """
00073 return self._slot_types
00074
00075 def serialize(self, buff):
00076 """
00077 serialize message into buffer
00078 :param buff: buffer, ``StringIO``
00079 """
00080 try:
00081 length = len(self.colors)
00082 buff.write(_struct_I.pack(length))
00083 for val1 in self.colors:
00084 _x = val1
00085 buff.write(_struct_4f.pack(_x.r, _x.g, _x.b, _x.a))
00086 _x = self
00087 buff.write(_struct_4f2i2f.pack(_x.bg_color.r, _x.bg_color.g, _x.bg_color.b, _x.bg_color.a, _x.blink_duration.secs, _x.blink_duration.nsecs, _x.blink_rate_mean, _x.blink_rate_sd))
00088 except struct.error as se: self._check_types(se)
00089 except TypeError as te: self._check_types(te)
00090
00091 def deserialize(self, str):
00092 """
00093 unpack serialized message in str into this message instance
00094 :param str: byte array of serialized message, ``str``
00095 """
00096 try:
00097 if self.colors is None:
00098 self.colors = None
00099 if self.bg_color is None:
00100 self.bg_color = std_msgs.msg.ColorRGBA()
00101 if self.blink_duration is None:
00102 self.blink_duration = genpy.Duration()
00103 end = 0
00104 start = end
00105 end += 4
00106 (length,) = _struct_I.unpack(str[start:end])
00107 self.colors = []
00108 for i in range(0, length):
00109 val1 = std_msgs.msg.ColorRGBA()
00110 _x = val1
00111 start = end
00112 end += 16
00113 (_x.r, _x.g, _x.b, _x.a,) = _struct_4f.unpack(str[start:end])
00114 self.colors.append(val1)
00115 _x = self
00116 start = end
00117 end += 32
00118 (_x.bg_color.r, _x.bg_color.g, _x.bg_color.b, _x.bg_color.a, _x.blink_duration.secs, _x.blink_duration.nsecs, _x.blink_rate_mean, _x.blink_rate_sd,) = _struct_4f2i2f.unpack(str[start:end])
00119 self.blink_duration.canon()
00120 return self
00121 except struct.error as e:
00122 raise genpy.DeserializationError(e)
00123
00124
00125 def serialize_numpy(self, buff, numpy):
00126 """
00127 serialize message with numpy array types into buffer
00128 :param buff: buffer, ``StringIO``
00129 :param numpy: numpy python module
00130 """
00131 try:
00132 length = len(self.colors)
00133 buff.write(_struct_I.pack(length))
00134 for val1 in self.colors:
00135 _x = val1
00136 buff.write(_struct_4f.pack(_x.r, _x.g, _x.b, _x.a))
00137 _x = self
00138 buff.write(_struct_4f2i2f.pack(_x.bg_color.r, _x.bg_color.g, _x.bg_color.b, _x.bg_color.a, _x.blink_duration.secs, _x.blink_duration.nsecs, _x.blink_rate_mean, _x.blink_rate_sd))
00139 except struct.error as se: self._check_types(se)
00140 except TypeError as te: self._check_types(te)
00141
00142 def deserialize_numpy(self, str, numpy):
00143 """
00144 unpack serialized message in str into this message instance using numpy for array types
00145 :param str: byte array of serialized message, ``str``
00146 :param numpy: numpy python module
00147 """
00148 try:
00149 if self.colors is None:
00150 self.colors = None
00151 if self.bg_color is None:
00152 self.bg_color = std_msgs.msg.ColorRGBA()
00153 if self.blink_duration is None:
00154 self.blink_duration = genpy.Duration()
00155 end = 0
00156 start = end
00157 end += 4
00158 (length,) = _struct_I.unpack(str[start:end])
00159 self.colors = []
00160 for i in range(0, length):
00161 val1 = std_msgs.msg.ColorRGBA()
00162 _x = val1
00163 start = end
00164 end += 16
00165 (_x.r, _x.g, _x.b, _x.a,) = _struct_4f.unpack(str[start:end])
00166 self.colors.append(val1)
00167 _x = self
00168 start = end
00169 end += 32
00170 (_x.bg_color.r, _x.bg_color.g, _x.bg_color.b, _x.bg_color.a, _x.blink_duration.secs, _x.blink_duration.nsecs, _x.blink_rate_mean, _x.blink_rate_sd,) = _struct_4f2i2f.unpack(str[start:end])
00171 self.blink_duration.canon()
00172 return self
00173 except struct.error as e:
00174 raise genpy.DeserializationError(e)
00175
00176 _struct_I = genpy.struct_I
00177 _struct_4f = struct.Struct("<4f")
00178 _struct_4f2i2f = struct.Struct("<4f2i2f")