Go to the documentation of this file.00001 """autogenerated by genpy from telekyb_msgs/TKMotorCommands.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 TKMotorCommands(genpy.Message):
00010 _md5sum = "ab0f1d25b62ad7dc5f46804f63d0acf6"
00011 _type = "telekyb_msgs/TKMotorCommands"
00012 _has_header = True
00013 _full_text = """#
00014 # Copyright 2011 Antonio Franchi and Martin Riedel
00015 #
00016 # This file is part of TeleKyb.
00017 #
00018 # TeleKyb is free software: you can redistribute it and/or modify
00019 # it under the terms of the GNU General Public License as published by
00020 # the Free Software Foundation, either version 3 of the License, or
00021 # (at your option) any later version.
00022 #
00023 # TeleKyb is distributed in the hope that it will be useful,
00024 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00025 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00026 # GNU General Public License for more details.
00027 #
00028 # You should have received a copy of the GNU General Public License
00029 # along with TeleKyb. If not, see <http://www.gnu.org/licenses/>.
00030
00031 # Contains the propeller desired thrust force
00032
00033 Header header
00034 float64[] force
00035
00036 ================================================================================
00037 MSG: std_msgs/Header
00038 # Standard metadata for higher-level stamped data types.
00039 # This is generally used to communicate timestamped data
00040 # in a particular coordinate frame.
00041 #
00042 # sequence ID: consecutively increasing ID
00043 uint32 seq
00044 #Two-integer timestamp that is expressed as:
00045 # * stamp.secs: seconds (stamp_secs) since epoch
00046 # * stamp.nsecs: nanoseconds since stamp_secs
00047 # time-handling sugar is provided by the client library
00048 time stamp
00049 #Frame this data is associated with
00050 # 0: no frame
00051 # 1: global frame
00052 string frame_id
00053
00054 """
00055 __slots__ = ['header','force']
00056 _slot_types = ['std_msgs/Header','float64[]']
00057
00058 def __init__(self, *args, **kwds):
00059 """
00060 Constructor. Any message fields that are implicitly/explicitly
00061 set to None will be assigned a default value. The recommend
00062 use is keyword arguments as this is more robust to future message
00063 changes. You cannot mix in-order arguments and keyword arguments.
00064
00065 The available fields are:
00066 header,force
00067
00068 :param args: complete set of field values, in .msg order
00069 :param kwds: use keyword arguments corresponding to message field names
00070 to set specific fields.
00071 """
00072 if args or kwds:
00073 super(TKMotorCommands, self).__init__(*args, **kwds)
00074
00075 if self.header is None:
00076 self.header = std_msgs.msg.Header()
00077 if self.force is None:
00078 self.force = []
00079 else:
00080 self.header = std_msgs.msg.Header()
00081 self.force = []
00082
00083 def _get_types(self):
00084 """
00085 internal API method
00086 """
00087 return self._slot_types
00088
00089 def serialize(self, buff):
00090 """
00091 serialize message into buffer
00092 :param buff: buffer, ``StringIO``
00093 """
00094 try:
00095 _x = self
00096 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00097 _x = self.header.frame_id
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 length = len(self.force)
00104 buff.write(_struct_I.pack(length))
00105 pattern = '<%sd'%length
00106 buff.write(struct.pack(pattern, *self.force))
00107 except struct.error as se: self._check_types(se)
00108 except TypeError as te: self._check_types(te)
00109
00110 def deserialize(self, str):
00111 """
00112 unpack serialized message in str into this message instance
00113 :param str: byte array of serialized message, ``str``
00114 """
00115 try:
00116 if self.header is None:
00117 self.header = std_msgs.msg.Header()
00118 end = 0
00119 _x = self
00120 start = end
00121 end += 12
00122 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00123 start = end
00124 end += 4
00125 (length,) = _struct_I.unpack(str[start:end])
00126 start = end
00127 end += length
00128 if python3:
00129 self.header.frame_id = str[start:end].decode('utf-8')
00130 else:
00131 self.header.frame_id = str[start:end]
00132 start = end
00133 end += 4
00134 (length,) = _struct_I.unpack(str[start:end])
00135 pattern = '<%sd'%length
00136 start = end
00137 end += struct.calcsize(pattern)
00138 self.force = struct.unpack(pattern, str[start:end])
00139 return self
00140 except struct.error as e:
00141 raise genpy.DeserializationError(e)
00142
00143
00144 def serialize_numpy(self, buff, numpy):
00145 """
00146 serialize message with numpy array types into buffer
00147 :param buff: buffer, ``StringIO``
00148 :param numpy: numpy python module
00149 """
00150 try:
00151 _x = self
00152 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00153 _x = self.header.frame_id
00154 length = len(_x)
00155 if python3 or type(_x) == unicode:
00156 _x = _x.encode('utf-8')
00157 length = len(_x)
00158 buff.write(struct.pack('<I%ss'%length, length, _x))
00159 length = len(self.force)
00160 buff.write(_struct_I.pack(length))
00161 pattern = '<%sd'%length
00162 buff.write(self.force.tostring())
00163 except struct.error as se: self._check_types(se)
00164 except TypeError as te: self._check_types(te)
00165
00166 def deserialize_numpy(self, str, numpy):
00167 """
00168 unpack serialized message in str into this message instance using numpy for array types
00169 :param str: byte array of serialized message, ``str``
00170 :param numpy: numpy python module
00171 """
00172 try:
00173 if self.header is None:
00174 self.header = std_msgs.msg.Header()
00175 end = 0
00176 _x = self
00177 start = end
00178 end += 12
00179 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00180 start = end
00181 end += 4
00182 (length,) = _struct_I.unpack(str[start:end])
00183 start = end
00184 end += length
00185 if python3:
00186 self.header.frame_id = str[start:end].decode('utf-8')
00187 else:
00188 self.header.frame_id = str[start:end]
00189 start = end
00190 end += 4
00191 (length,) = _struct_I.unpack(str[start:end])
00192 pattern = '<%sd'%length
00193 start = end
00194 end += struct.calcsize(pattern)
00195 self.force = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00196 return self
00197 except struct.error as e:
00198 raise genpy.DeserializationError(e)
00199
00200 _struct_I = genpy.struct_I
00201 _struct_3I = struct.Struct("<3I")