_RIQHandCommand.py
Go to the documentation of this file.
00001 """autogenerated by genpy from riq_msgs/RIQHandCommand.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 RIQHandCommand(genpy.Message):
00009   _md5sum = "1ea172a0fa98ff8b257948fc31b156cd"
00010   _type = "riq_msgs/RIQHandCommand"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """# ROS command message from RobotIQ hand
00013 
00014 # mode constants
00015 int8 CYLINDRICAL = 0
00016 int8 PINCH       = 1
00017 int8 SPHERIOD    = 2
00018 int8 SCISSORS    = 3
00019 
00020 # action constants
00021 int8 STOP     = 0
00022 int8 CLOSE    = 1
00023 int8 OPEN     = 2
00024 
00025 
00026 int8    mode      # PINCH, CYLINDRICAL, SPHERIOD, SCISSORS 
00027 int8    action    # CLOSE, OPEN, STOP
00028 float64 velocity  # Speed value goes from 0.0 to 1.0
00029 float64 force     # Force value goes from 0.0 to 1.0 
00030 """
00031   # Pseudo-constants
00032   CYLINDRICAL = 0
00033   PINCH = 1
00034   SPHERIOD = 2
00035   SCISSORS = 3
00036   STOP = 0
00037   CLOSE = 1
00038   OPEN = 2
00039 
00040   __slots__ = ['mode','action','velocity','force']
00041   _slot_types = ['int8','int8','float64','float64']
00042 
00043   def __init__(self, *args, **kwds):
00044     """
00045     Constructor. Any message fields that are implicitly/explicitly
00046     set to None will be assigned a default value. The recommend
00047     use is keyword arguments as this is more robust to future message
00048     changes.  You cannot mix in-order arguments and keyword arguments.
00049 
00050     The available fields are:
00051        mode,action,velocity,force
00052 
00053     :param args: complete set of field values, in .msg order
00054     :param kwds: use keyword arguments corresponding to message field names
00055     to set specific fields.
00056     """
00057     if args or kwds:
00058       super(RIQHandCommand, self).__init__(*args, **kwds)
00059       #message fields cannot be None, assign default values for those that are
00060       if self.mode is None:
00061         self.mode = 0
00062       if self.action is None:
00063         self.action = 0
00064       if self.velocity is None:
00065         self.velocity = 0.
00066       if self.force is None:
00067         self.force = 0.
00068     else:
00069       self.mode = 0
00070       self.action = 0
00071       self.velocity = 0.
00072       self.force = 0.
00073 
00074   def _get_types(self):
00075     """
00076     internal API method
00077     """
00078     return self._slot_types
00079 
00080   def serialize(self, buff):
00081     """
00082     serialize message into buffer
00083     :param buff: buffer, ``StringIO``
00084     """
00085     try:
00086       _x = self
00087       buff.write(_struct_2b2d.pack(_x.mode, _x.action, _x.velocity, _x.force))
00088     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00089     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00090 
00091   def deserialize(self, str):
00092     """
00093     unpack serialized message in str into this message instance
00094     :param str: byte array of serialized message, ``str``
00095     """
00096     try:
00097       end = 0
00098       _x = self
00099       start = end
00100       end += 18
00101       (_x.mode, _x.action, _x.velocity, _x.force,) = _struct_2b2d.unpack(str[start:end])
00102       return self
00103     except struct.error as e:
00104       raise genpy.DeserializationError(e) #most likely buffer underfill
00105 
00106 
00107   def serialize_numpy(self, buff, numpy):
00108     """
00109     serialize message with numpy array types into buffer
00110     :param buff: buffer, ``StringIO``
00111     :param numpy: numpy python module
00112     """
00113     try:
00114       _x = self
00115       buff.write(_struct_2b2d.pack(_x.mode, _x.action, _x.velocity, _x.force))
00116     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00117     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00118 
00119   def deserialize_numpy(self, str, numpy):
00120     """
00121     unpack serialized message in str into this message instance using numpy for array types
00122     :param str: byte array of serialized message, ``str``
00123     :param numpy: numpy python module
00124     """
00125     try:
00126       end = 0
00127       _x = self
00128       start = end
00129       end += 18
00130       (_x.mode, _x.action, _x.velocity, _x.force,) = _struct_2b2d.unpack(str[start:end])
00131       return self
00132     except struct.error as e:
00133       raise genpy.DeserializationError(e) #most likely buffer underfill
00134 
00135 _struct_I = genpy.struct_I
00136 _struct_2b2d = struct.Struct("<2b2d")


riq_msgs
Author(s): Derek King
autogenerated on Tue Apr 22 2014 19:42:39