_ManualGraspingResult.py
Go to the documentation of this file.
00001 """autogenerated by genpy from srs_assisted_grasping_msgs/ManualGraspingResult.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006 
00007 import genpy
00008 
00009 class ManualGraspingResult(genpy.Message):
00010   _md5sum = "84e0c29ee3715a768f8d896e6b92254b"
00011   _type = "srs_assisted_grasping_msgs/ManualGraspingResult"
00012   _has_header = False #flag to mark the presence of a Header object
00013   _full_text = """# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======
00014 # result
00015 duration time_elapsed
00016 bool grasped
00017 float32 tip1_force
00018 float32 tip2_force
00019 float32 tip3_force
00020 
00021 """
00022   __slots__ = ['time_elapsed','grasped','tip1_force','tip2_force','tip3_force']
00023   _slot_types = ['duration','bool','float32','float32','float32']
00024 
00025   def __init__(self, *args, **kwds):
00026     """
00027     Constructor. Any message fields that are implicitly/explicitly
00028     set to None will be assigned a default value. The recommend
00029     use is keyword arguments as this is more robust to future message
00030     changes.  You cannot mix in-order arguments and keyword arguments.
00031 
00032     The available fields are:
00033        time_elapsed,grasped,tip1_force,tip2_force,tip3_force
00034 
00035     :param args: complete set of field values, in .msg order
00036     :param kwds: use keyword arguments corresponding to message field names
00037     to set specific fields.
00038     """
00039     if args or kwds:
00040       super(ManualGraspingResult, self).__init__(*args, **kwds)
00041       #message fields cannot be None, assign default values for those that are
00042       if self.time_elapsed is None:
00043         self.time_elapsed = genpy.Duration()
00044       if self.grasped is None:
00045         self.grasped = False
00046       if self.tip1_force is None:
00047         self.tip1_force = 0.
00048       if self.tip2_force is None:
00049         self.tip2_force = 0.
00050       if self.tip3_force is None:
00051         self.tip3_force = 0.
00052     else:
00053       self.time_elapsed = genpy.Duration()
00054       self.grasped = False
00055       self.tip1_force = 0.
00056       self.tip2_force = 0.
00057       self.tip3_force = 0.
00058 
00059   def _get_types(self):
00060     """
00061     internal API method
00062     """
00063     return self._slot_types
00064 
00065   def serialize(self, buff):
00066     """
00067     serialize message into buffer
00068     :param buff: buffer, ``StringIO``
00069     """
00070     try:
00071       _x = self
00072       buff.write(_struct_2iB3f.pack(_x.time_elapsed.secs, _x.time_elapsed.nsecs, _x.grasped, _x.tip1_force, _x.tip2_force, _x.tip3_force))
00073     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00074     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00075 
00076   def deserialize(self, str):
00077     """
00078     unpack serialized message in str into this message instance
00079     :param str: byte array of serialized message, ``str``
00080     """
00081     try:
00082       if self.time_elapsed is None:
00083         self.time_elapsed = genpy.Duration()
00084       end = 0
00085       _x = self
00086       start = end
00087       end += 21
00088       (_x.time_elapsed.secs, _x.time_elapsed.nsecs, _x.grasped, _x.tip1_force, _x.tip2_force, _x.tip3_force,) = _struct_2iB3f.unpack(str[start:end])
00089       self.grasped = bool(self.grasped)
00090       self.time_elapsed.canon()
00091       return self
00092     except struct.error as e:
00093       raise genpy.DeserializationError(e) #most likely buffer underfill
00094 
00095 
00096   def serialize_numpy(self, buff, numpy):
00097     """
00098     serialize message with numpy array types into buffer
00099     :param buff: buffer, ``StringIO``
00100     :param numpy: numpy python module
00101     """
00102     try:
00103       _x = self
00104       buff.write(_struct_2iB3f.pack(_x.time_elapsed.secs, _x.time_elapsed.nsecs, _x.grasped, _x.tip1_force, _x.tip2_force, _x.tip3_force))
00105     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00106     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00107 
00108   def deserialize_numpy(self, str, numpy):
00109     """
00110     unpack serialized message in str into this message instance using numpy for array types
00111     :param str: byte array of serialized message, ``str``
00112     :param numpy: numpy python module
00113     """
00114     try:
00115       if self.time_elapsed is None:
00116         self.time_elapsed = genpy.Duration()
00117       end = 0
00118       _x = self
00119       start = end
00120       end += 21
00121       (_x.time_elapsed.secs, _x.time_elapsed.nsecs, _x.grasped, _x.tip1_force, _x.tip2_force, _x.tip3_force,) = _struct_2iB3f.unpack(str[start:end])
00122       self.grasped = bool(self.grasped)
00123       self.time_elapsed.canon()
00124       return self
00125     except struct.error as e:
00126       raise genpy.DeserializationError(e) #most likely buffer underfill
00127 
00128 _struct_I = genpy.struct_I
00129 _struct_2iB3f = struct.Struct("<2iB3f")


srs_assisted_grasping_msgs
Author(s): Zdenek Materna
autogenerated on Mon Oct 6 2014 07:57:12