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