00001 """autogenerated by genpy from pr2_mechanism_controllers/BaseOdometryState.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 geometry_msgs.msg
00008
00009 class BaseOdometryState(genpy.Message):
00010 _md5sum = "8a483e137ebc37abafa4c26549091dd6"
00011 _type = "pr2_mechanism_controllers/BaseOdometryState"
00012 _has_header = False
00013 _full_text = """geometry_msgs/Twist velocity
00014 string[] wheel_link_names
00015 float64[] drive_constraint_errors
00016 float64[] longitudinal_slip_constraint_errors
00017 ================================================================================
00018 MSG: geometry_msgs/Twist
00019 # This expresses velocity in free space broken into its linear and angular parts.
00020 Vector3 linear
00021 Vector3 angular
00022
00023 ================================================================================
00024 MSG: geometry_msgs/Vector3
00025 # This represents a vector in free space.
00026
00027 float64 x
00028 float64 y
00029 float64 z
00030 """
00031 __slots__ = ['velocity','wheel_link_names','drive_constraint_errors','longitudinal_slip_constraint_errors']
00032 _slot_types = ['geometry_msgs/Twist','string[]','float64[]','float64[]']
00033
00034 def __init__(self, *args, **kwds):
00035 """
00036 Constructor. Any message fields that are implicitly/explicitly
00037 set to None will be assigned a default value. The recommend
00038 use is keyword arguments as this is more robust to future message
00039 changes. You cannot mix in-order arguments and keyword arguments.
00040
00041 The available fields are:
00042 velocity,wheel_link_names,drive_constraint_errors,longitudinal_slip_constraint_errors
00043
00044 :param args: complete set of field values, in .msg order
00045 :param kwds: use keyword arguments corresponding to message field names
00046 to set specific fields.
00047 """
00048 if args or kwds:
00049 super(BaseOdometryState, self).__init__(*args, **kwds)
00050
00051 if self.velocity is None:
00052 self.velocity = geometry_msgs.msg.Twist()
00053 if self.wheel_link_names is None:
00054 self.wheel_link_names = []
00055 if self.drive_constraint_errors is None:
00056 self.drive_constraint_errors = []
00057 if self.longitudinal_slip_constraint_errors is None:
00058 self.longitudinal_slip_constraint_errors = []
00059 else:
00060 self.velocity = geometry_msgs.msg.Twist()
00061 self.wheel_link_names = []
00062 self.drive_constraint_errors = []
00063 self.longitudinal_slip_constraint_errors = []
00064
00065 def _get_types(self):
00066 """
00067 internal API method
00068 """
00069 return self._slot_types
00070
00071 def serialize(self, buff):
00072 """
00073 serialize message into buffer
00074 :param buff: buffer, ``StringIO``
00075 """
00076 try:
00077 _x = self
00078 buff.write(_struct_6d.pack(_x.velocity.linear.x, _x.velocity.linear.y, _x.velocity.linear.z, _x.velocity.angular.x, _x.velocity.angular.y, _x.velocity.angular.z))
00079 length = len(self.wheel_link_names)
00080 buff.write(_struct_I.pack(length))
00081 for val1 in self.wheel_link_names:
00082 length = len(val1)
00083 if python3 or type(val1) == unicode:
00084 val1 = val1.encode('utf-8')
00085 length = len(val1)
00086 buff.write(struct.pack('<I%ss'%length, length, val1))
00087 length = len(self.drive_constraint_errors)
00088 buff.write(_struct_I.pack(length))
00089 pattern = '<%sd'%length
00090 buff.write(struct.pack(pattern, *self.drive_constraint_errors))
00091 length = len(self.longitudinal_slip_constraint_errors)
00092 buff.write(_struct_I.pack(length))
00093 pattern = '<%sd'%length
00094 buff.write(struct.pack(pattern, *self.longitudinal_slip_constraint_errors))
00095 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00096 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
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.velocity is None:
00105 self.velocity = geometry_msgs.msg.Twist()
00106 end = 0
00107 _x = self
00108 start = end
00109 end += 48
00110 (_x.velocity.linear.x, _x.velocity.linear.y, _x.velocity.linear.z, _x.velocity.angular.x, _x.velocity.angular.y, _x.velocity.angular.z,) = _struct_6d.unpack(str[start:end])
00111 start = end
00112 end += 4
00113 (length,) = _struct_I.unpack(str[start:end])
00114 self.wheel_link_names = []
00115 for i in range(0, length):
00116 start = end
00117 end += 4
00118 (length,) = _struct_I.unpack(str[start:end])
00119 start = end
00120 end += length
00121 if python3:
00122 val1 = str[start:end].decode('utf-8')
00123 else:
00124 val1 = str[start:end]
00125 self.wheel_link_names.append(val1)
00126 start = end
00127 end += 4
00128 (length,) = _struct_I.unpack(str[start:end])
00129 pattern = '<%sd'%length
00130 start = end
00131 end += struct.calcsize(pattern)
00132 self.drive_constraint_errors = struct.unpack(pattern, str[start:end])
00133 start = end
00134 end += 4
00135 (length,) = _struct_I.unpack(str[start:end])
00136 pattern = '<%sd'%length
00137 start = end
00138 end += struct.calcsize(pattern)
00139 self.longitudinal_slip_constraint_errors = struct.unpack(pattern, str[start:end])
00140 return self
00141 except struct.error as e:
00142 raise genpy.DeserializationError(e)
00143
00144
00145 def serialize_numpy(self, buff, numpy):
00146 """
00147 serialize message with numpy array types into buffer
00148 :param buff: buffer, ``StringIO``
00149 :param numpy: numpy python module
00150 """
00151 try:
00152 _x = self
00153 buff.write(_struct_6d.pack(_x.velocity.linear.x, _x.velocity.linear.y, _x.velocity.linear.z, _x.velocity.angular.x, _x.velocity.angular.y, _x.velocity.angular.z))
00154 length = len(self.wheel_link_names)
00155 buff.write(_struct_I.pack(length))
00156 for val1 in self.wheel_link_names:
00157 length = len(val1)
00158 if python3 or type(val1) == unicode:
00159 val1 = val1.encode('utf-8')
00160 length = len(val1)
00161 buff.write(struct.pack('<I%ss'%length, length, val1))
00162 length = len(self.drive_constraint_errors)
00163 buff.write(_struct_I.pack(length))
00164 pattern = '<%sd'%length
00165 buff.write(self.drive_constraint_errors.tostring())
00166 length = len(self.longitudinal_slip_constraint_errors)
00167 buff.write(_struct_I.pack(length))
00168 pattern = '<%sd'%length
00169 buff.write(self.longitudinal_slip_constraint_errors.tostring())
00170 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00171 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00172
00173 def deserialize_numpy(self, str, numpy):
00174 """
00175 unpack serialized message in str into this message instance using numpy for array types
00176 :param str: byte array of serialized message, ``str``
00177 :param numpy: numpy python module
00178 """
00179 try:
00180 if self.velocity is None:
00181 self.velocity = geometry_msgs.msg.Twist()
00182 end = 0
00183 _x = self
00184 start = end
00185 end += 48
00186 (_x.velocity.linear.x, _x.velocity.linear.y, _x.velocity.linear.z, _x.velocity.angular.x, _x.velocity.angular.y, _x.velocity.angular.z,) = _struct_6d.unpack(str[start:end])
00187 start = end
00188 end += 4
00189 (length,) = _struct_I.unpack(str[start:end])
00190 self.wheel_link_names = []
00191 for i in range(0, length):
00192 start = end
00193 end += 4
00194 (length,) = _struct_I.unpack(str[start:end])
00195 start = end
00196 end += length
00197 if python3:
00198 val1 = str[start:end].decode('utf-8')
00199 else:
00200 val1 = str[start:end]
00201 self.wheel_link_names.append(val1)
00202 start = end
00203 end += 4
00204 (length,) = _struct_I.unpack(str[start:end])
00205 pattern = '<%sd'%length
00206 start = end
00207 end += struct.calcsize(pattern)
00208 self.drive_constraint_errors = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00209 start = end
00210 end += 4
00211 (length,) = _struct_I.unpack(str[start:end])
00212 pattern = '<%sd'%length
00213 start = end
00214 end += struct.calcsize(pattern)
00215 self.longitudinal_slip_constraint_errors = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00216 return self
00217 except struct.error as e:
00218 raise genpy.DeserializationError(e)
00219
00220 _struct_I = genpy.struct_I
00221 _struct_6d = struct.Struct("<6d")