00001 """autogenerated by genpy from sr_robot_msgs/cartesian_data.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 sr_robot_msgs.msg
00008
00009 class cartesian_data(genpy.Message):
00010 _md5sum = "0efe699b2863e30a84ffabfdca8dfb19"
00011 _type = "sr_robot_msgs/cartesian_data"
00012 _has_header = False
00013 _full_text = """int8 cartesian_positions_length
00014 cartesian_position[] cartesian_positions
00015
00016 ================================================================================
00017 MSG: sr_robot_msgs/cartesian_position
00018 string tip_name
00019 float32 tip_pos_x
00020 float32 tip_pos_y
00021 float32 tip_pos_z
00022 float32 tip_orientation_rho
00023 float32 tip_orientation_theta
00024 float32 tip_orientation_sigma
00025
00026
00027 """
00028 __slots__ = ['cartesian_positions_length','cartesian_positions']
00029 _slot_types = ['int8','sr_robot_msgs/cartesian_position[]']
00030
00031 def __init__(self, *args, **kwds):
00032 """
00033 Constructor. Any message fields that are implicitly/explicitly
00034 set to None will be assigned a default value. The recommend
00035 use is keyword arguments as this is more robust to future message
00036 changes. You cannot mix in-order arguments and keyword arguments.
00037
00038 The available fields are:
00039 cartesian_positions_length,cartesian_positions
00040
00041 :param args: complete set of field values, in .msg order
00042 :param kwds: use keyword arguments corresponding to message field names
00043 to set specific fields.
00044 """
00045 if args or kwds:
00046 super(cartesian_data, self).__init__(*args, **kwds)
00047
00048 if self.cartesian_positions_length is None:
00049 self.cartesian_positions_length = 0
00050 if self.cartesian_positions is None:
00051 self.cartesian_positions = []
00052 else:
00053 self.cartesian_positions_length = 0
00054 self.cartesian_positions = []
00055
00056 def _get_types(self):
00057 """
00058 internal API method
00059 """
00060 return self._slot_types
00061
00062 def serialize(self, buff):
00063 """
00064 serialize message into buffer
00065 :param buff: buffer, ``StringIO``
00066 """
00067 try:
00068 buff.write(_struct_b.pack(self.cartesian_positions_length))
00069 length = len(self.cartesian_positions)
00070 buff.write(_struct_I.pack(length))
00071 for val1 in self.cartesian_positions:
00072 _x = val1.tip_name
00073 length = len(_x)
00074 if python3 or type(_x) == unicode:
00075 _x = _x.encode('utf-8')
00076 length = len(_x)
00077 buff.write(struct.pack('<I%ss'%length, length, _x))
00078 _x = val1
00079 buff.write(_struct_6f.pack(_x.tip_pos_x, _x.tip_pos_y, _x.tip_pos_z, _x.tip_orientation_rho, _x.tip_orientation_theta, _x.tip_orientation_sigma))
00080 except struct.error as se: self._check_types(se)
00081 except TypeError as te: self._check_types(te)
00082
00083 def deserialize(self, str):
00084 """
00085 unpack serialized message in str into this message instance
00086 :param str: byte array of serialized message, ``str``
00087 """
00088 try:
00089 if self.cartesian_positions is None:
00090 self.cartesian_positions = None
00091 end = 0
00092 start = end
00093 end += 1
00094 (self.cartesian_positions_length,) = _struct_b.unpack(str[start:end])
00095 start = end
00096 end += 4
00097 (length,) = _struct_I.unpack(str[start:end])
00098 self.cartesian_positions = []
00099 for i in range(0, length):
00100 val1 = sr_robot_msgs.msg.cartesian_position()
00101 start = end
00102 end += 4
00103 (length,) = _struct_I.unpack(str[start:end])
00104 start = end
00105 end += length
00106 if python3:
00107 val1.tip_name = str[start:end].decode('utf-8')
00108 else:
00109 val1.tip_name = str[start:end]
00110 _x = val1
00111 start = end
00112 end += 24
00113 (_x.tip_pos_x, _x.tip_pos_y, _x.tip_pos_z, _x.tip_orientation_rho, _x.tip_orientation_theta, _x.tip_orientation_sigma,) = _struct_6f.unpack(str[start:end])
00114 self.cartesian_positions.append(val1)
00115 return self
00116 except struct.error as e:
00117 raise genpy.DeserializationError(e)
00118
00119
00120 def serialize_numpy(self, buff, numpy):
00121 """
00122 serialize message with numpy array types into buffer
00123 :param buff: buffer, ``StringIO``
00124 :param numpy: numpy python module
00125 """
00126 try:
00127 buff.write(_struct_b.pack(self.cartesian_positions_length))
00128 length = len(self.cartesian_positions)
00129 buff.write(_struct_I.pack(length))
00130 for val1 in self.cartesian_positions:
00131 _x = val1.tip_name
00132 length = len(_x)
00133 if python3 or type(_x) == unicode:
00134 _x = _x.encode('utf-8')
00135 length = len(_x)
00136 buff.write(struct.pack('<I%ss'%length, length, _x))
00137 _x = val1
00138 buff.write(_struct_6f.pack(_x.tip_pos_x, _x.tip_pos_y, _x.tip_pos_z, _x.tip_orientation_rho, _x.tip_orientation_theta, _x.tip_orientation_sigma))
00139 except struct.error as se: self._check_types(se)
00140 except TypeError as te: self._check_types(te)
00141
00142 def deserialize_numpy(self, str, numpy):
00143 """
00144 unpack serialized message in str into this message instance using numpy for array types
00145 :param str: byte array of serialized message, ``str``
00146 :param numpy: numpy python module
00147 """
00148 try:
00149 if self.cartesian_positions is None:
00150 self.cartesian_positions = None
00151 end = 0
00152 start = end
00153 end += 1
00154 (self.cartesian_positions_length,) = _struct_b.unpack(str[start:end])
00155 start = end
00156 end += 4
00157 (length,) = _struct_I.unpack(str[start:end])
00158 self.cartesian_positions = []
00159 for i in range(0, length):
00160 val1 = sr_robot_msgs.msg.cartesian_position()
00161 start = end
00162 end += 4
00163 (length,) = _struct_I.unpack(str[start:end])
00164 start = end
00165 end += length
00166 if python3:
00167 val1.tip_name = str[start:end].decode('utf-8')
00168 else:
00169 val1.tip_name = str[start:end]
00170 _x = val1
00171 start = end
00172 end += 24
00173 (_x.tip_pos_x, _x.tip_pos_y, _x.tip_pos_z, _x.tip_orientation_rho, _x.tip_orientation_theta, _x.tip_orientation_sigma,) = _struct_6f.unpack(str[start:end])
00174 self.cartesian_positions.append(val1)
00175 return self
00176 except struct.error as e:
00177 raise genpy.DeserializationError(e)
00178
00179 _struct_I = genpy.struct_I
00180 _struct_b = struct.Struct("<b")
00181 _struct_6f = struct.Struct("<6f")