$search
00001 """autogenerated by genmsg_py from ChainMeasurement.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import sensor_msgs.msg 00006 import std_msgs.msg 00007 00008 class ChainMeasurement(roslib.message.Message): 00009 _md5sum = "a57d957972fc9bc34b14f2a3cac0fbae" 00010 _type = "cob_calibration_msgs/ChainMeasurement" 00011 _has_header = True #flag to mark the presence of a Header object 00012 _full_text = """Header header 00013 string chain_id 00014 sensor_msgs/JointState chain_state 00015 00016 ================================================================================ 00017 MSG: std_msgs/Header 00018 # Standard metadata for higher-level stamped data types. 00019 # This is generally used to communicate timestamped data 00020 # in a particular coordinate frame. 00021 # 00022 # sequence ID: consecutively increasing ID 00023 uint32 seq 00024 #Two-integer timestamp that is expressed as: 00025 # * stamp.secs: seconds (stamp_secs) since epoch 00026 # * stamp.nsecs: nanoseconds since stamp_secs 00027 # time-handling sugar is provided by the client library 00028 time stamp 00029 #Frame this data is associated with 00030 # 0: no frame 00031 # 1: global frame 00032 string frame_id 00033 00034 ================================================================================ 00035 MSG: sensor_msgs/JointState 00036 # This is a message that holds data to describe the state of a set of torque controlled joints. 00037 # 00038 # The state of each joint (revolute or prismatic) is defined by: 00039 # * the position of the joint (rad or m), 00040 # * the velocity of the joint (rad/s or m/s) and 00041 # * the effort that is applied in the joint (Nm or N). 00042 # 00043 # Each joint is uniquely identified by its name 00044 # The header specifies the time at which the joint states were recorded. All the joint states 00045 # in one message have to be recorded at the same time. 00046 # 00047 # This message consists of a multiple arrays, one for each part of the joint state. 00048 # The goal is to make each of the fields optional. When e.g. your joints have no 00049 # effort associated with them, you can leave the effort array empty. 00050 # 00051 # All arrays in this message should have the same size, or be empty. 00052 # This is the only way to uniquely associate the joint name with the correct 00053 # states. 00054 00055 00056 Header header 00057 00058 string[] name 00059 float64[] position 00060 float64[] velocity 00061 float64[] effort 00062 00063 """ 00064 __slots__ = ['header','chain_id','chain_state'] 00065 _slot_types = ['Header','string','sensor_msgs/JointState'] 00066 00067 def __init__(self, *args, **kwds): 00068 """ 00069 Constructor. Any message fields that are implicitly/explicitly 00070 set to None will be assigned a default value. The recommend 00071 use is keyword arguments as this is more robust to future message 00072 changes. You cannot mix in-order arguments and keyword arguments. 00073 00074 The available fields are: 00075 header,chain_id,chain_state 00076 00077 @param args: complete set of field values, in .msg order 00078 @param kwds: use keyword arguments corresponding to message field names 00079 to set specific fields. 00080 """ 00081 if args or kwds: 00082 super(ChainMeasurement, self).__init__(*args, **kwds) 00083 #message fields cannot be None, assign default values for those that are 00084 if self.header is None: 00085 self.header = std_msgs.msg._Header.Header() 00086 if self.chain_id is None: 00087 self.chain_id = '' 00088 if self.chain_state is None: 00089 self.chain_state = sensor_msgs.msg.JointState() 00090 else: 00091 self.header = std_msgs.msg._Header.Header() 00092 self.chain_id = '' 00093 self.chain_state = sensor_msgs.msg.JointState() 00094 00095 def _get_types(self): 00096 """ 00097 internal API method 00098 """ 00099 return self._slot_types 00100 00101 def serialize(self, buff): 00102 """ 00103 serialize message into buffer 00104 @param buff: buffer 00105 @type buff: StringIO 00106 """ 00107 try: 00108 _x = self 00109 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00110 _x = self.header.frame_id 00111 length = len(_x) 00112 buff.write(struct.pack('<I%ss'%length, length, _x)) 00113 _x = self.chain_id 00114 length = len(_x) 00115 buff.write(struct.pack('<I%ss'%length, length, _x)) 00116 _x = self 00117 buff.write(_struct_3I.pack(_x.chain_state.header.seq, _x.chain_state.header.stamp.secs, _x.chain_state.header.stamp.nsecs)) 00118 _x = self.chain_state.header.frame_id 00119 length = len(_x) 00120 buff.write(struct.pack('<I%ss'%length, length, _x)) 00121 length = len(self.chain_state.name) 00122 buff.write(_struct_I.pack(length)) 00123 for val1 in self.chain_state.name: 00124 length = len(val1) 00125 buff.write(struct.pack('<I%ss'%length, length, val1)) 00126 length = len(self.chain_state.position) 00127 buff.write(_struct_I.pack(length)) 00128 pattern = '<%sd'%length 00129 buff.write(struct.pack(pattern, *self.chain_state.position)) 00130 length = len(self.chain_state.velocity) 00131 buff.write(_struct_I.pack(length)) 00132 pattern = '<%sd'%length 00133 buff.write(struct.pack(pattern, *self.chain_state.velocity)) 00134 length = len(self.chain_state.effort) 00135 buff.write(_struct_I.pack(length)) 00136 pattern = '<%sd'%length 00137 buff.write(struct.pack(pattern, *self.chain_state.effort)) 00138 except struct.error as se: self._check_types(se) 00139 except TypeError as te: self._check_types(te) 00140 00141 def deserialize(self, str): 00142 """ 00143 unpack serialized message in str into this message instance 00144 @param str: byte array of serialized message 00145 @type str: str 00146 """ 00147 try: 00148 if self.header is None: 00149 self.header = std_msgs.msg._Header.Header() 00150 if self.chain_state is None: 00151 self.chain_state = sensor_msgs.msg.JointState() 00152 end = 0 00153 _x = self 00154 start = end 00155 end += 12 00156 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00157 start = end 00158 end += 4 00159 (length,) = _struct_I.unpack(str[start:end]) 00160 start = end 00161 end += length 00162 self.header.frame_id = str[start:end] 00163 start = end 00164 end += 4 00165 (length,) = _struct_I.unpack(str[start:end]) 00166 start = end 00167 end += length 00168 self.chain_id = str[start:end] 00169 _x = self 00170 start = end 00171 end += 12 00172 (_x.chain_state.header.seq, _x.chain_state.header.stamp.secs, _x.chain_state.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00173 start = end 00174 end += 4 00175 (length,) = _struct_I.unpack(str[start:end]) 00176 start = end 00177 end += length 00178 self.chain_state.header.frame_id = str[start:end] 00179 start = end 00180 end += 4 00181 (length,) = _struct_I.unpack(str[start:end]) 00182 self.chain_state.name = [] 00183 for i in range(0, length): 00184 start = end 00185 end += 4 00186 (length,) = _struct_I.unpack(str[start:end]) 00187 start = end 00188 end += length 00189 val1 = str[start:end] 00190 self.chain_state.name.append(val1) 00191 start = end 00192 end += 4 00193 (length,) = _struct_I.unpack(str[start:end]) 00194 pattern = '<%sd'%length 00195 start = end 00196 end += struct.calcsize(pattern) 00197 self.chain_state.position = struct.unpack(pattern, str[start:end]) 00198 start = end 00199 end += 4 00200 (length,) = _struct_I.unpack(str[start:end]) 00201 pattern = '<%sd'%length 00202 start = end 00203 end += struct.calcsize(pattern) 00204 self.chain_state.velocity = struct.unpack(pattern, str[start:end]) 00205 start = end 00206 end += 4 00207 (length,) = _struct_I.unpack(str[start:end]) 00208 pattern = '<%sd'%length 00209 start = end 00210 end += struct.calcsize(pattern) 00211 self.chain_state.effort = struct.unpack(pattern, str[start:end]) 00212 return self 00213 except struct.error as e: 00214 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00215 00216 00217 def serialize_numpy(self, buff, numpy): 00218 """ 00219 serialize message with numpy array types into buffer 00220 @param buff: buffer 00221 @type buff: StringIO 00222 @param numpy: numpy python module 00223 @type numpy module 00224 """ 00225 try: 00226 _x = self 00227 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00228 _x = self.header.frame_id 00229 length = len(_x) 00230 buff.write(struct.pack('<I%ss'%length, length, _x)) 00231 _x = self.chain_id 00232 length = len(_x) 00233 buff.write(struct.pack('<I%ss'%length, length, _x)) 00234 _x = self 00235 buff.write(_struct_3I.pack(_x.chain_state.header.seq, _x.chain_state.header.stamp.secs, _x.chain_state.header.stamp.nsecs)) 00236 _x = self.chain_state.header.frame_id 00237 length = len(_x) 00238 buff.write(struct.pack('<I%ss'%length, length, _x)) 00239 length = len(self.chain_state.name) 00240 buff.write(_struct_I.pack(length)) 00241 for val1 in self.chain_state.name: 00242 length = len(val1) 00243 buff.write(struct.pack('<I%ss'%length, length, val1)) 00244 length = len(self.chain_state.position) 00245 buff.write(_struct_I.pack(length)) 00246 pattern = '<%sd'%length 00247 buff.write(self.chain_state.position.tostring()) 00248 length = len(self.chain_state.velocity) 00249 buff.write(_struct_I.pack(length)) 00250 pattern = '<%sd'%length 00251 buff.write(self.chain_state.velocity.tostring()) 00252 length = len(self.chain_state.effort) 00253 buff.write(_struct_I.pack(length)) 00254 pattern = '<%sd'%length 00255 buff.write(self.chain_state.effort.tostring()) 00256 except struct.error as se: self._check_types(se) 00257 except TypeError as te: self._check_types(te) 00258 00259 def deserialize_numpy(self, str, numpy): 00260 """ 00261 unpack serialized message in str into this message instance using numpy for array types 00262 @param str: byte array of serialized message 00263 @type str: str 00264 @param numpy: numpy python module 00265 @type numpy: module 00266 """ 00267 try: 00268 if self.header is None: 00269 self.header = std_msgs.msg._Header.Header() 00270 if self.chain_state is None: 00271 self.chain_state = sensor_msgs.msg.JointState() 00272 end = 0 00273 _x = self 00274 start = end 00275 end += 12 00276 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00277 start = end 00278 end += 4 00279 (length,) = _struct_I.unpack(str[start:end]) 00280 start = end 00281 end += length 00282 self.header.frame_id = str[start:end] 00283 start = end 00284 end += 4 00285 (length,) = _struct_I.unpack(str[start:end]) 00286 start = end 00287 end += length 00288 self.chain_id = str[start:end] 00289 _x = self 00290 start = end 00291 end += 12 00292 (_x.chain_state.header.seq, _x.chain_state.header.stamp.secs, _x.chain_state.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00293 start = end 00294 end += 4 00295 (length,) = _struct_I.unpack(str[start:end]) 00296 start = end 00297 end += length 00298 self.chain_state.header.frame_id = str[start:end] 00299 start = end 00300 end += 4 00301 (length,) = _struct_I.unpack(str[start:end]) 00302 self.chain_state.name = [] 00303 for i in range(0, length): 00304 start = end 00305 end += 4 00306 (length,) = _struct_I.unpack(str[start:end]) 00307 start = end 00308 end += length 00309 val1 = str[start:end] 00310 self.chain_state.name.append(val1) 00311 start = end 00312 end += 4 00313 (length,) = _struct_I.unpack(str[start:end]) 00314 pattern = '<%sd'%length 00315 start = end 00316 end += struct.calcsize(pattern) 00317 self.chain_state.position = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length) 00318 start = end 00319 end += 4 00320 (length,) = _struct_I.unpack(str[start:end]) 00321 pattern = '<%sd'%length 00322 start = end 00323 end += struct.calcsize(pattern) 00324 self.chain_state.velocity = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length) 00325 start = end 00326 end += 4 00327 (length,) = _struct_I.unpack(str[start:end]) 00328 pattern = '<%sd'%length 00329 start = end 00330 end += struct.calcsize(pattern) 00331 self.chain_state.effort = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length) 00332 return self 00333 except struct.error as e: 00334 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00335 00336 _struct_I = roslib.message.struct_I 00337 _struct_3I = struct.Struct("<3I")