[READ-ONLY] Mirror of https://github.com/jmrplens/A-Lab. Matlab-based software for measuring acoustic parameters and experiments.
acoustics anechoic impedance-tube impulse-response matlab measurements transmission-tube
0

Configure Feed

Select the types of activity you want to include in your feed.

Update robot

Jose Manuel Requena Plens (Jul 27, 2021, 12:09 PM +0200) 0f0d7622 420c8720

+86 -113
+1 -1
include/Measurements/Special Research - UPV Robot/UPVRobotCheckConnection_Standalone.m
··· 6 6 % Robot parameters 7 7 8 8 % URL to connect with robot 9 - URL = 'http://192.168.4.1/movexyz'; 9 + URL = 'http://172.18.224.210/movexyz'; 10 10 11 11 % ================================================= 12 12 % Options for web response
+23 -1
include/Measurements/Special Research - UPV Robot/UPVRobotHoming_Standalone.m
··· 6 6 % Robot parameters 7 7 8 8 % URL to connect with robot 9 - URL = 'http://192.168.4.1/movexyz'; 9 + URL = 'http://172.18.224.210/movexyz'; 10 + 11 + % M5Stack URL to check position 12 + M5StackURLX = 'http://172.18.224.211/'; 13 + M5StackURLY1 = 'http://172.18.224.212/'; 14 + M5StackURLY2 = 'http://172.18.224.213/'; 10 15 11 16 % ================================================= 12 17 % Check problems ··· 54 59 if (response.STATUS.X.COMPLETE && response.STATUS.Y.COMPLETE && response.STATUS.Z.COMPLETE) 55 60 % Print status 56 61 disp('Robot Ready!'); 62 + % X M5Stack 63 + s.ENCODER.NAME = 'EJEX-ANECOICA'; 64 + s.ENCODER.ENCODER_POS = response.STATUS.X.POS; 65 + SS=jsonencode(s); 66 + webread([M5StackURLX,'setposition','?json=',SS]); 67 + % Y1 M5Stack 68 + s.ENCODER.NAME = 'EJEY1-ANECOICA'; 69 + s.ENCODER.ENCODER_POS = response.STATUS.Y.POS1; 70 + SS=jsonencode(s); 71 + webread([M5StackURLY1,'setposition','?json=',SS]); 72 + % Y2 M5Stack 73 + s.ENCODER.NAME = 'EJEY2-ANECOICA'; 74 + s.ENCODER.ENCODER_POS = response.STATUS.Y.POS2; 75 + SS=jsonencode(s); 76 + webread([M5StackURLY2,'setposition','?json=',SS]); 57 77 break; 58 78 end 79 + 80 + pause(0.01) 59 81 end
+56 -10
include/Measurements/Special Research - UPV Robot/UPVRobotMoveXYZ_Standalone.m
··· 34 34 % Robot parameters 35 35 36 36 % URL to connect with robot 37 - URLmove = 'http://192.168.4.1/movexyz'; 38 - URLpos = 'http://192.168.4.1/position'; 39 - URLstatus = 'http://192.168.4.1/status'; 37 + URLmove = 'http://172.18.224.210/movexyz'; 38 + URLpos = 'http://172.18.224.210/position'; 39 + URLstatus = 'http://172.18.224.210/status'; 40 + 41 + % M5Stack URL to check position 42 + M5StackURLX = 'http://172.18.224.211/'; 43 + M5StackURLY1 = 'http://172.18.224.212/'; 44 + M5StackURLY2 = 'http://172.18.224.213/'; 40 45 41 46 % Size - each axis (mm) 42 47 XLen = 3000; ··· 189 194 %s.axis.UNLOCK = true; 190 195 191 196 % ================================================= 192 - % Structure to JSON 193 - json = jsonencode(s); 194 - 195 - % ================================================= 196 197 % Options for web response 197 198 options = weboptions("Timeout",5,'ContentType','json'); 198 199 199 200 % ================================================= 200 201 % Homing (if needed) 201 202 % Send commands 202 - response = webread(URLstatus,options); 203 - if response.STATUS.X.HOMING_PENDENT || response.STATUS.Y.HOMING_PENDENT || response.STATUS.Z.HOMING_PENDENT 204 - UPVRobotHoming_Standalone; 203 + resRobot = webread(URLstatus,options); 204 + if resRobot.STATUS.X.HOMING_PENDENT || resRobot.STATUS.Y.HOMING_PENDENT || resRobot.STATUS.Z.HOMING_PENDENT 205 + UPVRobotHoming_Standalone; 205 206 end 207 + 208 + % ================================================= 209 + % Check position and correct 210 + 211 + % X 212 + response = webread(M5StackURLX,options); 213 + M5_Xpos = response.ENCODER.ENCODER_POS; 214 + 215 + if abs(resRobot.STATUS.X.POS - M5_Xpos) > 0.25 216 + s.axis.X.ACTUAL_POSITION = M5_Xpos; 217 + end 218 + 219 + % Y1 220 + response = webread(M5StackURLY1,options); 221 + M5_Y1pos = response.ENCODER.ENCODER_POS; 222 + 223 + if abs(resRobot.STATUS.Y.POS1 - M5_Y1pos) > 0.25 224 + s.axis.Y.ACTUAL_POSITION_1 = M5_Y1pos; 225 + end 226 + 227 + % Y2 228 + response = webread(M5StackURLY2,options); 229 + M5_Y2pos = response.ENCODER.ENCODER_POS; 230 + 231 + if abs(resRobot.STATUS.Y.POS2 - M5_Y2pos) > 0.25 232 + s.axis.Y.ACTUAL_POSITION_2 = M5_Y2pos; 233 + end 234 + 235 + 236 + % ================================================= 237 + % Clear if no movement 238 + % response = webread(URLpos,options); 239 + % if abs(response.STATUS.X.POS-X) < 0.1 && isfield(s.axis,'X') 240 + % s.axis = rmfield(s.axis,'X'); 241 + % end 242 + % if abs(response.STATUS.Y.POS-Y) < 0.1 && isfield(s.axis,'Y') 243 + % s.axis = rmfield(s.axis,'Y'); 244 + % end 245 + % if abs(response.STATUS.Z.POS-Z) < 0.1 && isfield(s.axis,'Z') 246 + % s.axis = rmfield(s.axis,'Z'); 247 + % end 248 + 249 + % ================================================= 250 + % Structure to JSON 251 + json = jsonencode(s); 206 252 207 253 % ================================================= 208 254 % Send command and check status
-100
include/Measurements/Special Research - UPV Robot/UPVRobotPostProcessPlotFreq2Dtest.m
··· 1 - function UPVRobotPostProcessPlotFreq2D(app) 2 - 3 - 4 - % Slice type 5 - slice = app.ExtVar.UPVRobotPostProcess.Slice2DType; 6 - 7 - % Load data 8 - coords = app.ExtVar.UPVRobotPostProcess.Coords; 9 - 10 - % Get slice 11 - switch slice 12 - case 'XY' 13 - a = coords(:,1); 14 - b = coords(:,2); 15 - c = coords(:,3); 16 - d = app.ExtVar.UPVRobotPostProcess.SliceXY_Zvalue; 17 - case 'XZ' 18 - a = coords(:,1); 19 - b = coords(:,3); 20 - c = coords(:,2); 21 - d = app.ExtVar.UPVRobotPostProcess.SliceXZ_Yvalue; 22 - case 'YZ' 23 - a = coords(:,2); 24 - b = coords(:,3); 25 - c = coords(:,1); 26 - d = app.ExtVar.UPVRobotPostProcess.SliceYZ_Xvalue; 27 - end 28 - % Filter data to slice 'd' value 29 - idx = find(c==d); 30 - a = a(idx); 31 - b = b(idx); 32 - d = ones(size(a)) * d; 33 - % x = coords(:,1); 34 - % y = coords(:,2); 35 - % z = coords(:,3); 36 - 37 - ua = unique(a); 38 - ub = unique(b); 39 - ud = unique(d); 40 - 41 - 42 - [A,B,D] = meshgrid(ua, ub, ud); 43 - 44 - % Get boundary 45 - k = boundary(a,b,0.8); 46 - 47 - 48 - % Load data 49 - f = app.ExtVar.UPVRobotPostProcess.FreqVec; 50 - H = app.ExtVar.UPVRobotPostProcess.FreqResp; 51 - 52 - % View parameters 53 - FreqView = app.ExtVar.UPVRobotPostProcess.FreqView; 54 - FreqColorAuto = app.ExtVar.UPVRobotPostProcess.FreqColorAuto; 55 - FreqMinRange = app.ExtVar.UPVRobotPostProcess.FreqMinRange; 56 - FreqMaxRange = app.ExtVar.UPVRobotPostProcess.FreqMaxRange; 57 - 58 - % Locate selected frequency 59 - idx = find(f>=FreqView,1,'first'); 60 - 61 - freqResp = H(idx,:); 62 - FL = scatteredInterpolant(a(:),b(:),freqResp(:),'natural','none'); 63 - Zb = FL(A,B); 64 - 65 - 66 - % Axes 67 - ax = app.ExtUI.UPVRobotPostProcessUIAxesFreq2D; 68 - cla(ax,'reset') 69 - 70 - % Plot surface 71 - surf(ax,A,B,D,20*log10(abs(Zb)/2e-5)) 72 - hold(ax,'on') 73 - 74 - % Plot measurement points 75 - if app.ExtVar.UPVRobotPostProcess.ViewPoints 76 - scatter3(ax,a,b,d,'k.','linewidth',1) 77 - end 78 - 79 - % Plot boundary 80 - if app.ExtVar.UPVRobotPostProcess.ViewBoundary 81 - plot3(ax,a(k),b(k),d(k),'k','linewidth',1) 82 - end 83 - 84 - % Axes settings 85 - shading(ax,'interp') 86 - view(ax,[0,-90]) 87 - axis(ax,'equal') 88 - h = colorbar(ax); 89 - ylabel(h, 'SPL (dB)') 90 - if ~FreqColorAuto 91 - caxis(ax,[FreqMinRange,FreqMaxRange]) 92 - end 93 - colormap(ax,jet(1000)) 94 - xlim(ax,app.ExtVar.UPVRobotPostProcess.XLim) 95 - ylim(ax,app.ExtVar.UPVRobotPostProcess.YLim) 96 - zlim(ax,app.ExtVar.UPVRobotPostProcess.ZLim) 97 - xlabel(ax,'Lx (m)') 98 - ylabel(ax,'Ly (m)') 99 - zlabel(ax,'Lz (m)') 100 - title(ax,sprintf('Frequency: %.0f Hz',f(idx)))
+6 -1
include/Measurements/Special Research - UPV Robot/buildUPVRobot.m
··· 6 6 if ~isfield(app.ExtVar,'UPVRobot') 7 7 app.ExtVar.UPVRobot = struct('XLen',[],'YLen',[],'ZLen',[],'XYSpeed',[],'MaxXYSpeed',[],'ZSpeed',[],... 8 8 'MaxZSpeed',[],'XYAcel',[],'ZAcel',[],'MaxXYAcel',[],'MaxZAcel',[],... 9 - 'RobotURLmove',[],'RobotURLpos',[],'RobotURLstatus',[],... 9 + 'RobotURLmove',[],'RobotURLpos',[],'RobotURLstatus',[],'M5StackURLX',[],'M5StackURLY1',[],'M5StackURLY2',[],... 10 10 'InCh',[],'OutCh',[],'Output',[],'TypeSignal',[],'FolderPath',[],... 11 11 'XRes',[],'YRes',[],'ZRes',[],'XOri',[],'YOri',[],'ZOri',[],'XEnd',[],'YEnd',[],'ZEnd',[],... 12 12 'Restricted',[],'XNaNOri',[],'YNaNOri',[],'ZNaNOri',[],'XNaNEnd',[],'YNaNEnd',[],'ZNaNEnd',[],... ··· 25 25 app.ExtVar.UPVRobot.RobotURLmove = 'http://192.168.4.1/movexyz'; 26 26 app.ExtVar.UPVRobot.RobotURLpos = 'http://192.168.4.1/position'; 27 27 app.ExtVar.UPVRobot.RobotURLstatus = 'http://192.168.4.1/status'; 28 + 29 + % M5Stack URL to check position 30 + app.ExtVar.UPVRobot.M5StackURLX = 'http://172.18.224.211/'; 31 + app.ExtVar.UPVRobot.M5StackURLY1 = 'http://172.18.224.212/'; 32 + app.ExtVar.UPVRobot.M5StackURLY2 = 'http://172.18.224.213/'; 28 33 29 34 % Size - each axis (m) 30 35 app.ExtVar.UPVRobot.XLen = 3;