00001 """autogenerated by genmsg_py from RIQActuatorState.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005
00006 class RIQActuatorState(roslib.message.Message):
00007 _md5sum = "cbea6b39c5eb1a580f94afb79f0a3ba4"
00008 _type = "riq_msgs/RIQActuatorState"
00009 _has_header = False
00010 _full_text = """# ROS state information for RobotIQ actuator.
00011
00012 # Measured motor current (in Amps)
00013 float64 current
00014
00015 # Motor position range from (0.0 to 1.0)
00016 float64 position
00017
00018 # True when finger / actuator detected an object
00019 bool object_detected
00020 """
00021 __slots__ = ['current','position','object_detected']
00022 _slot_types = ['float64','float64','bool']
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 current,position,object_detected
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(RIQActuatorState, self).__init__(*args, **kwds)
00040
00041 if self.current is None:
00042 self.current = 0.
00043 if self.position is None:
00044 self.position = 0.
00045 if self.object_detected is None:
00046 self.object_detected = False
00047 else:
00048 self.current = 0.
00049 self.position = 0.
00050 self.object_detected = False
00051
00052 def _get_types(self):
00053 """
00054 internal API method
00055 """
00056 return self._slot_types
00057
00058 def serialize(self, buff):
00059 """
00060 serialize message into buffer
00061 @param buff: buffer
00062 @type buff: StringIO
00063 """
00064 try:
00065 _x = self
00066 buff.write(_struct_2dB.pack(_x.current, _x.position, _x.object_detected))
00067 except struct.error, se: self._check_types(se)
00068 except TypeError, te: self._check_types(te)
00069
00070 def deserialize(self, str):
00071 """
00072 unpack serialized message in str into this message instance
00073 @param str: byte array of serialized message
00074 @type str: 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, e:
00085 raise roslib.message.DeserializationError(e)
00086
00087
00088 def serialize_numpy(self, buff, numpy):
00089 """
00090 serialize message with numpy array types into buffer
00091 @param buff: buffer
00092 @type buff: StringIO
00093 @param numpy: numpy python module
00094 @type numpy module
00095 """
00096 try:
00097 _x = self
00098 buff.write(_struct_2dB.pack(_x.current, _x.position, _x.object_detected))
00099 except struct.error, se: self._check_types(se)
00100 except TypeError, te: self._check_types(te)
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
00106 @type str: str
00107 @param numpy: numpy python module
00108 @type numpy: module
00109 """
00110 try:
00111 end = 0
00112 _x = self
00113 start = end
00114 end += 17
00115 (_x.current, _x.position, _x.object_detected,) = _struct_2dB.unpack(str[start:end])
00116 self.object_detected = bool(self.object_detected)
00117 return self
00118 except struct.error, e:
00119 raise roslib.message.DeserializationError(e)
00120
00121 _struct_I = roslib.message.struct_I
00122 _struct_2dB = struct.Struct("<2dB")