Skip to content
Snippets Groups Projects
Commit 7ba6093f authored by Tim Stadtmann's avatar Tim Stadtmann
Browse files

Add internalTachoCount as hidden property

For now, only for experimental usage.
parent 48424fe0
No related branches found
No related tags found
No related merge requests found
......@@ -113,6 +113,8 @@ classdef Motor < MaskedHandle & dynamicprops
isSynced; % Is motor running in synced mode?
physicalMotorConnected; % Physical motor connected to this port?
internalTachoCount; % Internal tachocount used for positioning the motor with tacholimit
end
methods % Standard methods
......@@ -779,6 +781,18 @@ classdef Motor < MaskedHandle & dynamicprops
end
end
function cnt = get.internalTachoCount(motor)
cnt = 0;
if motor.connectedToBrick
cnt = motor.getInternalTachoCount();
if isnan(cnt)
warning('Motor::get.internalTachoCount: Could not detect motor at port %s.', ...
port2str('Motor', motor.port));
cnt = 0;
end
end
end
function speed = get.currentSpeed(motor)
speed = 0;
if motor.connectedToBrick
......@@ -918,6 +932,13 @@ classdef Motor < MaskedHandle & dynamicprops
end
end
function cnt = getInternalTachoCount(motor)
[~, cnt] = motor.commInterface.outputRead(0, motor.portNo);
if motor.debug
fprintf('(DEBUG) Motor::getInternalTachoCount: Called outputRead on Port %s\n', port2str('Motor', motor.port));
end
end
function speed = getSpeed(motor)
if ~motor.connectedToBrick
error(['Motor::getSpeed: Motor-Object not connected to comm handle.',...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment