_spatial.py
Go to the documentation of this file.
00001 """autogenerated by genpy from corobot_msgs/spatial.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006 
00007 
00008 class spatial(genpy.Message):
00009   _md5sum = "88d5070ee7206e7a7c6044849f478293"
00010   _type = "corobot_msgs/spatial"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """float32 acc1
00013 float32 acc2
00014 float32 acc3
00015 
00016 float32 ang1
00017 float32 ang2
00018 float32 ang3
00019 
00020 float32 mag1
00021 float32 mag2
00022 float32 mag3
00023 
00024 """
00025   __slots__ = ['acc1','acc2','acc3','ang1','ang2','ang3','mag1','mag2','mag3']
00026   _slot_types = ['float32','float32','float32','float32','float32','float32','float32','float32','float32']
00027 
00028   def __init__(self, *args, **kwds):
00029     """
00030     Constructor. Any message fields that are implicitly/explicitly
00031     set to None will be assigned a default value. The recommend
00032     use is keyword arguments as this is more robust to future message
00033     changes.  You cannot mix in-order arguments and keyword arguments.
00034 
00035     The available fields are:
00036        acc1,acc2,acc3,ang1,ang2,ang3,mag1,mag2,mag3
00037 
00038     :param args: complete set of field values, in .msg order
00039     :param kwds: use keyword arguments corresponding to message field names
00040     to set specific fields.
00041     """
00042     if args or kwds:
00043       super(spatial, self).__init__(*args, **kwds)
00044       #message fields cannot be None, assign default values for those that are
00045       if self.acc1 is None:
00046         self.acc1 = 0.
00047       if self.acc2 is None:
00048         self.acc2 = 0.
00049       if self.acc3 is None:
00050         self.acc3 = 0.
00051       if self.ang1 is None:
00052         self.ang1 = 0.
00053       if self.ang2 is None:
00054         self.ang2 = 0.
00055       if self.ang3 is None:
00056         self.ang3 = 0.
00057       if self.mag1 is None:
00058         self.mag1 = 0.
00059       if self.mag2 is None:
00060         self.mag2 = 0.
00061       if self.mag3 is None:
00062         self.mag3 = 0.
00063     else:
00064       self.acc1 = 0.
00065       self.acc2 = 0.
00066       self.acc3 = 0.
00067       self.ang1 = 0.
00068       self.ang2 = 0.
00069       self.ang3 = 0.
00070       self.mag1 = 0.
00071       self.mag2 = 0.
00072       self.mag3 = 0.
00073 
00074   def _get_types(self):
00075     """
00076     internal API method
00077     """
00078     return self._slot_types
00079 
00080   def serialize(self, buff):
00081     """
00082     serialize message into buffer
00083     :param buff: buffer, ``StringIO``
00084     """
00085     try:
00086       _x = self
00087       buff.write(_struct_9f.pack(_x.acc1, _x.acc2, _x.acc3, _x.ang1, _x.ang2, _x.ang3, _x.mag1, _x.mag2, _x.mag3))
00088     except struct.error as se: self._check_types(se)
00089     except TypeError as te: self._check_types(te)
00090 
00091   def deserialize(self, str):
00092     """
00093     unpack serialized message in str into this message instance
00094     :param str: byte array of serialized message, ``str``
00095     """
00096     try:
00097       end = 0
00098       _x = self
00099       start = end
00100       end += 36
00101       (_x.acc1, _x.acc2, _x.acc3, _x.ang1, _x.ang2, _x.ang3, _x.mag1, _x.mag2, _x.mag3,) = _struct_9f.unpack(str[start:end])
00102       return self
00103     except struct.error as e:
00104       raise genpy.DeserializationError(e) #most likely buffer underfill
00105 
00106 
00107   def serialize_numpy(self, buff, numpy):
00108     """
00109     serialize message with numpy array types into buffer
00110     :param buff: buffer, ``StringIO``
00111     :param numpy: numpy python module
00112     """
00113     try:
00114       _x = self
00115       buff.write(_struct_9f.pack(_x.acc1, _x.acc2, _x.acc3, _x.ang1, _x.ang2, _x.ang3, _x.mag1, _x.mag2, _x.mag3))
00116     except struct.error as se: self._check_types(se)
00117     except TypeError as te: self._check_types(te)
00118 
00119   def deserialize_numpy(self, str, numpy):
00120     """
00121     unpack serialized message in str into this message instance using numpy for array types
00122     :param str: byte array of serialized message, ``str``
00123     :param numpy: numpy python module
00124     """
00125     try:
00126       end = 0
00127       _x = self
00128       start = end
00129       end += 36
00130       (_x.acc1, _x.acc2, _x.acc3, _x.ang1, _x.ang2, _x.ang3, _x.mag1, _x.mag2, _x.mag3,) = _struct_9f.unpack(str[start:end])
00131       return self
00132     except struct.error as e:
00133       raise genpy.DeserializationError(e) #most likely buffer underfill
00134 
00135 _struct_I = genpy.struct_I
00136 _struct_9f = struct.Struct("<9f")


corobot_msgs
Author(s): Morgan Cormier/mcormier@coroware.com
autogenerated on Tue Jan 7 2014 11:38:41