_PR2GripperPressureData.py
Go to the documentation of this file.
00001 """autogenerated by genpy from pr2_gripper_sensor_msgs/PR2GripperPressureData.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 PR2GripperPressureData(genpy.Message):
00009   _md5sum = "b69255f5117bf05fdcd1e83d4e6ab779"
00010   _type = "pr2_gripper_sensor_msgs/PR2GripperPressureData"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _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.
00013 
00014 # the pressure array for the left and right fingers
00015 float64[22] pressure_left
00016 float64[22] pressure_right
00017 
00018 float64 rostime
00019 """
00020   __slots__ = ['pressure_left','pressure_right','rostime']
00021   _slot_types = ['float64[22]','float64[22]','float64']
00022 
00023   def __init__(self, *args, **kwds):
00024     """
00025     Constructor. Any message fields that are implicitly/explicitly
00026     set to None will be assigned a default value. The recommend
00027     use is keyword arguments as this is more robust to future message
00028     changes.  You cannot mix in-order arguments and keyword arguments.
00029 
00030     The available fields are:
00031        pressure_left,pressure_right,rostime
00032 
00033     :param args: complete set of field values, in .msg order
00034     :param kwds: use keyword arguments corresponding to message field names
00035     to set specific fields.
00036     """
00037     if args or kwds:
00038       super(PR2GripperPressureData, self).__init__(*args, **kwds)
00039       #message fields cannot be None, assign default values for those that are
00040       if self.pressure_left is None:
00041         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.]
00042       if self.pressure_right is None:
00043         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.]
00044       if self.rostime is None:
00045         self.rostime = 0.
00046     else:
00047       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.]
00048       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.]
00049       self.rostime = 0.
00050 
00051   def _get_types(self):
00052     """
00053     internal API method
00054     """
00055     return self._slot_types
00056 
00057   def serialize(self, buff):
00058     """
00059     serialize message into buffer
00060     :param buff: buffer, ``StringIO``
00061     """
00062     try:
00063       buff.write(_struct_22d.pack(*self.pressure_left))
00064       buff.write(_struct_22d.pack(*self.pressure_right))
00065       buff.write(_struct_d.pack(self.rostime))
00066     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00067     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00068 
00069   def deserialize(self, str):
00070     """
00071     unpack serialized message in str into this message instance
00072     :param str: byte array of serialized message, ``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 as e:
00087       raise genpy.DeserializationError(e) #most likely buffer underfill
00088 
00089 
00090   def serialize_numpy(self, buff, numpy):
00091     """
00092     serialize message with numpy array types into buffer
00093     :param buff: buffer, ``StringIO``
00094     :param numpy: numpy python module
00095     """
00096     try:
00097       buff.write(self.pressure_left.tostring())
00098       buff.write(self.pressure_right.tostring())
00099       buff.write(_struct_d.pack(self.rostime))
00100     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00101     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00102 
00103   def deserialize_numpy(self, str, numpy):
00104     """
00105     unpack serialized message in str into this message instance using numpy for array types
00106     :param str: byte array of serialized message, ``str``
00107     :param numpy: numpy python module
00108     """
00109     try:
00110       end = 0
00111       start = end
00112       end += 176
00113       self.pressure_left = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=22)
00114       start = end
00115       end += 176
00116       self.pressure_right = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=22)
00117       start = end
00118       end += 8
00119       (self.rostime,) = _struct_d.unpack(str[start:end])
00120       return self
00121     except struct.error as e:
00122       raise genpy.DeserializationError(e) #most likely buffer underfill
00123 
00124 _struct_I = genpy.struct_I
00125 _struct_22d = struct.Struct("<22d")
00126 _struct_d = struct.Struct("<d")


pr2_gripper_sensor_msgs
Author(s): Joe Romano
autogenerated on Mon Oct 6 2014 12:17:32