Clear Filters
Clear Filters

Build error: C++ compiler produced errors.

70 views (last 30 days)
Meruzhan Hovhannisyan
Meruzhan Hovhannisyan on 7 Sep 2024 at 9:47
Edited: Meruzhan Hovhannisyan on 7 Sep 2024 at 12:49
function deploy_tracing_raspberry_pi() %#codegen
persistent yolov3Detector;
if isempty(yolov3Detector)
yolov3Detector = coder.loadDeepLearningNetwork('yolov3Detector.mat');
end
mypi = raspi('192.168.18.233','pi','raspberry');
cam = cameraboard(mypi,'Resolution','160x120');
s = servo(mypi, 18, 'MinPulseDuration', 1e-3, 'MaxPulseDuration', 2e-3);
k = servo(mypi, 23, 'MinPulseDuration', 1e-3, 'MaxPulseDuration', 2e-3);
n = 90;
m = 90;
u = 2;
t = 0;
writePosition(s, n);
writePosition(k, m);
% Main loop
start = tic;
while t < 10000
t = t + 1;
%Capture image cameraboard
img = snapshot(cam);
elapsedTime = toc(start);
%Process frames at every 0.25 seconds
if elapsedTime > 0.25
end
% Detect
[bboxes,scores] = detect(yolov3Detector,img,'Threshold',0.6);
if ~isempty(bboxes)
img = insertObjectAnnotation(img,'rectangle',bboxes,scores);
[hI,wI,~] = size(img);
a = find(scores==max(scores));
x = bboxes(a,1);
y = bboxes(a,2);
w = bboxes(a,3);
h = bboxes(a,4);
if (wI/2 - (x + w/2) < 0)
n=n+u;
if n>=170
n = 150;
writePosition(s,n);
else
writePosition(s,n);
end
end
if (wI/2 - (x + w/2) > 0)
n=n-u;
if n<=10
n = 20;
writePosition(s,n);
else
writePosition(s,n);
end
end
if (hI/2 - (y + h/2) >0)
m=m+u;
if m>=170
m = 150;
writePosition(k,m);
else
writePosition(k,m);
end
end
if (hI/2 - (y + h/2) < 0)
m=m-u;
if m<=10
m = 20;
writePosition(k,m);
else
writePosition(k,m);
end
end
end
displayImage(mypi,img);
drawnow
end
%%
%when running the deploy script, I get an error
%Error executing command "touch -c /home/pi/MATLAB_ws/R2024a/C/Meruzhan/Yolov3/codegen/exe/deploy_tracing_raspberry_pi/*.*;make -j$(($(nproc)+1)) -Otarget -f deploy_tracing_raspberry_pi_rtw.mk all MATLAB_WORKSPACE="/home/pi/MATLAB_ws/R2024a" LINUX_TARGET_LIBS_MACRO="-lSDL -lmmal -lmmal_core -lmmal_util -lmmal_vc_client -lvcos -lbcm_host" -C /home/pi/MATLAB_ws/R2024a/C/Meruzhan/Yolov3/codegen/exe/deploy_tracing_raspberry_pi LC_ALL=C".

Answers (0)

Categories

Find more on MATLAB Compiler in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!