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


sr_robot_msgs
Author(s): Ugo Cupcic/ugo@shadowrobot.com
autogenerated on Mon Oct 6 2014 07:40:05