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