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


nasa_r2_common_msgs
Author(s): Paul Dinh. Maintained by Jennifer Turner
autogenerated on Mon Oct 6 2014 02:42:34