$search
00001 """autogenerated by genmsg_py from SplineTrajectory.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import roslib.rostime 00006 import spline_smoother.msg 00007 import std_msgs.msg 00008 00009 class SplineTrajectory(roslib.message.Message): 00010 _md5sum = "45d783dc5c58ac7ae093c93ba1b8d451" 00011 _type = "spline_smoother/SplineTrajectory" 00012 _has_header = True #flag to mark the presence of a Header object 00013 _full_text = """Header header 00014 string[] names 00015 SplineTrajectorySegment[] segments 00016 00017 ================================================================================ 00018 MSG: std_msgs/Header 00019 # Standard metadata for higher-level stamped data types. 00020 # This is generally used to communicate timestamped data 00021 # in a particular coordinate frame. 00022 # 00023 # sequence ID: consecutively increasing ID 00024 uint32 seq 00025 #Two-integer timestamp that is expressed as: 00026 # * stamp.secs: seconds (stamp_secs) since epoch 00027 # * stamp.nsecs: nanoseconds since stamp_secs 00028 # time-handling sugar is provided by the client library 00029 time stamp 00030 #Frame this data is associated with 00031 # 0: no frame 00032 # 1: global frame 00033 string frame_id 00034 00035 ================================================================================ 00036 MSG: spline_smoother/SplineTrajectorySegment 00037 duration duration 00038 SplineCoefficients[] joints 00039 00040 ================================================================================ 00041 MSG: spline_smoother/SplineCoefficients 00042 float64[] coefficients 00043 00044 """ 00045 __slots__ = ['header','names','segments'] 00046 _slot_types = ['Header','string[]','spline_smoother/SplineTrajectorySegment[]'] 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,names,segments 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(SplineTrajectory, self).__init__(*args, **kwds) 00064 #message fields cannot be None, assign default values for those that are 00065 if self.header is None: 00066 self.header = std_msgs.msg._Header.Header() 00067 if self.names is None: 00068 self.names = [] 00069 if self.segments is None: 00070 self.segments = [] 00071 else: 00072 self.header = std_msgs.msg._Header.Header() 00073 self.names = [] 00074 self.segments = [] 00075 00076 def _get_types(self): 00077 """ 00078 internal API method 00079 """ 00080 return self._slot_types 00081 00082 def serialize(self, buff): 00083 """ 00084 serialize message into buffer 00085 @param buff: buffer 00086 @type buff: StringIO 00087 """ 00088 try: 00089 _x = self 00090 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00091 _x = self.header.frame_id 00092 length = len(_x) 00093 buff.write(struct.pack('<I%ss'%length, length, _x)) 00094 length = len(self.names) 00095 buff.write(_struct_I.pack(length)) 00096 for val1 in self.names: 00097 length = len(val1) 00098 buff.write(struct.pack('<I%ss'%length, length, val1)) 00099 length = len(self.segments) 00100 buff.write(_struct_I.pack(length)) 00101 for val1 in self.segments: 00102 _v1 = val1.duration 00103 _x = _v1 00104 buff.write(_struct_2i.pack(_x.secs, _x.nsecs)) 00105 length = len(val1.joints) 00106 buff.write(_struct_I.pack(length)) 00107 for val2 in val1.joints: 00108 length = len(val2.coefficients) 00109 buff.write(_struct_I.pack(length)) 00110 pattern = '<%sd'%length 00111 buff.write(struct.pack(pattern, *val2.coefficients)) 00112 except struct.error as se: self._check_types(se) 00113 except TypeError as te: self._check_types(te) 00114 00115 def deserialize(self, str): 00116 """ 00117 unpack serialized message in str into this message instance 00118 @param str: byte array of serialized message 00119 @type str: str 00120 """ 00121 try: 00122 if self.header is None: 00123 self.header = std_msgs.msg._Header.Header() 00124 end = 0 00125 _x = self 00126 start = end 00127 end += 12 00128 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00129 start = end 00130 end += 4 00131 (length,) = _struct_I.unpack(str[start:end]) 00132 start = end 00133 end += length 00134 self.header.frame_id = str[start:end] 00135 start = end 00136 end += 4 00137 (length,) = _struct_I.unpack(str[start:end]) 00138 self.names = [] 00139 for i in range(0, length): 00140 start = end 00141 end += 4 00142 (length,) = _struct_I.unpack(str[start:end]) 00143 start = end 00144 end += length 00145 val1 = str[start:end] 00146 self.names.append(val1) 00147 start = end 00148 end += 4 00149 (length,) = _struct_I.unpack(str[start:end]) 00150 self.segments = [] 00151 for i in range(0, length): 00152 val1 = spline_smoother.msg.SplineTrajectorySegment() 00153 _v2 = val1.duration 00154 _x = _v2 00155 start = end 00156 end += 8 00157 (_x.secs, _x.nsecs,) = _struct_2i.unpack(str[start:end]) 00158 start = end 00159 end += 4 00160 (length,) = _struct_I.unpack(str[start:end]) 00161 val1.joints = [] 00162 for i in range(0, length): 00163 val2 = spline_smoother.msg.SplineCoefficients() 00164 start = end 00165 end += 4 00166 (length,) = _struct_I.unpack(str[start:end]) 00167 pattern = '<%sd'%length 00168 start = end 00169 end += struct.calcsize(pattern) 00170 val2.coefficients = struct.unpack(pattern, str[start:end]) 00171 val1.joints.append(val2) 00172 self.segments.append(val1) 00173 return self 00174 except struct.error as e: 00175 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00176 00177 00178 def serialize_numpy(self, buff, numpy): 00179 """ 00180 serialize message with numpy array types into buffer 00181 @param buff: buffer 00182 @type buff: StringIO 00183 @param numpy: numpy python module 00184 @type numpy module 00185 """ 00186 try: 00187 _x = self 00188 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00189 _x = self.header.frame_id 00190 length = len(_x) 00191 buff.write(struct.pack('<I%ss'%length, length, _x)) 00192 length = len(self.names) 00193 buff.write(_struct_I.pack(length)) 00194 for val1 in self.names: 00195 length = len(val1) 00196 buff.write(struct.pack('<I%ss'%length, length, val1)) 00197 length = len(self.segments) 00198 buff.write(_struct_I.pack(length)) 00199 for val1 in self.segments: 00200 _v3 = val1.duration 00201 _x = _v3 00202 buff.write(_struct_2i.pack(_x.secs, _x.nsecs)) 00203 length = len(val1.joints) 00204 buff.write(_struct_I.pack(length)) 00205 for val2 in val1.joints: 00206 length = len(val2.coefficients) 00207 buff.write(_struct_I.pack(length)) 00208 pattern = '<%sd'%length 00209 buff.write(val2.coefficients.tostring()) 00210 except struct.error as se: self._check_types(se) 00211 except TypeError as te: self._check_types(te) 00212 00213 def deserialize_numpy(self, str, numpy): 00214 """ 00215 unpack serialized message in str into this message instance using numpy for array types 00216 @param str: byte array of serialized message 00217 @type str: str 00218 @param numpy: numpy python module 00219 @type numpy: module 00220 """ 00221 try: 00222 if self.header is None: 00223 self.header = std_msgs.msg._Header.Header() 00224 end = 0 00225 _x = self 00226 start = end 00227 end += 12 00228 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00229 start = end 00230 end += 4 00231 (length,) = _struct_I.unpack(str[start:end]) 00232 start = end 00233 end += length 00234 self.header.frame_id = str[start:end] 00235 start = end 00236 end += 4 00237 (length,) = _struct_I.unpack(str[start:end]) 00238 self.names = [] 00239 for i in range(0, length): 00240 start = end 00241 end += 4 00242 (length,) = _struct_I.unpack(str[start:end]) 00243 start = end 00244 end += length 00245 val1 = str[start:end] 00246 self.names.append(val1) 00247 start = end 00248 end += 4 00249 (length,) = _struct_I.unpack(str[start:end]) 00250 self.segments = [] 00251 for i in range(0, length): 00252 val1 = spline_smoother.msg.SplineTrajectorySegment() 00253 _v4 = val1.duration 00254 _x = _v4 00255 start = end 00256 end += 8 00257 (_x.secs, _x.nsecs,) = _struct_2i.unpack(str[start:end]) 00258 start = end 00259 end += 4 00260 (length,) = _struct_I.unpack(str[start:end]) 00261 val1.joints = [] 00262 for i in range(0, length): 00263 val2 = spline_smoother.msg.SplineCoefficients() 00264 start = end 00265 end += 4 00266 (length,) = _struct_I.unpack(str[start:end]) 00267 pattern = '<%sd'%length 00268 start = end 00269 end += struct.calcsize(pattern) 00270 val2.coefficients = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length) 00271 val1.joints.append(val2) 00272 self.segments.append(val1) 00273 return self 00274 except struct.error as e: 00275 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00276 00277 _struct_I = roslib.message.struct_I 00278 _struct_3I = struct.Struct("<3I") 00279 _struct_2i = struct.Struct("<2i")