00001 """autogenerated by genmsg_py from Velocity.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005
00006 class Velocity(roslib.message.Message):
00007 _md5sum = "9d5c2dcd348ac8f76ce2a4307bd63a13"
00008 _type = "turtlesim/Velocity"
00009 _has_header = False
00010 _full_text = """float32 linear
00011 float32 angular
00012 """
00013 __slots__ = ['linear','angular']
00014 _slot_types = ['float32','float32']
00015
00016 def __init__(self, *args, **kwds):
00017 """
00018 Constructor. Any message fields that are implicitly/explicitly
00019 set to None will be assigned a default value. The recommend
00020 use is keyword arguments as this is more robust to future message
00021 changes. You cannot mix in-order arguments and keyword arguments.
00022
00023 The available fields are:
00024 linear,angular
00025
00026 @param args: complete set of field values, in .msg order
00027 @param kwds: use keyword arguments corresponding to message field names
00028 to set specific fields.
00029 """
00030 if args or kwds:
00031 super(Velocity, self).__init__(*args, **kwds)
00032
00033 if self.linear is None:
00034 self.linear = 0.
00035 if self.angular is None:
00036 self.angular = 0.
00037 else:
00038 self.linear = 0.
00039 self.angular = 0.
00040
00041 def _get_types(self):
00042 """
00043 internal API method
00044 """
00045 return self._slot_types
00046
00047 def serialize(self, buff):
00048 """
00049 serialize message into buffer
00050 @param buff: buffer
00051 @type buff: StringIO
00052 """
00053 try:
00054 _x = self
00055 buff.write(_struct_2f.pack(_x.linear, _x.angular))
00056 except struct.error, se: self._check_types(se)
00057 except TypeError, te: self._check_types(te)
00058
00059 def deserialize(self, str):
00060 """
00061 unpack serialized message in str into this message instance
00062 @param str: byte array of serialized message
00063 @type str: str
00064 """
00065 try:
00066 end = 0
00067 _x = self
00068 start = end
00069 end += 8
00070 (_x.linear, _x.angular,) = _struct_2f.unpack(str[start:end])
00071 return self
00072 except struct.error, e:
00073 raise roslib.message.DeserializationError(e)
00074
00075
00076 def serialize_numpy(self, buff, numpy):
00077 """
00078 serialize message with numpy array types into buffer
00079 @param buff: buffer
00080 @type buff: StringIO
00081 @param numpy: numpy python module
00082 @type numpy module
00083 """
00084 try:
00085 _x = self
00086 buff.write(_struct_2f.pack(_x.linear, _x.angular))
00087 except struct.error, se: self._check_types(se)
00088 except TypeError, te: self._check_types(te)
00089
00090 def deserialize_numpy(self, str, numpy):
00091 """
00092 unpack serialized message in str into this message instance using numpy for array types
00093 @param str: byte array of serialized message
00094 @type str: str
00095 @param numpy: numpy python module
00096 @type numpy: module
00097 """
00098 try:
00099 end = 0
00100 _x = self
00101 start = end
00102 end += 8
00103 (_x.linear, _x.angular,) = _struct_2f.unpack(str[start:end])
00104 return self
00105 except struct.error, e:
00106 raise roslib.message.DeserializationError(e)
00107
00108 _struct_I = roslib.message.struct_I
00109 _struct_2f = struct.Struct("<2f")