_ControlType.py
Go to the documentation of this file.
00001 """autogenerated by genpy from sr_robot_msgs/ControlType.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 ControlType(genpy.Message):
00009   _md5sum = "a91c98360f1bce9810ba146996feea80"
00010   _type = "sr_robot_msgs/ControlType"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """int16 control_type
00013 
00014 int16 PWM=0
00015 int16 FORCE=1
00016 """
00017   # Pseudo-constants
00018   PWM = 0
00019   FORCE = 1
00020 
00021   __slots__ = ['control_type']
00022   _slot_types = ['int16']
00023 
00024   def __init__(self, *args, **kwds):
00025     """
00026     Constructor. Any message fields that are implicitly/explicitly
00027     set to None will be assigned a default value. The recommend
00028     use is keyword arguments as this is more robust to future message
00029     changes.  You cannot mix in-order arguments and keyword arguments.
00030 
00031     The available fields are:
00032        control_type
00033 
00034     :param args: complete set of field values, in .msg order
00035     :param kwds: use keyword arguments corresponding to message field names
00036     to set specific fields.
00037     """
00038     if args or kwds:
00039       super(ControlType, self).__init__(*args, **kwds)
00040       #message fields cannot be None, assign default values for those that are
00041       if self.control_type is None:
00042         self.control_type = 0
00043     else:
00044       self.control_type = 0
00045 
00046   def _get_types(self):
00047     """
00048     internal API method
00049     """
00050     return self._slot_types
00051 
00052   def serialize(self, buff):
00053     """
00054     serialize message into buffer
00055     :param buff: buffer, ``StringIO``
00056     """
00057     try:
00058       buff.write(_struct_h.pack(self.control_type))
00059     except struct.error as se: self._check_types(se)
00060     except TypeError as te: self._check_types(te)
00061 
00062   def deserialize(self, str):
00063     """
00064     unpack serialized message in str into this message instance
00065     :param str: byte array of serialized message, ``str``
00066     """
00067     try:
00068       end = 0
00069       start = end
00070       end += 2
00071       (self.control_type,) = _struct_h.unpack(str[start:end])
00072       return self
00073     except struct.error as e:
00074       raise genpy.DeserializationError(e) #most likely buffer underfill
00075 
00076 
00077   def serialize_numpy(self, buff, numpy):
00078     """
00079     serialize message with numpy array types into buffer
00080     :param buff: buffer, ``StringIO``
00081     :param numpy: numpy python module
00082     """
00083     try:
00084       buff.write(_struct_h.pack(self.control_type))
00085     except struct.error as se: self._check_types(se)
00086     except TypeError as te: self._check_types(te)
00087 
00088   def deserialize_numpy(self, str, numpy):
00089     """
00090     unpack serialized message in str into this message instance using numpy for array types
00091     :param str: byte array of serialized message, ``str``
00092     :param numpy: numpy python module
00093     """
00094     try:
00095       end = 0
00096       start = end
00097       end += 2
00098       (self.control_type,) = _struct_h.unpack(str[start:end])
00099       return self
00100     except struct.error as e:
00101       raise genpy.DeserializationError(e) #most likely buffer underfill
00102 
00103 _struct_I = genpy.struct_I
00104 _struct_h = struct.Struct("<h")


sr_robot_msgs
Author(s): Ugo Cupcic/ugo@shadowrobot.com
autogenerated on Fri Jan 3 2014 12:01:40