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


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