_CarCommand.py
Go to the documentation of this file.
00001 """autogenerated by genpy from art_msgs/CarCommand.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 art_msgs.msg
00008 import std_msgs.msg
00009 
00010 class CarCommand(genpy.Message):
00011   _md5sum = "a9c426b2a11ce63f7116e941449a149d"
00012   _type = "art_msgs/CarCommand"
00013   _has_header = True #flag to mark the presence of a Header object
00014   _full_text = """# car control command with timestamp
00015 # $Id: CarCommand.msg 1161 2011-03-26 02:10:49Z jack.oquin $
00016 
00017 Header     header
00018 CarControl control
00019 
00020 ================================================================================
00021 MSG: std_msgs/Header
00022 # Standard metadata for higher-level stamped data types.
00023 # This is generally used to communicate timestamped data 
00024 # in a particular coordinate frame.
00025 # 
00026 # sequence ID: consecutively increasing ID 
00027 uint32 seq
00028 #Two-integer timestamp that is expressed as:
00029 # * stamp.secs: seconds (stamp_secs) since epoch
00030 # * stamp.nsecs: nanoseconds since stamp_secs
00031 # time-handling sugar is provided by the client library
00032 time stamp
00033 #Frame this data is associated with
00034 # 0: no frame
00035 # 1: global frame
00036 string frame_id
00037 
00038 ================================================================================
00039 MSG: art_msgs/CarControl
00040 # car control command
00041 # $Id: CarControl.msg 1161 2011-03-26 02:10:49Z jack.oquin $
00042 
00043 float32 velocity                # forward velocity (m/s), negative is reverse
00044 float32 angle                   # steering angle (degrees)
00045 
00046 """
00047   __slots__ = ['header','control']
00048   _slot_types = ['std_msgs/Header','art_msgs/CarControl']
00049 
00050   def __init__(self, *args, **kwds):
00051     """
00052     Constructor. Any message fields that are implicitly/explicitly
00053     set to None will be assigned a default value. The recommend
00054     use is keyword arguments as this is more robust to future message
00055     changes.  You cannot mix in-order arguments and keyword arguments.
00056 
00057     The available fields are:
00058        header,control
00059 
00060     :param args: complete set of field values, in .msg order
00061     :param kwds: use keyword arguments corresponding to message field names
00062     to set specific fields.
00063     """
00064     if args or kwds:
00065       super(CarCommand, self).__init__(*args, **kwds)
00066       #message fields cannot be None, assign default values for those that are
00067       if self.header is None:
00068         self.header = std_msgs.msg.Header()
00069       if self.control is None:
00070         self.control = art_msgs.msg.CarControl()
00071     else:
00072       self.header = std_msgs.msg.Header()
00073       self.control = art_msgs.msg.CarControl()
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       _x = self
00096       buff.write(_struct_2f.pack(_x.control.velocity, _x.control.angle))
00097     except struct.error as se: self._check_types(se)
00098     except TypeError as te: self._check_types(te)
00099 
00100   def deserialize(self, str):
00101     """
00102     unpack serialized message in str into this message instance
00103     :param str: byte array of serialized message, ``str``
00104     """
00105     try:
00106       if self.header is None:
00107         self.header = std_msgs.msg.Header()
00108       if self.control is None:
00109         self.control = art_msgs.msg.CarControl()
00110       end = 0
00111       _x = self
00112       start = end
00113       end += 12
00114       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00115       start = end
00116       end += 4
00117       (length,) = _struct_I.unpack(str[start:end])
00118       start = end
00119       end += length
00120       if python3:
00121         self.header.frame_id = str[start:end].decode('utf-8')
00122       else:
00123         self.header.frame_id = str[start:end]
00124       _x = self
00125       start = end
00126       end += 8
00127       (_x.control.velocity, _x.control.angle,) = _struct_2f.unpack(str[start:end])
00128       return self
00129     except struct.error as e:
00130       raise genpy.DeserializationError(e) #most likely buffer underfill
00131 
00132 
00133   def serialize_numpy(self, buff, numpy):
00134     """
00135     serialize message with numpy array types into buffer
00136     :param buff: buffer, ``StringIO``
00137     :param numpy: numpy python module
00138     """
00139     try:
00140       _x = self
00141       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00142       _x = self.header.frame_id
00143       length = len(_x)
00144       if python3 or type(_x) == unicode:
00145         _x = _x.encode('utf-8')
00146         length = len(_x)
00147       buff.write(struct.pack('<I%ss'%length, length, _x))
00148       _x = self
00149       buff.write(_struct_2f.pack(_x.control.velocity, _x.control.angle))
00150     except struct.error as se: self._check_types(se)
00151     except TypeError as te: self._check_types(te)
00152 
00153   def deserialize_numpy(self, str, numpy):
00154     """
00155     unpack serialized message in str into this message instance using numpy for array types
00156     :param str: byte array of serialized message, ``str``
00157     :param numpy: numpy python module
00158     """
00159     try:
00160       if self.header is None:
00161         self.header = std_msgs.msg.Header()
00162       if self.control is None:
00163         self.control = art_msgs.msg.CarControl()
00164       end = 0
00165       _x = self
00166       start = end
00167       end += 12
00168       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00169       start = end
00170       end += 4
00171       (length,) = _struct_I.unpack(str[start:end])
00172       start = end
00173       end += length
00174       if python3:
00175         self.header.frame_id = str[start:end].decode('utf-8')
00176       else:
00177         self.header.frame_id = str[start:end]
00178       _x = self
00179       start = end
00180       end += 8
00181       (_x.control.velocity, _x.control.angle,) = _struct_2f.unpack(str[start:end])
00182       return self
00183     except struct.error as e:
00184       raise genpy.DeserializationError(e) #most likely buffer underfill
00185 
00186 _struct_I = genpy.struct_I
00187 _struct_3I = struct.Struct("<3I")
00188 _struct_2f = struct.Struct("<2f")
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends


art_msgs
Author(s): Jack O'Quin
autogenerated on Tue Sep 24 2013 10:40:45