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

Documentation updates and general cleanup

parent 3980140a
Branches
Tags
No related merge requests found
......@@ -310,7 +310,7 @@ classdef EV3 < MaskedHandle
% Example:
% b = EV3(); |br|
% b.connect('bt', 'serPort', '/dev/rfcomm0'); |br|
% b.playTone(50, 5000, 1000); % Plays tone with 50% volume and 5000Hz for 1
% b.playTone(40, 5000, 1000); % Plays tone with 40% volume and 5000Hz for 1
% second. |br|
%
......
......
......@@ -9,6 +9,8 @@ classdef Motor < MaskedHandle & dynamicprops
% * You don't need to create instances of this class. The EV3-class automatically creates
% instances for each motor port, and you can work with them via the EV3-object.
% * The Motor-class represents motor ports, not individual motors!
% * If you start a motor with power=0, the internal state will still be set to
% 'isRunning'
%
% Attributes:
% power (numeric in [-100, 100]): Power level of motor in percent. *[WRITABLE]*
......@@ -32,7 +34,7 @@ classdef Motor < MaskedHandle & dynamicprops
% Depending on limitMode, the input is interpreted either in degrees or
% milliseconds. *[WRITABLE]*
% limitMode ('Tacho'|'Time'): Mode for motor limit. *[WRITABLE]*
% brakeMode ('Brake'|'Coast'): Mode for braking. If 'Coast', the motor will (at
% brakeMode ('Brake'|'Coast'): Action done when stopping. If 'Coast', the motor will (at
% tacholimit, if ~=0) coast to a stop. If 'Brake', the motor will stop immediately
% (at tacholimit, if ~=0) and hold the brake. *[WRITABLE]*
% debug (bool): Debug turned on or off. In debug mode, everytime a command is passed to
......@@ -49,31 +51,31 @@ classdef Motor < MaskedHandle & dynamicprops
% power (numeric in [-100, 100]): Power level of motor in percent. [WRITABLE]
power;
% speedRegulation (bool): Speed regulation turned on or off. When turned on, motor will
% try to 'hold' its speed at given power level, whatever the load. In this mode, the
% highest possible speed depends on the load and mostly goes up to around 70-80 (at
% this point, the Brick internally input 100% power). When turned off, motor will
% constantly input the same power into the motor. The resulting speed will be
% somewhat lower, depending on the load. [WRITABLE]
% speedRegulation (bool): Speed regulation turned on or off. [WRITABLE]
% When turned on, motor will try to 'hold' its speed at given power level, whatever
% the load. In this mode, the highest possible speed depends on the load and mostly
% goes up to around 70-80 (at this point, the Brick internally input 100% power).
% When turned off, motor will constantly input the same power into the motor. The
% resulting speed will be somewhat lower, depending on the load.
speedRegulation;
% smoothStart (numeric s. t. smoothStart+smoothStop < limitValue): Degrees/Time
% indicating how far/long the motor should smoothly start. Depending on limitMode,
% the input is interpreted either in degrees or milliseconds. The first
% {smoothStart}-milliseconds/degrees of limitValue the motor will slowly accelerate
% until reaching its defined speed. [WRITABLE]
% smoothStart (numeric s. t. smoothStart+smoothStop < limitValue): Degrees/Time indicating how far/long the motor should smoothly start. [WRITABLE]
% Depending on limitMode, the input is interpreted either in degrees or
% milliseconds. The first {smoothStart}-milliseconds/degrees of limitValue the
% motor will slowly accelerate until reaching its defined speed.
% See also MOTOR.LIMITVALUE, MOTOR.LIMITMODE
smoothStart;
% smoothStop (numeric s. t. smoothStart+smoothStop < limitValue): Degrees/Time
% indicating how far/long the motor should smoothly stop. Depending on limitMode, the
% input is interpreted either in degrees or milliseconds. The last
% [smoothStop]-milliseconds/degrees of limitValue the motor will slowly slow down
% until it has stopped. [WRITABLE]
% smoothStop (numeric s. t. smoothStart+smoothStop < limitValue): Degrees/Time indicating how far/long the motor should smoothly stop. [WRITABLE]
% Depending on limitMode, the input is interpreted either in degrees or
% milliseconds. The last [smoothStop]-milliseconds/degrees of limitValue the motor
% will slowly slow down until it has stopped.
% See also MOTOR.LIMITVALUE, MOTOR.LIMITMODE
smoothStop;
% limitValue (numeric>=0): Degrees/Time indicating how far/long the motor should run.
% limitValue (numeric>=0): Degrees/Time indicating how far/long the motor should run. [WRITABLE]
% Depending on limitMode, the input is interpreted either in degrees or
% milliseconds. [WRITABLE]
% milliseconds.
% See also MOTOR.LIMITMODE
limitValue;
......@@ -81,14 +83,14 @@ classdef Motor < MaskedHandle & dynamicprops
% See also MOTOR.SMOOTHSTART, MOTOR.SMOOTHSTOP, MOTOR.LIMITMODE
limitMode;
% brakeMode ('Brake'|'Coast'): Mode for braking. If 'Coast', the motor will (at
% tacholimit, if ~=0) coast to a stop. If 'Brake', the motor will stop immediately
% (at tacholimit, if ~=0) and hold the brake. [WRITABLE]
% brakeMode ('Brake'|'Coast'): Action done when stopping. [WRITABLE]
% If 'Coast', the motor will (at tacholimit, if ~=0) coast to a stop. If 'Brake',
% the motor will stop immediately (at tacholimit, if ~=0) and hold the brake.
brakeMode;
% debug (bool): Debug turned on or off. In debug mode, everytime a command is passed to
% the sublayer ('communication layer'), there is feedback in the console about what
% command has been called. [WRITABLE]
% debug (bool): Debug turned on or off. [WRITABLE]
% In debug mode, everytime a command is passed to the sublayer ('communication
% layer'), there is feedback in the console about what command has been called.
debug;
end
......@@ -99,8 +101,9 @@ classdef Motor < MaskedHandle & dynamicprops
% tachoCount (numeric): Current tacho count. [READ-ONLY]
tachoCount;
% currentSpeed (numeric): Current speed of motor. If speedRegulation=on this should
% equal power, otherwise it will probably be lower than that. [READ-ONLY]
% currentSpeed (numeric): Current speed of motor. [READ-ONLY]
% If speedRegulation=on this should equal power, otherwise it will probably be
% lower than that.
% See also MOTOR.SPEEDREGULATION
currentSpeed;
......@@ -196,7 +199,7 @@ classdef Motor < MaskedHandle & dynamicprops
% a tacholimit for some time using Coast, then stop using Coast, and then try
% to run the with a tacholimit, it will stop sooner or later than expected,
% or may not even start at all.
% * After calling one of the functions to control the motor with some kind of
% * (OLD)After calling one of the functions to control the motor with some kind of
% limit (which is done if limit~=0), the physical brick's power/speed value for
% starting without a limit (i.e. if limit==0) is reset to zero. So if you want
% to control the motor without a limit after doing so with a limit, you would
......@@ -342,11 +345,7 @@ classdef Motor < MaskedHandle & dynamicprops
error('Motor::stop: No physical motor connected to Port %s',...
port2str('Motor', motor.port));
elseif motor.isSynced && motor.isRunning
if motor.isMaster
motor.syncedStop();
elseif motor.isSlave
motor.('master').syncedStop();
end
return;
% error(['Motor::stop: Motor is running synchronized with another motor. ' ,...
% 'Use ''syncedStop'' on the ''master''-motor.']);
......@@ -400,7 +399,6 @@ classdef Motor < MaskedHandle & dynamicprops
% % Do stuff
% m.syncedStop(); |br|
%
turnRatio = 0;
% Check parameters
......@@ -506,7 +504,7 @@ classdef Motor < MaskedHandle & dynamicprops
error('Motor::syncedStop: Motor has not been started synchronized with another.');
else
% Retrieve synced motor from cache
if length(findprop(motor, 'slave'))==1
if motor.isMaster
syncMotor = motor.slave;
delete(motor.findprop('slave'));
delete(syncMotor.findprop('master'));
......@@ -615,6 +613,9 @@ classdef Motor < MaskedHandle & dynamicprops
%
% Notes:
% * A better name would probably be resetPosition...
% * Gets called automatically when starting the motor and the internal tacho
% count is > 0
%
%
% See also MOTOR.RESETTACHOCOUNT
......@@ -945,7 +946,7 @@ classdef Motor < MaskedHandle & dynamicprops
busyFlag = 0;
end
assert(~(motor.state.startedNotBusy && busyFlag));
% assert(~(motor.state.startedNotBusy && busyFlag));
running = motor.state.startedNotBusy || busyFlag;
end
......
......
......@@ -18,19 +18,59 @@ classdef Sensor < MaskedHandle
% sensor type): *[WRITABLE]*
%
% * Touch-Sensor:
% * DeviceMode.Touch.Pushed [Default]
% * DeviceMode.Touch.Pushed *[Default]*
% * DeviceMode.Touch.Bumps
% * Ultrasonic-Sensor:
% * DeviceMode.UltraSonic.DistCM [Default]
% * DeviceMode.UltraSonic.DistCM *[Default]*
% * DeviceMode.UltraSonic.DistIn
% * DeviceMode.UltraSonic.Listen
% * Color-Sensor:
% * DeviceMode.Color.Reflect [Default]
% * DeviceMode.Color.Reflect *[Default]*
% * DeviceMode.Color.Ambient
% * DeviceMode.Color.Col
% * Gyro-Sensor:
% * DeviceMode.Gyro.Angular [Default]
% * DeviceMode.Gyro.Angular *[Default]*
% * DeviceMode.Gyro.Rate
% * Infrared-Sensor:
% * DeviceMode.InfraRed.Prox *[Default]*
% * DeviceMode.InfraRed.Seek
% * DeviceMode.InfraRed.Remote
% * NXTColor-Sensor:
% * DeviceMode.NXTColor.Reflect *[Default]*
% * DeviceMode.NXTColor.Ambient
% * DeviceMode.NXTColor.Color
% * DeviceMode.NXTColor.Green
% * DeviceMode.NXTColor.Blue
% * DeviceMode.NXTColor.Raw
% * NXTLight-Sensor:
% * DeviceMode.NXTLight.Reflect *[Default]*
% * DeviceMode.NXTLight.Ambient
% * NXTSound-Sensor:
% * DeviceMode.NXTSound.DB *[Default]*
% * DeviceMode.NXTSound.DBA
% * NXTTemperature-Sensor
% * DeviceMode.NXTTemperature.C *[Default]*
% * DeviceMode.NXTTemperature.F
% * NXTTouch-Sensor:
% * DeviceMode.NXTTouch.Pushed *[Default]*
% * DeviceMode.NXTTouch.Bumps
% * NXTUltraSonic-Sensor:
% * DeviceMode.NXTUltraSonic.CM *[Default]*
% * DeviceMode.NXTUltraSonic.IN
% * HTAccelerometer-Sensor:
% * DeviceMode.HTAccelerometer.Acceleration *[Default]*
% * DeviceMode.HTAccelerometer.AccelerationAllAxes
% * HTCompass-Sensor:
% * DeviceMode.HTCompass.Degrees *[Default]*
% * HTColor-Sensor:
% * DeviceMode.HTColor.Col *[Default]*
% * DeviceMode.HTColor.Red
% * DeviceMode.HTColor.Green
% * DeviceMode.HTColor.Blue
% * DeviceMode.HTColor.White
% * DeviceMode.HTColor.Raw
% * DeviceMode.HTColor.Nr,
% * DeviceMode.HTColor.All
% debug (bool): Debug turned on or off. In debug mode, everytime a command is passed to
% the sublayer ('communication layer'), there is feedback in the console about what
% command has been called. *[WRITABLE]*
......@@ -51,6 +91,9 @@ classdef Sensor < MaskedHandle
% * DeviceType.UltraSonic
% * DeviceType.Gyro
% * DeviceType.InfraRed
% * DeviceType.HTColor
% * DeviceType.HTCompass
% * DeviceType.HTAccelerometer
% * DeviceType.Unknown
% * DeviceType.None
% * DeviceType.Error
......@@ -76,7 +119,46 @@ classdef Sensor < MaskedHandle
% * Gyro-Sensor:
% * DeviceMode.Gyro.Angular [Default]
% * DeviceMode.Gyro.Rate
%
% * Infrared-Sensor:
% * DeviceMode.InfraRed.Prox [Default]
% * DeviceMode.InfraRed.Seek
% * DeviceMode.InfraRed.Remote
% * NXTColor-Sensor:
% * DeviceMode.NXTColor.Reflect [Default]
% * DeviceMode.NXTColor.Ambient
% * DeviceMode.NXTColor.Color
% * DeviceMode.NXTColor.Green
% * DeviceMode.NXTColor.Blue
% * DeviceMode.NXTColor.Raw
% * NXTLight-Sensor:
% * DeviceMode.NXTLight.Reflect [Default]
% * DeviceMode.NXTLigth.Ambient
% * NXTSound-Sensor:
% * DeviceMode.NXTSound.DB [Default]
% * DeviceMode.NXTSound.DBA
% * NXTTemperature-Sensor
% * DeviceMode.NXTTemperature.C [Default]
% * DeviceMode.NXTTemperature.F
% * NXTTouch-Sensor:
% * DeviceMode.NXTTouch.Pushed [Default]
% * DeviceMode.NXTTouch.Bumps
% * NXTUltraSonic-Sensor:
% * DeviceMode.NXTUltraSonic.CM [Default]
% * DeviceMode.NXTUltraSonic.IN
% * HTAccelerometer-Sensor:
% * DeviceMode.HTAccelerometer.Acceleration [Default]
% * DeviceMode.HTAccelerometer.AccelerationAllAxes
% * HTCompass-Sensor:
% * DeviceMode.HTCompass.Degrees [Default]
% * HTColor-Sensor:
% * DeviceMode.HTColor.Col [Default]
% * DeviceMode.HTColor.Red
% * DeviceMode.HTColor.Green
% * DeviceMode.HTColor.Blue
% * DeviceMode.HTColor.White
% * DeviceMode.HTColor.Raw
% * DeviceMode.HTColor.Nr,
% * DeviceMode.HTColor.All
% See also SENSOR.VALUE, SENSOR.TYPE
mode;
......@@ -87,13 +169,13 @@ classdef Sensor < MaskedHandle
end
properties (Dependent) % Parameters to be read directly from physical brick
% value (numeric): Value read from hysical sensor. What the value represents depends on
% sensor.mode. *[READ-ONLY]*
% value (numeric): Value read from physical sensor. [READ-ONLY]
% What the value represents depends on sensor.mode.
% See also SENSOR.MODE
value;
% type (DeviceType): Type of physical sensor connected to the port. Possible types are
% *[READ-ONLY]*:
% type (DeviceType): Type of physical sensor connected to the port. [READ-ONLY]
% Possible types are:
% * DeviceType.NXTTouch
% * DeviceType.NXTLight
% * DeviceType.NXTSound
......@@ -107,6 +189,9 @@ classdef Sensor < MaskedHandle
% * DeviceType.UltraSonic
% * DeviceType.Gyro
% * DeviceType.InfraRed
% * DeviceType.HTColor
% * DeviceType.HTCompass
% * DeviceType.HTAccelerometer
% * DeviceType.Unknown
% * DeviceType.None
% * DeviceType.Error
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment