00001 """autogenerated by genmsg_py from JointPositionData.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005
00006 class JointPositionData(roslib.message.Message):
00007 _md5sum = "20b7d551f5d22afac44b59b748c57bdb"
00008 _type = "joint_qualification_controllers/JointPositionData"
00009 _has_header = False
00010 _full_text = """float32[] time
00011 float32[] position
00012 float32[] velocity
00013 float32[] effort
00014 """
00015 __slots__ = ['time','position','velocity','effort']
00016 _slot_types = ['float32[]','float32[]','float32[]','float32[]']
00017
00018 def __init__(self, *args, **kwds):
00019 """
00020 Constructor. Any message fields that are implicitly/explicitly
00021 set to None will be assigned a default value. The recommend
00022 use is keyword arguments as this is more robust to future message
00023 changes. You cannot mix in-order arguments and keyword arguments.
00024
00025 The available fields are:
00026 time,position,velocity,effort
00027
00028 @param args: complete set of field values, in .msg order
00029 @param kwds: use keyword arguments corresponding to message field names
00030 to set specific fields.
00031 """
00032 if args or kwds:
00033 super(JointPositionData, self).__init__(*args, **kwds)
00034
00035 if self.time is None:
00036 self.time = []
00037 if self.position is None:
00038 self.position = []
00039 if self.velocity is None:
00040 self.velocity = []
00041 if self.effort is None:
00042 self.effort = []
00043 else:
00044 self.time = []
00045 self.position = []
00046 self.velocity = []
00047 self.effort = []
00048
00049 def _get_types(self):
00050 """
00051 internal API method
00052 """
00053 return self._slot_types
00054
00055 def serialize(self, buff):
00056 """
00057 serialize message into buffer
00058 @param buff: buffer
00059 @type buff: StringIO
00060 """
00061 try:
00062 length = len(self.time)
00063 buff.write(_struct_I.pack(length))
00064 pattern = '<%sf'%length
00065 buff.write(struct.pack(pattern, *self.time))
00066 length = len(self.position)
00067 buff.write(_struct_I.pack(length))
00068 pattern = '<%sf'%length
00069 buff.write(struct.pack(pattern, *self.position))
00070 length = len(self.velocity)
00071 buff.write(_struct_I.pack(length))
00072 pattern = '<%sf'%length
00073 buff.write(struct.pack(pattern, *self.velocity))
00074 length = len(self.effort)
00075 buff.write(_struct_I.pack(length))
00076 pattern = '<%sf'%length
00077 buff.write(struct.pack(pattern, *self.effort))
00078 except struct.error, se: self._check_types(se)
00079 except TypeError, te: self._check_types(te)
00080
00081 def deserialize(self, str):
00082 """
00083 unpack serialized message in str into this message instance
00084 @param str: byte array of serialized message
00085 @type str: str
00086 """
00087 try:
00088 end = 0
00089 start = end
00090 end += 4
00091 (length,) = _struct_I.unpack(str[start:end])
00092 pattern = '<%sf'%length
00093 start = end
00094 end += struct.calcsize(pattern)
00095 self.time = struct.unpack(pattern, str[start:end])
00096 start = end
00097 end += 4
00098 (length,) = _struct_I.unpack(str[start:end])
00099 pattern = '<%sf'%length
00100 start = end
00101 end += struct.calcsize(pattern)
00102 self.position = struct.unpack(pattern, str[start:end])
00103 start = end
00104 end += 4
00105 (length,) = _struct_I.unpack(str[start:end])
00106 pattern = '<%sf'%length
00107 start = end
00108 end += struct.calcsize(pattern)
00109 self.velocity = struct.unpack(pattern, str[start:end])
00110 start = end
00111 end += 4
00112 (length,) = _struct_I.unpack(str[start:end])
00113 pattern = '<%sf'%length
00114 start = end
00115 end += struct.calcsize(pattern)
00116 self.effort = struct.unpack(pattern, str[start:end])
00117 return self
00118 except struct.error, e:
00119 raise roslib.message.DeserializationError(e)
00120
00121
00122 def serialize_numpy(self, buff, numpy):
00123 """
00124 serialize message with numpy array types into buffer
00125 @param buff: buffer
00126 @type buff: StringIO
00127 @param numpy: numpy python module
00128 @type numpy module
00129 """
00130 try:
00131 length = len(self.time)
00132 buff.write(_struct_I.pack(length))
00133 pattern = '<%sf'%length
00134 buff.write(self.time.tostring())
00135 length = len(self.position)
00136 buff.write(_struct_I.pack(length))
00137 pattern = '<%sf'%length
00138 buff.write(self.position.tostring())
00139 length = len(self.velocity)
00140 buff.write(_struct_I.pack(length))
00141 pattern = '<%sf'%length
00142 buff.write(self.velocity.tostring())
00143 length = len(self.effort)
00144 buff.write(_struct_I.pack(length))
00145 pattern = '<%sf'%length
00146 buff.write(self.effort.tostring())
00147 except struct.error, se: self._check_types(se)
00148 except TypeError, te: self._check_types(te)
00149
00150 def deserialize_numpy(self, str, numpy):
00151 """
00152 unpack serialized message in str into this message instance using numpy for array types
00153 @param str: byte array of serialized message
00154 @type str: str
00155 @param numpy: numpy python module
00156 @type numpy: module
00157 """
00158 try:
00159 end = 0
00160 start = end
00161 end += 4
00162 (length,) = _struct_I.unpack(str[start:end])
00163 pattern = '<%sf'%length
00164 start = end
00165 end += struct.calcsize(pattern)
00166 self.time = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00167 start = end
00168 end += 4
00169 (length,) = _struct_I.unpack(str[start:end])
00170 pattern = '<%sf'%length
00171 start = end
00172 end += struct.calcsize(pattern)
00173 self.position = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00174 start = end
00175 end += 4
00176 (length,) = _struct_I.unpack(str[start:end])
00177 pattern = '<%sf'%length
00178 start = end
00179 end += struct.calcsize(pattern)
00180 self.velocity = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00181 start = end
00182 end += 4
00183 (length,) = _struct_I.unpack(str[start:end])
00184 pattern = '<%sf'%length
00185 start = end
00186 end += struct.calcsize(pattern)
00187 self.effort = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00188 return self
00189 except struct.error, e:
00190 raise roslib.message.DeserializationError(e)
00191
00192 _struct_I = roslib.message.struct_I