_MotorCommand.py
Go to the documentation of this file.
00001 """autogenerated by genpy from hector_uav_msgs/MotorCommand.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 std_msgs.msg
00008 
00009 class MotorCommand(genpy.Message):
00010   _md5sum = "ccd4d4d4606731d1c73409e9bfa55808"
00011   _type = "hector_uav_msgs/MotorCommand"
00012   _has_header = True #flag to mark the presence of a Header object
00013   _full_text = """Header header
00014 float32[] force
00015 float32[] torque
00016 float32[] frequency
00017 float32[] voltage
00018 
00019 ================================================================================
00020 MSG: std_msgs/Header
00021 # Standard metadata for higher-level stamped data types.
00022 # This is generally used to communicate timestamped data 
00023 # in a particular coordinate frame.
00024 # 
00025 # sequence ID: consecutively increasing ID 
00026 uint32 seq
00027 #Two-integer timestamp that is expressed as:
00028 # * stamp.secs: seconds (stamp_secs) since epoch
00029 # * stamp.nsecs: nanoseconds since stamp_secs
00030 # time-handling sugar is provided by the client library
00031 time stamp
00032 #Frame this data is associated with
00033 # 0: no frame
00034 # 1: global frame
00035 string frame_id
00036 
00037 """
00038   __slots__ = ['header','force','torque','frequency','voltage']
00039   _slot_types = ['std_msgs/Header','float32[]','float32[]','float32[]','float32[]']
00040 
00041   def __init__(self, *args, **kwds):
00042     """
00043     Constructor. Any message fields that are implicitly/explicitly
00044     set to None will be assigned a default value. The recommend
00045     use is keyword arguments as this is more robust to future message
00046     changes.  You cannot mix in-order arguments and keyword arguments.
00047 
00048     The available fields are:
00049        header,force,torque,frequency,voltage
00050 
00051     :param args: complete set of field values, in .msg order
00052     :param kwds: use keyword arguments corresponding to message field names
00053     to set specific fields.
00054     """
00055     if args or kwds:
00056       super(MotorCommand, self).__init__(*args, **kwds)
00057       #message fields cannot be None, assign default values for those that are
00058       if self.header is None:
00059         self.header = std_msgs.msg.Header()
00060       if self.force is None:
00061         self.force = []
00062       if self.torque is None:
00063         self.torque = []
00064       if self.frequency is None:
00065         self.frequency = []
00066       if self.voltage is None:
00067         self.voltage = []
00068     else:
00069       self.header = std_msgs.msg.Header()
00070       self.force = []
00071       self.torque = []
00072       self.frequency = []
00073       self.voltage = []
00074 
00075   def _get_types(self):
00076     """
00077     internal API method
00078     """
00079     return self._slot_types
00080 
00081   def serialize(self, buff):
00082     """
00083     serialize message into buffer
00084     :param buff: buffer, ``StringIO``
00085     """
00086     try:
00087       _x = self
00088       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00089       _x = self.header.frame_id
00090       length = len(_x)
00091       if python3 or type(_x) == unicode:
00092         _x = _x.encode('utf-8')
00093         length = len(_x)
00094       buff.write(struct.pack('<I%ss'%length, length, _x))
00095       length = len(self.force)
00096       buff.write(_struct_I.pack(length))
00097       pattern = '<%sf'%length
00098       buff.write(struct.pack(pattern, *self.force))
00099       length = len(self.torque)
00100       buff.write(_struct_I.pack(length))
00101       pattern = '<%sf'%length
00102       buff.write(struct.pack(pattern, *self.torque))
00103       length = len(self.frequency)
00104       buff.write(_struct_I.pack(length))
00105       pattern = '<%sf'%length
00106       buff.write(struct.pack(pattern, *self.frequency))
00107       length = len(self.voltage)
00108       buff.write(_struct_I.pack(length))
00109       pattern = '<%sf'%length
00110       buff.write(struct.pack(pattern, *self.voltage))
00111     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00112     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00113 
00114   def deserialize(self, str):
00115     """
00116     unpack serialized message in str into this message instance
00117     :param str: byte array of serialized message, ``str``
00118     """
00119     try:
00120       if self.header is None:
00121         self.header = std_msgs.msg.Header()
00122       end = 0
00123       _x = self
00124       start = end
00125       end += 12
00126       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00127       start = end
00128       end += 4
00129       (length,) = _struct_I.unpack(str[start:end])
00130       start = end
00131       end += length
00132       if python3:
00133         self.header.frame_id = str[start:end].decode('utf-8')
00134       else:
00135         self.header.frame_id = str[start:end]
00136       start = end
00137       end += 4
00138       (length,) = _struct_I.unpack(str[start:end])
00139       pattern = '<%sf'%length
00140       start = end
00141       end += struct.calcsize(pattern)
00142       self.force = struct.unpack(pattern, str[start:end])
00143       start = end
00144       end += 4
00145       (length,) = _struct_I.unpack(str[start:end])
00146       pattern = '<%sf'%length
00147       start = end
00148       end += struct.calcsize(pattern)
00149       self.torque = struct.unpack(pattern, str[start:end])
00150       start = end
00151       end += 4
00152       (length,) = _struct_I.unpack(str[start:end])
00153       pattern = '<%sf'%length
00154       start = end
00155       end += struct.calcsize(pattern)
00156       self.frequency = struct.unpack(pattern, str[start:end])
00157       start = end
00158       end += 4
00159       (length,) = _struct_I.unpack(str[start:end])
00160       pattern = '<%sf'%length
00161       start = end
00162       end += struct.calcsize(pattern)
00163       self.voltage = struct.unpack(pattern, str[start:end])
00164       return self
00165     except struct.error as e:
00166       raise genpy.DeserializationError(e) #most likely buffer underfill
00167 
00168 
00169   def serialize_numpy(self, buff, numpy):
00170     """
00171     serialize message with numpy array types into buffer
00172     :param buff: buffer, ``StringIO``
00173     :param numpy: numpy python module
00174     """
00175     try:
00176       _x = self
00177       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00178       _x = self.header.frame_id
00179       length = len(_x)
00180       if python3 or type(_x) == unicode:
00181         _x = _x.encode('utf-8')
00182         length = len(_x)
00183       buff.write(struct.pack('<I%ss'%length, length, _x))
00184       length = len(self.force)
00185       buff.write(_struct_I.pack(length))
00186       pattern = '<%sf'%length
00187       buff.write(self.force.tostring())
00188       length = len(self.torque)
00189       buff.write(_struct_I.pack(length))
00190       pattern = '<%sf'%length
00191       buff.write(self.torque.tostring())
00192       length = len(self.frequency)
00193       buff.write(_struct_I.pack(length))
00194       pattern = '<%sf'%length
00195       buff.write(self.frequency.tostring())
00196       length = len(self.voltage)
00197       buff.write(_struct_I.pack(length))
00198       pattern = '<%sf'%length
00199       buff.write(self.voltage.tostring())
00200     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00201     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00202 
00203   def deserialize_numpy(self, str, numpy):
00204     """
00205     unpack serialized message in str into this message instance using numpy for array types
00206     :param str: byte array of serialized message, ``str``
00207     :param numpy: numpy python module
00208     """
00209     try:
00210       if self.header is None:
00211         self.header = std_msgs.msg.Header()
00212       end = 0
00213       _x = self
00214       start = end
00215       end += 12
00216       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00217       start = end
00218       end += 4
00219       (length,) = _struct_I.unpack(str[start:end])
00220       start = end
00221       end += length
00222       if python3:
00223         self.header.frame_id = str[start:end].decode('utf-8')
00224       else:
00225         self.header.frame_id = str[start:end]
00226       start = end
00227       end += 4
00228       (length,) = _struct_I.unpack(str[start:end])
00229       pattern = '<%sf'%length
00230       start = end
00231       end += struct.calcsize(pattern)
00232       self.force = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00233       start = end
00234       end += 4
00235       (length,) = _struct_I.unpack(str[start:end])
00236       pattern = '<%sf'%length
00237       start = end
00238       end += struct.calcsize(pattern)
00239       self.torque = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00240       start = end
00241       end += 4
00242       (length,) = _struct_I.unpack(str[start:end])
00243       pattern = '<%sf'%length
00244       start = end
00245       end += struct.calcsize(pattern)
00246       self.frequency = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00247       start = end
00248       end += 4
00249       (length,) = _struct_I.unpack(str[start:end])
00250       pattern = '<%sf'%length
00251       start = end
00252       end += struct.calcsize(pattern)
00253       self.voltage = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00254       return self
00255     except struct.error as e:
00256       raise genpy.DeserializationError(e) #most likely buffer underfill
00257 
00258 _struct_I = genpy.struct_I
00259 _struct_3I = struct.Struct("<3I")


hector_uav_msgs
Author(s): Johannes Meyer
autogenerated on Mon Oct 6 2014 00:29:22