00001 """autogenerated by genmsg_py from PR2GripperPressureData.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005
00006 class PR2GripperPressureData(roslib.message.Message):
00007 _md5sum = "b69255f5117bf05fdcd1e83d4e6ab779"
00008 _type = "pr2_gripper_sensor_msgs/PR2GripperPressureData"
00009 _has_header = False
00010 _full_text = """# Note: This message is intended for internal package use only and is NOT a part of the public API. This data is not publicaly published in ROS.
00011
00012 # the pressure array for the left and right fingers
00013 float64[22] pressure_left
00014 float64[22] pressure_right
00015
00016 float64 rostime
00017 """
00018 __slots__ = ['pressure_left','pressure_right','rostime']
00019 _slot_types = ['float64[22]','float64[22]','float64']
00020
00021 def __init__(self, *args, **kwds):
00022 """
00023 Constructor. Any message fields that are implicitly/explicitly
00024 set to None will be assigned a default value. The recommend
00025 use is keyword arguments as this is more robust to future message
00026 changes. You cannot mix in-order arguments and keyword arguments.
00027
00028 The available fields are:
00029 pressure_left,pressure_right,rostime
00030
00031 @param args: complete set of field values, in .msg order
00032 @param kwds: use keyword arguments corresponding to message field names
00033 to set specific fields.
00034 """
00035 if args or kwds:
00036 super(PR2GripperPressureData, self).__init__(*args, **kwds)
00037
00038 if self.pressure_left is None:
00039 self.pressure_left = [0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.]
00040 if self.pressure_right is None:
00041 self.pressure_right = [0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.]
00042 if self.rostime is None:
00043 self.rostime = 0.
00044 else:
00045 self.pressure_left = [0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.]
00046 self.pressure_right = [0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.]
00047 self.rostime = 0.
00048
00049 def _get_types(self):
00050 """
00051 internal API method
00052 """
00053 return self._slot_types
00054
00055 def serialize(self, buff):
00056 """
00057 serialize message into buffer
00058 @param buff: buffer
00059 @type buff: StringIO
00060 """
00061 try:
00062 buff.write(_struct_22d.pack(*self.pressure_left))
00063 buff.write(_struct_22d.pack(*self.pressure_right))
00064 buff.write(_struct_d.pack(self.rostime))
00065 except struct.error, se: self._check_types(se)
00066 except TypeError, te: self._check_types(te)
00067
00068 def deserialize(self, str):
00069 """
00070 unpack serialized message in str into this message instance
00071 @param str: byte array of serialized message
00072 @type str: str
00073 """
00074 try:
00075 end = 0
00076 start = end
00077 end += 176
00078 self.pressure_left = _struct_22d.unpack(str[start:end])
00079 start = end
00080 end += 176
00081 self.pressure_right = _struct_22d.unpack(str[start:end])
00082 start = end
00083 end += 8
00084 (self.rostime,) = _struct_d.unpack(str[start:end])
00085 return self
00086 except struct.error, e:
00087 raise roslib.message.DeserializationError(e)
00088
00089
00090 def serialize_numpy(self, buff, numpy):
00091 """
00092 serialize message with numpy array types into buffer
00093 @param buff: buffer
00094 @type buff: StringIO
00095 @param numpy: numpy python module
00096 @type numpy module
00097 """
00098 try:
00099 buff.write(self.pressure_left.tostring())
00100 buff.write(self.pressure_right.tostring())
00101 buff.write(_struct_d.pack(self.rostime))
00102 except struct.error, se: self._check_types(se)
00103 except TypeError, te: self._check_types(te)
00104
00105 def deserialize_numpy(self, str, numpy):
00106 """
00107 unpack serialized message in str into this message instance using numpy for array types
00108 @param str: byte array of serialized message
00109 @type str: str
00110 @param numpy: numpy python module
00111 @type numpy: module
00112 """
00113 try:
00114 end = 0
00115 start = end
00116 end += 176
00117 self.pressure_left = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=22)
00118 start = end
00119 end += 176
00120 self.pressure_right = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=22)
00121 start = end
00122 end += 8
00123 (self.rostime,) = _struct_d.unpack(str[start:end])
00124 return self
00125 except struct.error, e:
00126 raise roslib.message.DeserializationError(e)
00127
00128 _struct_I = roslib.message.struct_I
00129 _struct_22d = struct.Struct("<22d")
00130 _struct_d = struct.Struct("<d")