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