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


pr2_msgs
Author(s): Eric Berger and many others
autogenerated on Mon Oct 6 2014 03:30:41