_ServoPosition.py
Go to the documentation of this file.
00001 """autogenerated by genpy from PhidgetServo/ServoPosition.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 ServoPosition(genpy.Message):
00009   _md5sum = "04e7b072b763b2e3ee692e3faf7e9c94"
00010   _type = "PhidgetServo/ServoPosition"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """#Deprecated. Prefer to use the one in corobot_msgs package, which is exactly the same
00013 
00014 #
00015 # Morgan Cormier <mcormier@coroware.com>
00016 #
00017 # Message used to set or get the position of a servo motor connected to a Phidget servo controller.
00018 #
00019 # Index is the index of the servo motor connected to the phidget device. 
00020 # The maximum value of index depends on the Phidget device and how many connections it accepts
00021 
00022 int8 index
00023 
00024 # position is the angle in degree set for the motor selected with the index value. 
00025 # position has a minimum and maximum value possible, that can be retrieve through two services
00026 float32 position
00027 
00028 """
00029   __slots__ = ['index','position']
00030   _slot_types = ['int8','float32']
00031 
00032   def __init__(self, *args, **kwds):
00033     """
00034     Constructor. Any message fields that are implicitly/explicitly
00035     set to None will be assigned a default value. The recommend
00036     use is keyword arguments as this is more robust to future message
00037     changes.  You cannot mix in-order arguments and keyword arguments.
00038 
00039     The available fields are:
00040        index,position
00041 
00042     :param args: complete set of field values, in .msg order
00043     :param kwds: use keyword arguments corresponding to message field names
00044     to set specific fields.
00045     """
00046     if args or kwds:
00047       super(ServoPosition, self).__init__(*args, **kwds)
00048       #message fields cannot be None, assign default values for those that are
00049       if self.index is None:
00050         self.index = 0
00051       if self.position is None:
00052         self.position = 0.
00053     else:
00054       self.index = 0
00055       self.position = 0.
00056 
00057   def _get_types(self):
00058     """
00059     internal API method
00060     """
00061     return self._slot_types
00062 
00063   def serialize(self, buff):
00064     """
00065     serialize message into buffer
00066     :param buff: buffer, ``StringIO``
00067     """
00068     try:
00069       _x = self
00070       buff.write(_struct_bf.pack(_x.index, _x.position))
00071     except struct.error as se: self._check_types(se)
00072     except TypeError as te: self._check_types(te)
00073 
00074   def deserialize(self, str):
00075     """
00076     unpack serialized message in str into this message instance
00077     :param str: byte array of serialized message, ``str``
00078     """
00079     try:
00080       end = 0
00081       _x = self
00082       start = end
00083       end += 5
00084       (_x.index, _x.position,) = _struct_bf.unpack(str[start:end])
00085       return self
00086     except struct.error as e:
00087       raise genpy.DeserializationError(e) #most likely buffer underfill
00088 
00089 
00090   def serialize_numpy(self, buff, numpy):
00091     """
00092     serialize message with numpy array types into buffer
00093     :param buff: buffer, ``StringIO``
00094     :param numpy: numpy python module
00095     """
00096     try:
00097       _x = self
00098       buff.write(_struct_bf.pack(_x.index, _x.position))
00099     except struct.error as se: self._check_types(se)
00100     except TypeError as te: self._check_types(te)
00101 
00102   def deserialize_numpy(self, str, numpy):
00103     """
00104     unpack serialized message in str into this message instance using numpy for array types
00105     :param str: byte array of serialized message, ``str``
00106     :param numpy: numpy python module
00107     """
00108     try:
00109       end = 0
00110       _x = self
00111       start = end
00112       end += 5
00113       (_x.index, _x.position,) = _struct_bf.unpack(str[start:end])
00114       return self
00115     except struct.error as e:
00116       raise genpy.DeserializationError(e) #most likely buffer underfill
00117 
00118 _struct_I = genpy.struct_I
00119 _struct_bf = struct.Struct("<bf")


phidget_servo
Author(s):
autogenerated on Wed Aug 26 2015 11:09:46