00001 """autogenerated by genmsg_py from JointTrajectoryPoint.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005 import roslib.rostime
00006
00007 class JointTrajectoryPoint(roslib.message.Message):
00008 _md5sum = "84fd2dcf68773c3dc0e9db894f4e8b40"
00009 _type = "trajectory_msgs/JointTrajectoryPoint"
00010 _has_header = False
00011 _full_text = """float64[] positions
00012 float64[] velocities
00013 float64[] accelerations
00014 duration time_from_start
00015 """
00016 __slots__ = ['positions','velocities','accelerations','time_from_start']
00017 _slot_types = ['float64[]','float64[]','float64[]','duration']
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 positions,velocities,accelerations,time_from_start
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(JointTrajectoryPoint, self).__init__(*args, **kwds)
00035
00036 if self.positions is None:
00037 self.positions = []
00038 if self.velocities is None:
00039 self.velocities = []
00040 if self.accelerations is None:
00041 self.accelerations = []
00042 if self.time_from_start is None:
00043 self.time_from_start = roslib.rostime.Duration()
00044 else:
00045 self.positions = []
00046 self.velocities = []
00047 self.accelerations = []
00048 self.time_from_start = roslib.rostime.Duration()
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 length = len(self.positions)
00064 buff.write(_struct_I.pack(length))
00065 pattern = '<%sd'%length
00066 buff.write(struct.pack(pattern, *self.positions))
00067 length = len(self.velocities)
00068 buff.write(_struct_I.pack(length))
00069 pattern = '<%sd'%length
00070 buff.write(struct.pack(pattern, *self.velocities))
00071 length = len(self.accelerations)
00072 buff.write(_struct_I.pack(length))
00073 pattern = '<%sd'%length
00074 buff.write(struct.pack(pattern, *self.accelerations))
00075 _x = self
00076 buff.write(_struct_2i.pack(_x.time_from_start.secs, _x.time_from_start.nsecs))
00077 except struct.error, se: self._check_types(se)
00078 except TypeError, te: self._check_types(te)
00079
00080 def deserialize(self, str):
00081 """
00082 unpack serialized message in str into this message instance
00083 @param str: byte array of serialized message
00084 @type str: str
00085 """
00086 try:
00087 if self.time_from_start is None:
00088 self.time_from_start = roslib.rostime.Duration()
00089 end = 0
00090 start = end
00091 end += 4
00092 (length,) = _struct_I.unpack(str[start:end])
00093 pattern = '<%sd'%length
00094 start = end
00095 end += struct.calcsize(pattern)
00096 self.positions = struct.unpack(pattern, str[start:end])
00097 start = end
00098 end += 4
00099 (length,) = _struct_I.unpack(str[start:end])
00100 pattern = '<%sd'%length
00101 start = end
00102 end += struct.calcsize(pattern)
00103 self.velocities = struct.unpack(pattern, str[start:end])
00104 start = end
00105 end += 4
00106 (length,) = _struct_I.unpack(str[start:end])
00107 pattern = '<%sd'%length
00108 start = end
00109 end += struct.calcsize(pattern)
00110 self.accelerations = struct.unpack(pattern, str[start:end])
00111 _x = self
00112 start = end
00113 end += 8
00114 (_x.time_from_start.secs, _x.time_from_start.nsecs,) = _struct_2i.unpack(str[start:end])
00115 self.time_from_start.canon()
00116 return self
00117 except struct.error, e:
00118 raise roslib.message.DeserializationError(e)
00119
00120
00121 def serialize_numpy(self, buff, numpy):
00122 """
00123 serialize message with numpy array types into buffer
00124 @param buff: buffer
00125 @type buff: StringIO
00126 @param numpy: numpy python module
00127 @type numpy module
00128 """
00129 try:
00130 length = len(self.positions)
00131 buff.write(_struct_I.pack(length))
00132 pattern = '<%sd'%length
00133 buff.write(self.positions.tostring())
00134 length = len(self.velocities)
00135 buff.write(_struct_I.pack(length))
00136 pattern = '<%sd'%length
00137 buff.write(self.velocities.tostring())
00138 length = len(self.accelerations)
00139 buff.write(_struct_I.pack(length))
00140 pattern = '<%sd'%length
00141 buff.write(self.accelerations.tostring())
00142 _x = self
00143 buff.write(_struct_2i.pack(_x.time_from_start.secs, _x.time_from_start.nsecs))
00144 except struct.error, se: self._check_types(se)
00145 except TypeError, te: self._check_types(te)
00146
00147 def deserialize_numpy(self, str, numpy):
00148 """
00149 unpack serialized message in str into this message instance using numpy for array types
00150 @param str: byte array of serialized message
00151 @type str: str
00152 @param numpy: numpy python module
00153 @type numpy: module
00154 """
00155 try:
00156 if self.time_from_start is None:
00157 self.time_from_start = roslib.rostime.Duration()
00158 end = 0
00159 start = end
00160 end += 4
00161 (length,) = _struct_I.unpack(str[start:end])
00162 pattern = '<%sd'%length
00163 start = end
00164 end += struct.calcsize(pattern)
00165 self.positions = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00166 start = end
00167 end += 4
00168 (length,) = _struct_I.unpack(str[start:end])
00169 pattern = '<%sd'%length
00170 start = end
00171 end += struct.calcsize(pattern)
00172 self.velocities = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00173 start = end
00174 end += 4
00175 (length,) = _struct_I.unpack(str[start:end])
00176 pattern = '<%sd'%length
00177 start = end
00178 end += struct.calcsize(pattern)
00179 self.accelerations = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00180 _x = self
00181 start = end
00182 end += 8
00183 (_x.time_from_start.secs, _x.time_from_start.nsecs,) = _struct_2i.unpack(str[start:end])
00184 self.time_from_start.canon()
00185 return self
00186 except struct.error, e:
00187 raise roslib.message.DeserializationError(e)
00188
00189 _struct_I = roslib.message.struct_I
00190 _struct_2i = struct.Struct("<2i")