_JointControlMode.py
Go to the documentation of this file.
00001 """autogenerated by genpy from nasa_r2_common_msgs/JointControlMode.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 JointControlMode(genpy.Message):
00009   _md5sum = "ed18104f2125248e91775725024700fe"
00010   _type = "nasa_r2_common_msgs/JointControlMode"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """uint8 state
00013 uint8 IGNORE     = 0
00014 uint8 INVALID    = 1
00015 uint8 BOOTLOADER = 2
00016 uint8 FAULTED    = 3
00017 uint8 SAFE       = 4
00018 uint8 OFF        = 5
00019 uint8 PARK       = 6
00020 uint8 NEUTRAL    = 7
00021 uint8 DRIVE      = 8
00022 
00023 """
00024   # Pseudo-constants
00025   IGNORE = 0
00026   INVALID = 1
00027   BOOTLOADER = 2
00028   FAULTED = 3
00029   SAFE = 4
00030   OFF = 5
00031   PARK = 6
00032   NEUTRAL = 7
00033   DRIVE = 8
00034 
00035   __slots__ = ['state']
00036   _slot_types = ['uint8']
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        state
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(JointControlMode, self).__init__(*args, **kwds)
00054       #message fields cannot be None, assign default values for those that are
00055       if self.state is None:
00056         self.state = 0
00057     else:
00058       self.state = 0
00059 
00060   def _get_types(self):
00061     """
00062     internal API method
00063     """
00064     return self._slot_types
00065 
00066   def serialize(self, buff):
00067     """
00068     serialize message into buffer
00069     :param buff: buffer, ``StringIO``
00070     """
00071     try:
00072       buff.write(_struct_B.pack(self.state))
00073     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00074     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00075 
00076   def deserialize(self, str):
00077     """
00078     unpack serialized message in str into this message instance
00079     :param str: byte array of serialized message, ``str``
00080     """
00081     try:
00082       end = 0
00083       start = end
00084       end += 1
00085       (self.state,) = _struct_B.unpack(str[start:end])
00086       return self
00087     except struct.error as e:
00088       raise genpy.DeserializationError(e) #most likely buffer underfill
00089 
00090 
00091   def serialize_numpy(self, buff, numpy):
00092     """
00093     serialize message with numpy array types into buffer
00094     :param buff: buffer, ``StringIO``
00095     :param numpy: numpy python module
00096     """
00097     try:
00098       buff.write(_struct_B.pack(self.state))
00099     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00100     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00101 
00102   def deserialize_numpy(self, str, numpy):
00103     """
00104     unpack serialized message in str into this message instance using numpy for array types
00105     :param str: byte array of serialized message, ``str``
00106     :param numpy: numpy python module
00107     """
00108     try:
00109       end = 0
00110       start = end
00111       end += 1
00112       (self.state,) = _struct_B.unpack(str[start:end])
00113       return self
00114     except struct.error as e:
00115       raise genpy.DeserializationError(e) #most likely buffer underfill
00116 
00117 _struct_I = genpy.struct_I
00118 _struct_B = struct.Struct("<B")


nasa_r2_common_msgs
Author(s): Paul Dinh. Maintained by Jennifer Turner
autogenerated on Mon Oct 6 2014 02:42:34