_cartesian_moves.py
Go to the documentation of this file.
00001 """autogenerated by genpy from arm/cartesian_moves.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006 
00007 import arm.msg
00008 import genpy
00009 import std_msgs.msg
00010 
00011 class cartesian_moves(genpy.Message):
00012   _md5sum = "56c11a250225b8cc4f58b0e6670caaa1"
00013   _type = "arm/cartesian_moves"
00014   _has_header = True #flag to mark the presence of a Header object
00015   _full_text = """# Cartesian movement sequence message
00016 Header header
00017 time end
00018 cartesian_move[] moves
00019 ================================================================================
00020 MSG: std_msgs/Header
00021 # Standard metadata for higher-level stamped data types.
00022 # This is generally used to communicate timestamped data 
00023 # in a particular coordinate frame.
00024 # 
00025 # sequence ID: consecutively increasing ID 
00026 uint32 seq
00027 #Two-integer timestamp that is expressed as:
00028 # * stamp.secs: seconds (stamp_secs) since epoch
00029 # * stamp.nsecs: nanoseconds since stamp_secs
00030 # time-handling sugar is provided by the client library
00031 time stamp
00032 #Frame this data is associated with
00033 # 0: no frame
00034 # 1: global frame
00035 string frame_id
00036 
00037 ================================================================================
00038 MSG: arm/cartesian_move
00039 # Cartesian movement message
00040 Header header
00041 float32[7] positions
00042 int8[7] speeds
00043 """
00044   __slots__ = ['header','end','moves']
00045   _slot_types = ['std_msgs/Header','time','arm/cartesian_move[]']
00046 
00047   def __init__(self, *args, **kwds):
00048     """
00049     Constructor. Any message fields that are implicitly/explicitly
00050     set to None will be assigned a default value. The recommend
00051     use is keyword arguments as this is more robust to future message
00052     changes.  You cannot mix in-order arguments and keyword arguments.
00053 
00054     The available fields are:
00055        header,end,moves
00056 
00057     :param args: complete set of field values, in .msg order
00058     :param kwds: use keyword arguments corresponding to message field names
00059     to set specific fields.
00060     """
00061     if args or kwds:
00062       super(cartesian_moves, self).__init__(*args, **kwds)
00063       #message fields cannot be None, assign default values for those that are
00064       if self.header is None:
00065         self.header = std_msgs.msg.Header()
00066       if self.end is None:
00067         self.end = genpy.Time()
00068       if self.moves is None:
00069         self.moves = []
00070     else:
00071       self.header = std_msgs.msg.Header()
00072       self.end = genpy.Time()
00073       self.moves = []
00074 
00075   def _get_types(self):
00076     """
00077     internal API method
00078     """
00079     return self._slot_types
00080 
00081   def serialize(self, buff):
00082     """
00083     serialize message into buffer
00084     :param buff: buffer, ``StringIO``
00085     """
00086     try:
00087       _x = self
00088       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00089       _x = self.header.frame_id
00090       length = len(_x)
00091       if python3 or type(_x) == unicode:
00092         _x = _x.encode('utf-8')
00093         length = len(_x)
00094       buff.write(struct.pack('<I%ss'%length, length, _x))
00095       _x = self
00096       buff.write(_struct_2I.pack(_x.end.secs, _x.end.nsecs))
00097       length = len(self.moves)
00098       buff.write(_struct_I.pack(length))
00099       for val1 in self.moves:
00100         _v1 = val1.header
00101         buff.write(_struct_I.pack(_v1.seq))
00102         _v2 = _v1.stamp
00103         _x = _v2
00104         buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00105         _x = _v1.frame_id
00106         length = len(_x)
00107         if python3 or type(_x) == unicode:
00108           _x = _x.encode('utf-8')
00109           length = len(_x)
00110         buff.write(struct.pack('<I%ss'%length, length, _x))
00111         buff.write(_struct_7f.pack(*val1.positions))
00112         buff.write(_struct_7b.pack(*val1.speeds))
00113     except struct.error as se: self._check_types(se)
00114     except TypeError as te: self._check_types(te)
00115 
00116   def deserialize(self, str):
00117     """
00118     unpack serialized message in str into this message instance
00119     :param str: byte array of serialized message, ``str``
00120     """
00121     try:
00122       if self.header is None:
00123         self.header = std_msgs.msg.Header()
00124       if self.end is None:
00125         self.end = genpy.Time()
00126       if self.moves is None:
00127         self.moves = None
00128       end = 0
00129       _x = self
00130       start = end
00131       end += 12
00132       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00133       start = end
00134       end += 4
00135       (length,) = _struct_I.unpack(str[start:end])
00136       start = end
00137       end += length
00138       if python3:
00139         self.header.frame_id = str[start:end].decode('utf-8')
00140       else:
00141         self.header.frame_id = str[start:end]
00142       _x = self
00143       start = end
00144       end += 8
00145       (_x.end.secs, _x.end.nsecs,) = _struct_2I.unpack(str[start:end])
00146       start = end
00147       end += 4
00148       (length,) = _struct_I.unpack(str[start:end])
00149       self.moves = []
00150       for i in range(0, length):
00151         val1 = arm.msg.cartesian_move()
00152         _v3 = val1.header
00153         start = end
00154         end += 4
00155         (_v3.seq,) = _struct_I.unpack(str[start:end])
00156         _v4 = _v3.stamp
00157         _x = _v4
00158         start = end
00159         end += 8
00160         (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00161         start = end
00162         end += 4
00163         (length,) = _struct_I.unpack(str[start:end])
00164         start = end
00165         end += length
00166         if python3:
00167           _v3.frame_id = str[start:end].decode('utf-8')
00168         else:
00169           _v3.frame_id = str[start:end]
00170         start = end
00171         end += 28
00172         val1.positions = _struct_7f.unpack(str[start:end])
00173         start = end
00174         end += 7
00175         val1.speeds = _struct_7b.unpack(str[start:end])
00176         self.moves.append(val1)
00177       self.end.canon()
00178       return self
00179     except struct.error as e:
00180       raise genpy.DeserializationError(e) #most likely buffer underfill
00181 
00182 
00183   def serialize_numpy(self, buff, numpy):
00184     """
00185     serialize message with numpy array types into buffer
00186     :param buff: buffer, ``StringIO``
00187     :param numpy: numpy python module
00188     """
00189     try:
00190       _x = self
00191       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00192       _x = self.header.frame_id
00193       length = len(_x)
00194       if python3 or type(_x) == unicode:
00195         _x = _x.encode('utf-8')
00196         length = len(_x)
00197       buff.write(struct.pack('<I%ss'%length, length, _x))
00198       _x = self
00199       buff.write(_struct_2I.pack(_x.end.secs, _x.end.nsecs))
00200       length = len(self.moves)
00201       buff.write(_struct_I.pack(length))
00202       for val1 in self.moves:
00203         _v5 = val1.header
00204         buff.write(_struct_I.pack(_v5.seq))
00205         _v6 = _v5.stamp
00206         _x = _v6
00207         buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00208         _x = _v5.frame_id
00209         length = len(_x)
00210         if python3 or type(_x) == unicode:
00211           _x = _x.encode('utf-8')
00212           length = len(_x)
00213         buff.write(struct.pack('<I%ss'%length, length, _x))
00214         buff.write(val1.positions.tostring())
00215         buff.write(val1.speeds.tostring())
00216     except struct.error as se: self._check_types(se)
00217     except TypeError as te: self._check_types(te)
00218 
00219   def deserialize_numpy(self, str, numpy):
00220     """
00221     unpack serialized message in str into this message instance using numpy for array types
00222     :param str: byte array of serialized message, ``str``
00223     :param numpy: numpy python module
00224     """
00225     try:
00226       if self.header is None:
00227         self.header = std_msgs.msg.Header()
00228       if self.end is None:
00229         self.end = genpy.Time()
00230       if self.moves is None:
00231         self.moves = None
00232       end = 0
00233       _x = self
00234       start = end
00235       end += 12
00236       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00237       start = end
00238       end += 4
00239       (length,) = _struct_I.unpack(str[start:end])
00240       start = end
00241       end += length
00242       if python3:
00243         self.header.frame_id = str[start:end].decode('utf-8')
00244       else:
00245         self.header.frame_id = str[start:end]
00246       _x = self
00247       start = end
00248       end += 8
00249       (_x.end.secs, _x.end.nsecs,) = _struct_2I.unpack(str[start:end])
00250       start = end
00251       end += 4
00252       (length,) = _struct_I.unpack(str[start:end])
00253       self.moves = []
00254       for i in range(0, length):
00255         val1 = arm.msg.cartesian_move()
00256         _v7 = val1.header
00257         start = end
00258         end += 4
00259         (_v7.seq,) = _struct_I.unpack(str[start:end])
00260         _v8 = _v7.stamp
00261         _x = _v8
00262         start = end
00263         end += 8
00264         (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00265         start = end
00266         end += 4
00267         (length,) = _struct_I.unpack(str[start:end])
00268         start = end
00269         end += length
00270         if python3:
00271           _v7.frame_id = str[start:end].decode('utf-8')
00272         else:
00273           _v7.frame_id = str[start:end]
00274         start = end
00275         end += 28
00276         val1.positions = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=7)
00277         start = end
00278         end += 7
00279         val1.speeds = numpy.frombuffer(str[start:end], dtype=numpy.int8, count=7)
00280         self.moves.append(val1)
00281       self.end.canon()
00282       return self
00283     except struct.error as e:
00284       raise genpy.DeserializationError(e) #most likely buffer underfill
00285 
00286 _struct_I = genpy.struct_I
00287 _struct_7f = struct.Struct("<7f")
00288 _struct_3I = struct.Struct("<3I")
00289 _struct_2I = struct.Struct("<2I")
00290 _struct_7b = struct.Struct("<7b")


arm
Author(s): Jonathan Hasenzahl
autogenerated on Sun Jan 5 2014 11:12:32