00001 """autogenerated by genpy from pr2_mechanism_controllers/DebugInfo.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006
00007
00008 class DebugInfo(genpy.Message):
00009 _md5sum = "6281356ce897e33da024b8eb319460f2"
00010 _type = "pr2_mechanism_controllers/DebugInfo"
00011 _has_header = False
00012 _full_text = """float64[] timing
00013 int32 sequence
00014 bool input_valid
00015 float64 residual
00016 """
00017 __slots__ = ['timing','sequence','input_valid','residual']
00018 _slot_types = ['float64[]','int32','bool','float64']
00019
00020 def __init__(self, *args, **kwds):
00021 """
00022 Constructor. Any message fields that are implicitly/explicitly
00023 set to None will be assigned a default value. The recommend
00024 use is keyword arguments as this is more robust to future message
00025 changes. You cannot mix in-order arguments and keyword arguments.
00026
00027 The available fields are:
00028 timing,sequence,input_valid,residual
00029
00030 :param args: complete set of field values, in .msg order
00031 :param kwds: use keyword arguments corresponding to message field names
00032 to set specific fields.
00033 """
00034 if args or kwds:
00035 super(DebugInfo, self).__init__(*args, **kwds)
00036
00037 if self.timing is None:
00038 self.timing = []
00039 if self.sequence is None:
00040 self.sequence = 0
00041 if self.input_valid is None:
00042 self.input_valid = False
00043 if self.residual is None:
00044 self.residual = 0.
00045 else:
00046 self.timing = []
00047 self.sequence = 0
00048 self.input_valid = False
00049 self.residual = 0.
00050
00051 def _get_types(self):
00052 """
00053 internal API method
00054 """
00055 return self._slot_types
00056
00057 def serialize(self, buff):
00058 """
00059 serialize message into buffer
00060 :param buff: buffer, ``StringIO``
00061 """
00062 try:
00063 length = len(self.timing)
00064 buff.write(_struct_I.pack(length))
00065 pattern = '<%sd'%length
00066 buff.write(struct.pack(pattern, *self.timing))
00067 _x = self
00068 buff.write(_struct_iBd.pack(_x.sequence, _x.input_valid, _x.residual))
00069 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00070 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00071
00072 def deserialize(self, str):
00073 """
00074 unpack serialized message in str into this message instance
00075 :param str: byte array of serialized message, ``str``
00076 """
00077 try:
00078 end = 0
00079 start = end
00080 end += 4
00081 (length,) = _struct_I.unpack(str[start:end])
00082 pattern = '<%sd'%length
00083 start = end
00084 end += struct.calcsize(pattern)
00085 self.timing = struct.unpack(pattern, str[start:end])
00086 _x = self
00087 start = end
00088 end += 13
00089 (_x.sequence, _x.input_valid, _x.residual,) = _struct_iBd.unpack(str[start:end])
00090 self.input_valid = bool(self.input_valid)
00091 return self
00092 except struct.error as e:
00093 raise genpy.DeserializationError(e)
00094
00095
00096 def serialize_numpy(self, buff, numpy):
00097 """
00098 serialize message with numpy array types into buffer
00099 :param buff: buffer, ``StringIO``
00100 :param numpy: numpy python module
00101 """
00102 try:
00103 length = len(self.timing)
00104 buff.write(_struct_I.pack(length))
00105 pattern = '<%sd'%length
00106 buff.write(self.timing.tostring())
00107 _x = self
00108 buff.write(_struct_iBd.pack(_x.sequence, _x.input_valid, _x.residual))
00109 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00110 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00111
00112 def deserialize_numpy(self, str, numpy):
00113 """
00114 unpack serialized message in str into this message instance using numpy for array types
00115 :param str: byte array of serialized message, ``str``
00116 :param numpy: numpy python module
00117 """
00118 try:
00119 end = 0
00120 start = end
00121 end += 4
00122 (length,) = _struct_I.unpack(str[start:end])
00123 pattern = '<%sd'%length
00124 start = end
00125 end += struct.calcsize(pattern)
00126 self.timing = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00127 _x = self
00128 start = end
00129 end += 13
00130 (_x.sequence, _x.input_valid, _x.residual,) = _struct_iBd.unpack(str[start:end])
00131 self.input_valid = bool(self.input_valid)
00132 return self
00133 except struct.error as e:
00134 raise genpy.DeserializationError(e)
00135
00136 _struct_I = genpy.struct_I
00137 _struct_iBd = struct.Struct("<iBd")