_AmtecState.py
Go to the documentation of this file.
00001 """autogenerated by genpy from amtec/AmtecState.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 std_msgs.msg
00008 
00009 class AmtecState(genpy.Message):
00010   _md5sum = "19ace19cde5aea661ada2f628e7afeab"
00011   _type = "amtec/AmtecState"
00012   _has_header = True #flag to mark the presence of a Header object
00013   _full_text = """#
00014 # Message for the state of the amtec powercube pan/tilt unit. 
00015 #
00016 Header  header         # header
00017 uint32  state          # module state
00018 float64 position       # module angle in radians
00019 float64 velocity       # module velocity in radians/s
00020 ================================================================================
00021 MSG: std_msgs/Header
00022 # Standard metadata for higher-level stamped data types.
00023 # This is generally used to communicate timestamped data 
00024 # in a particular coordinate frame.
00025 # 
00026 # sequence ID: consecutively increasing ID 
00027 uint32 seq
00028 #Two-integer timestamp that is expressed as:
00029 # * stamp.secs: seconds (stamp_secs) since epoch
00030 # * stamp.nsecs: nanoseconds since stamp_secs
00031 # time-handling sugar is provided by the client library
00032 time stamp
00033 #Frame this data is associated with
00034 # 0: no frame
00035 # 1: global frame
00036 string frame_id
00037 
00038 """
00039   __slots__ = ['header','state','position','velocity']
00040   _slot_types = ['std_msgs/Header','uint32','float64','float64']
00041 
00042   def __init__(self, *args, **kwds):
00043     """
00044     Constructor. Any message fields that are implicitly/explicitly
00045     set to None will be assigned a default value. The recommend
00046     use is keyword arguments as this is more robust to future message
00047     changes.  You cannot mix in-order arguments and keyword arguments.
00048 
00049     The available fields are:
00050        header,state,position,velocity
00051 
00052     :param args: complete set of field values, in .msg order
00053     :param kwds: use keyword arguments corresponding to message field names
00054     to set specific fields.
00055     """
00056     if args or kwds:
00057       super(AmtecState, self).__init__(*args, **kwds)
00058       #message fields cannot be None, assign default values for those that are
00059       if self.header is None:
00060         self.header = std_msgs.msg.Header()
00061       if self.state is None:
00062         self.state = 0
00063       if self.position is None:
00064         self.position = 0.
00065       if self.velocity is None:
00066         self.velocity = 0.
00067     else:
00068       self.header = std_msgs.msg.Header()
00069       self.state = 0
00070       self.position = 0.
00071       self.velocity = 0.
00072 
00073   def _get_types(self):
00074     """
00075     internal API method
00076     """
00077     return self._slot_types
00078 
00079   def serialize(self, buff):
00080     """
00081     serialize message into buffer
00082     :param buff: buffer, ``StringIO``
00083     """
00084     try:
00085       _x = self
00086       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00087       _x = self.header.frame_id
00088       length = len(_x)
00089       if python3 or type(_x) == unicode:
00090         _x = _x.encode('utf-8')
00091         length = len(_x)
00092       buff.write(struct.pack('<I%ss'%length, length, _x))
00093       _x = self
00094       buff.write(_struct_I2d.pack(_x.state, _x.position, _x.velocity))
00095     except struct.error as se: self._check_types(se)
00096     except TypeError as te: self._check_types(te)
00097 
00098   def deserialize(self, str):
00099     """
00100     unpack serialized message in str into this message instance
00101     :param str: byte array of serialized message, ``str``
00102     """
00103     try:
00104       if self.header is None:
00105         self.header = std_msgs.msg.Header()
00106       end = 0
00107       _x = self
00108       start = end
00109       end += 12
00110       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00111       start = end
00112       end += 4
00113       (length,) = _struct_I.unpack(str[start:end])
00114       start = end
00115       end += length
00116       if python3:
00117         self.header.frame_id = str[start:end].decode('utf-8')
00118       else:
00119         self.header.frame_id = str[start:end]
00120       _x = self
00121       start = end
00122       end += 20
00123       (_x.state, _x.position, _x.velocity,) = _struct_I2d.unpack(str[start:end])
00124       return self
00125     except struct.error as e:
00126       raise genpy.DeserializationError(e) #most likely buffer underfill
00127 
00128 
00129   def serialize_numpy(self, buff, numpy):
00130     """
00131     serialize message with numpy array types into buffer
00132     :param buff: buffer, ``StringIO``
00133     :param numpy: numpy python module
00134     """
00135     try:
00136       _x = self
00137       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00138       _x = self.header.frame_id
00139       length = len(_x)
00140       if python3 or type(_x) == unicode:
00141         _x = _x.encode('utf-8')
00142         length = len(_x)
00143       buff.write(struct.pack('<I%ss'%length, length, _x))
00144       _x = self
00145       buff.write(_struct_I2d.pack(_x.state, _x.position, _x.velocity))
00146     except struct.error as se: self._check_types(se)
00147     except TypeError as te: self._check_types(te)
00148 
00149   def deserialize_numpy(self, str, numpy):
00150     """
00151     unpack serialized message in str into this message instance using numpy for array types
00152     :param str: byte array of serialized message, ``str``
00153     :param numpy: numpy python module
00154     """
00155     try:
00156       if self.header is None:
00157         self.header = std_msgs.msg.Header()
00158       end = 0
00159       _x = self
00160       start = end
00161       end += 12
00162       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00163       start = end
00164       end += 4
00165       (length,) = _struct_I.unpack(str[start:end])
00166       start = end
00167       end += length
00168       if python3:
00169         self.header.frame_id = str[start:end].decode('utf-8')
00170       else:
00171         self.header.frame_id = str[start:end]
00172       _x = self
00173       start = end
00174       end += 20
00175       (_x.state, _x.position, _x.velocity,) = _struct_I2d.unpack(str[start:end])
00176       return self
00177     except struct.error as e:
00178       raise genpy.DeserializationError(e) #most likely buffer underfill
00179 
00180 _struct_I = genpy.struct_I
00181 _struct_3I = struct.Struct("<3I")
00182 _struct_I2d = struct.Struct("<I2d")


amtec
Author(s): Charles DuHadway, Benjamin Pitzer (Maintained by Benjamin Pitzer)
autogenerated on Sat Dec 28 2013 16:49:55