_PoseCommandStatus.py
Go to the documentation of this file.
00001 """autogenerated by genpy from r2_msgs/PoseCommandStatus.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 
00009 class PoseCommandStatus(genpy.Message):
00010   _md5sum = "82493b7735e3fe414b93381d96bfd1ee"
00011   _type = "r2_msgs/PoseCommandStatus"
00012   _has_header = False #flag to mark the presence of a Header object
00013   _full_text = """time stamp
00014 string commandId
00015 uint8 PENDING=0
00016 uint8 ACTIVE=1
00017 uint8 REJECTED=2
00018 uint8 SUCCEEDED=3
00019 uint8 FAILED=4
00020 uint8 status
00021 string statusMessage
00022 
00023 """
00024   # Pseudo-constants
00025   PENDING = 0
00026   ACTIVE = 1
00027   REJECTED = 2
00028   SUCCEEDED = 3
00029   FAILED = 4
00030 
00031   __slots__ = ['stamp','commandId','status','statusMessage']
00032   _slot_types = ['time','string','uint8','string']
00033 
00034   def __init__(self, *args, **kwds):
00035     """
00036     Constructor. Any message fields that are implicitly/explicitly
00037     set to None will be assigned a default value. The recommend
00038     use is keyword arguments as this is more robust to future message
00039     changes.  You cannot mix in-order arguments and keyword arguments.
00040 
00041     The available fields are:
00042        stamp,commandId,status,statusMessage
00043 
00044     :param args: complete set of field values, in .msg order
00045     :param kwds: use keyword arguments corresponding to message field names
00046     to set specific fields.
00047     """
00048     if args or kwds:
00049       super(PoseCommandStatus, self).__init__(*args, **kwds)
00050       #message fields cannot be None, assign default values for those that are
00051       if self.stamp is None:
00052         self.stamp = genpy.Time()
00053       if self.commandId is None:
00054         self.commandId = ''
00055       if self.status is None:
00056         self.status = 0
00057       if self.statusMessage is None:
00058         self.statusMessage = ''
00059     else:
00060       self.stamp = genpy.Time()
00061       self.commandId = ''
00062       self.status = 0
00063       self.statusMessage = ''
00064 
00065   def _get_types(self):
00066     """
00067     internal API method
00068     """
00069     return self._slot_types
00070 
00071   def serialize(self, buff):
00072     """
00073     serialize message into buffer
00074     :param buff: buffer, ``StringIO``
00075     """
00076     try:
00077       _x = self
00078       buff.write(_struct_2I.pack(_x.stamp.secs, _x.stamp.nsecs))
00079       _x = self.commandId
00080       length = len(_x)
00081       if python3 or type(_x) == unicode:
00082         _x = _x.encode('utf-8')
00083         length = len(_x)
00084       buff.write(struct.pack('<I%ss'%length, length, _x))
00085       buff.write(_struct_B.pack(self.status))
00086       _x = self.statusMessage
00087       length = len(_x)
00088       if python3 or type(_x) == unicode:
00089         _x = _x.encode('utf-8')
00090         length = len(_x)
00091       buff.write(struct.pack('<I%ss'%length, length, _x))
00092     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00093     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
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, ``str``
00099     """
00100     try:
00101       if self.stamp is None:
00102         self.stamp = genpy.Time()
00103       end = 0
00104       _x = self
00105       start = end
00106       end += 8
00107       (_x.stamp.secs, _x.stamp.nsecs,) = _struct_2I.unpack(str[start:end])
00108       start = end
00109       end += 4
00110       (length,) = _struct_I.unpack(str[start:end])
00111       start = end
00112       end += length
00113       if python3:
00114         self.commandId = str[start:end].decode('utf-8')
00115       else:
00116         self.commandId = str[start:end]
00117       start = end
00118       end += 1
00119       (self.status,) = _struct_B.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       if python3:
00126         self.statusMessage = str[start:end].decode('utf-8')
00127       else:
00128         self.statusMessage = str[start:end]
00129       self.stamp.canon()
00130       return self
00131     except struct.error as e:
00132       raise genpy.DeserializationError(e) #most likely buffer underfill
00133 
00134 
00135   def serialize_numpy(self, buff, numpy):
00136     """
00137     serialize message with numpy array types into buffer
00138     :param buff: buffer, ``StringIO``
00139     :param numpy: numpy python module
00140     """
00141     try:
00142       _x = self
00143       buff.write(_struct_2I.pack(_x.stamp.secs, _x.stamp.nsecs))
00144       _x = self.commandId
00145       length = len(_x)
00146       if python3 or type(_x) == unicode:
00147         _x = _x.encode('utf-8')
00148         length = len(_x)
00149       buff.write(struct.pack('<I%ss'%length, length, _x))
00150       buff.write(_struct_B.pack(self.status))
00151       _x = self.statusMessage
00152       length = len(_x)
00153       if python3 or type(_x) == unicode:
00154         _x = _x.encode('utf-8')
00155         length = len(_x)
00156       buff.write(struct.pack('<I%ss'%length, length, _x))
00157     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00158     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00159 
00160   def deserialize_numpy(self, str, numpy):
00161     """
00162     unpack serialized message in str into this message instance using numpy for array types
00163     :param str: byte array of serialized message, ``str``
00164     :param numpy: numpy python module
00165     """
00166     try:
00167       if self.stamp is None:
00168         self.stamp = genpy.Time()
00169       end = 0
00170       _x = self
00171       start = end
00172       end += 8
00173       (_x.stamp.secs, _x.stamp.nsecs,) = _struct_2I.unpack(str[start:end])
00174       start = end
00175       end += 4
00176       (length,) = _struct_I.unpack(str[start:end])
00177       start = end
00178       end += length
00179       if python3:
00180         self.commandId = str[start:end].decode('utf-8')
00181       else:
00182         self.commandId = str[start:end]
00183       start = end
00184       end += 1
00185       (self.status,) = _struct_B.unpack(str[start:end])
00186       start = end
00187       end += 4
00188       (length,) = _struct_I.unpack(str[start:end])
00189       start = end
00190       end += length
00191       if python3:
00192         self.statusMessage = str[start:end].decode('utf-8')
00193       else:
00194         self.statusMessage = str[start:end]
00195       self.stamp.canon()
00196       return self
00197     except struct.error as e:
00198       raise genpy.DeserializationError(e) #most likely buffer underfill
00199 
00200 _struct_I = genpy.struct_I
00201 _struct_B = struct.Struct("<B")
00202 _struct_2I = struct.Struct("<2I")


r2_msgs
Author(s): Paul Dinh
autogenerated on Sat Jul 26 2014 06:34:21