NXT mit Simulink programmieren: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
Zeile 6: | Zeile 6: | ||
<code> >> targetinstaller </code> | <code> >> targetinstaller </code> | ||
<source lang="matlab"> | <source lang="matlab"> | ||
for i=1:10 | |||
% try | |||
% image = CAMERA_DumpFrame(s); | |||
% catch err | |||
% error('MATLAB:RWTHMindstormsNXT:Sensor:unknown', 'An unknown Error occured while fetching the image. Please check that the Camera is connected and try again'); | |||
% end | |||
image = CAMERA_GetImage(com); | |||
handle = imshow(image); | |||
%pause(0.1) | |||
currTime(i) = toc(startTime); | |||
disp(['Aktuelle Zeit: ',num2str(currTime(i))]) | |||
%imwrite(image,sprintf('NXTCamImage%03d.png',i)); | |||
%imwrite(img,fullfile(workingDir,sprintf('HexBug%03d.png',n))); | |||
% ca. alle 4.8 Sekunden ein Bild | |||
end; | |||
</source> | </source> | ||
Version vom 10. Mai 2014, 11:48 Uhr
Installation
Beachten Sie die Installationshinweise. Es empfielt sich die Nutzung von Matlab 2014a 32-Bit in Verbindung mit dem Fantom USB-Treiber.
- Installieren Sie das Simulink Support Package für NXT.
>> targetinstaller
for i=1:10
% try
% image = CAMERA_DumpFrame(s);
% catch err
% error('MATLAB:RWTHMindstormsNXT:Sensor:unknown', 'An unknown Error occured while fetching the image. Please check that the Camera is connected and try again');
% end
image = CAMERA_GetImage(com);
handle = imshow(image);
%pause(0.1)
currTime(i) = toc(startTime);
disp(['Aktuelle Zeit: ',num2str(currTime(i))])
%imwrite(image,sprintf('NXTCamImage%03d.png',i));
%imwrite(img,fullfile(workingDir,sprintf('HexBug%03d.png',n)));
% ca. alle 4.8 Sekunden ein Bild
end;
<for i=1:10
% try
% image = CAMERA_DumpFrame(s);
% catch err
% error('MATLAB:RWTHMindstormsNXT:Sensor:unknown', 'An unknown Error occured while fetching the image. Please check that the Camera is connected and try again');
% end
image = CAMERA_GetImage(com);
handle = imshow(image);
%pause(0.1)
currTime(i) = toc(startTime);
disp(['Aktuelle Zeit: ',num2str(currTime(i))])
%imwrite(image,sprintf('NXTCamImage%03d.png',i));
%imwrite(img,fullfile(workingDir,sprintf('HexBug%03d.png',n)));
% ca. alle 4.8 Sekunden ein Bild
end;>
Weblinks
Videos
→ zurück zum Hauptartikel: Lego Mindstorms NXT