Package eddiebot_node :: Package msg :: Module _Drive
[frames] | no frames]

Source Code for Module eddiebot_node.msg._Drive

  1  """autogenerated by genpy from eddiebot_node/Drive.msg. Do not edit.""" 
  2  import sys 
  3  python3 = True if sys.hexversion > 0x03000000 else False 
  4  import genpy 
  5  import struct 
  6   
  7   
8 -class Drive(genpy.Message):
9 _md5sum = "cbd1637d308acca6b24c12a3db426e5e" 10 _type = "eddiebot_node/Drive" 11 _has_header = False #flag to mark the presence of a Header object 12 _full_text = """float32 velocity 13 float32 radius 14 15 """ 16 __slots__ = ['velocity','radius'] 17 _slot_types = ['float32','float32'] 18
19 - def __init__(self, *args, **kwds):
20 """ 21 Constructor. Any message fields that are implicitly/explicitly 22 set to None will be assigned a default value. The recommend 23 use is keyword arguments as this is more robust to future message 24 changes. You cannot mix in-order arguments and keyword arguments. 25 26 The available fields are: 27 velocity,radius 28 29 :param args: complete set of field values, in .msg order 30 :param kwds: use keyword arguments corresponding to message field names 31 to set specific fields. 32 """ 33 if args or kwds: 34 super(Drive, self).__init__(*args, **kwds) 35 #message fields cannot be None, assign default values for those that are 36 if self.velocity is None: 37 self.velocity = 0. 38 if self.radius is None: 39 self.radius = 0. 40 else: 41 self.velocity = 0. 42 self.radius = 0.
43
44 - def _get_types(self):
45 """ 46 internal API method 47 """ 48 return self._slot_types
49
50 - def serialize(self, buff):
51 """ 52 serialize message into buffer 53 :param buff: buffer, ``StringIO`` 54 """ 55 try: 56 _x = self 57 buff.write(_struct_2f.pack(_x.velocity, _x.radius)) 58 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x)))) 59 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
60
61 - def deserialize(self, str):
62 """ 63 unpack serialized message in str into this message instance 64 :param str: byte array of serialized message, ``str`` 65 """ 66 try: 67 end = 0 68 _x = self 69 start = end 70 end += 8 71 (_x.velocity, _x.radius,) = _struct_2f.unpack(str[start:end]) 72 return self 73 except struct.error as e: 74 raise genpy.DeserializationError(e) #most likely buffer underfill
75 76
77 - def serialize_numpy(self, buff, numpy):
78 """ 79 serialize message with numpy array types into buffer 80 :param buff: buffer, ``StringIO`` 81 :param numpy: numpy python module 82 """ 83 try: 84 _x = self 85 buff.write(_struct_2f.pack(_x.velocity, _x.radius)) 86 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x)))) 87 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
88
89 - def deserialize_numpy(self, str, numpy):
90 """ 91 unpack serialized message in str into this message instance using numpy for array types 92 :param str: byte array of serialized message, ``str`` 93 :param numpy: numpy python module 94 """ 95 try: 96 end = 0 97 _x = self 98 start = end 99 end += 8 100 (_x.velocity, _x.radius,) = _struct_2f.unpack(str[start:end]) 101 return self 102 except struct.error as e: 103 raise genpy.DeserializationError(e) #most likely buffer underfill
104 105 _struct_I = genpy.struct_I 106 _struct_2f = struct.Struct("<2f") 107