Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ev3-toolbox-matlab
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mindstorms
ev3-toolbox-matlab
Commits
3062ff73
Commit
3062ff73
authored
7 years ago
by
Tim Stadtmann
Browse files
Options
Downloads
Patches
Plain Diff
Add Device-class from which HL classes now inherit
WIP, not yet working. Only implemented debug-parameter as a first test
parent
22d352ce
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
source/EV3.m
+7
-17
7 additions, 17 deletions
source/EV3.m
source/Motor.m
+2
-15
2 additions, 15 deletions
source/Motor.m
source/Sensor.m
+2
-16
2 additions, 16 deletions
source/Sensor.m
with
11 additions
and
48 deletions
source/EV3.m
+
7
−
17
View file @
3062ff73
classdef
EV3
<
MaskedHandl
e
classdef
EV3
<
Devic
e
% High-level class to work with physical bricks.
%
% This is the 'central' class (from user's view) when working with this toolbox. It
...
...
@@ -53,14 +53,6 @@ classdef EV3 < MaskedHandle
% batteryMode (string in {'Percentage', 'Voltage'}): Mode for reading battery charge. [WRITABLE]
% See also BATTERYVALUE
batteryMode
;
% debug (numeric in {0,1,2}): Debug mode. [WRITABLE]
% - 0: Debug turned off
% - 1: (High-level-) Debug turned on for EV3-object - enables feedback in the
% console about what firmware-commands have been called when using a method
% - 2: Low-level-Debug turned on - each packet sent and received is printed to the
% console
debug
;
end
properties
(
Dependent
)
% Parameters to be read directly from physical brick
...
...
@@ -101,18 +93,16 @@ classdef EV3 < MaskedHandle
sensor4
;
end
properties
(
Access
=
private
)
properties
(
Hidden
,
Access
=
protected
)
% Hidden properties for internal use only
% init (bool): Indicates init-phase (i.e. constructor is running).
init
=
true
;
% commInterface (CommunicationInterface): Interface to communication layer
% All commands sent to the Brick are created and written through this object. Each
% Motor- and Sensor-object has a reference to it.
commInterface
=
0
;
end
properties
(
Hidden
,
Access
=
private
)
% Hidden properties for internal use only
% init (bool): Indicates init-phase (i.e. constructor is running).
init
=
true
;
end
methods
% Standard methods
%% Constructor
function
ev3
=
EV3
(
varargin
)
...
...
@@ -394,8 +384,8 @@ classdef EV3 < MaskedHandle
ev3
.
batteryMode
=
batteryMode
;
end
function
set
.
d
ebug
(
ev3
,
debug
)
function
set
D
ebug
(
ev3
,
debug
)
if
~
isBool
(
debug
)
&&
debug
~=
2
error
(
'EV3::set.debug: Given parameter is not a bool.'
);
end
...
...
This diff is collapsed.
Click to expand it.
source/Motor.m
+
2
−
15
View file @
3062ff73
classdef
Motor
<
MaskedHandl
e
&
dynamicprops
classdef
Motor
<
Devic
e
&
dynamicprops
% High-level class to work with motors.
%
% This class is supposed to ease the use of the brick's motors. It is possible to set all
...
...
@@ -91,11 +91,6 @@ classdef Motor < MaskedHandle & dynamicprops
% 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. [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
properties
(
Dependent
)
% Read-only parameters to be read directly from physical brick
...
...
@@ -115,7 +110,7 @@ classdef Motor < MaskedHandle & dynamicprops
type
;
end
properties
(
Hidden
,
Access
=
pr
ivate
)
% Hidden properties for internal use only
properties
(
Hidden
,
Access
=
pr
otected
)
% Hidden properties for internal use only
% commInterface (CommunicationInterface): Commands are created and sent via the
% communication interface class.
commInterface
;
...
...
@@ -791,14 +786,6 @@ classdef Motor < MaskedHandle & dynamicprops
motor
.
commInterface
=
comm
;
end
function
set
.
debug
(
motor
,
debug
)
if
~
isBool
(
debug
)
error
(
'Motor::set.debug: Given parameter is not a bool.'
);
end
motor
.
debug
=
str2bool
(
debug
);
end
function
setProperties
(
motor
,
varargin
)
% Sets multiple Motor properties at once using MATLAB's inputParser.
%
...
...
This diff is collapsed.
Click to expand it.
source/Sensor.m
+
2
−
16
View file @
3062ff73
classdef
Sensor
<
MaskedHandl
e
classdef
Sensor
<
Devic
e
% High-level class to work with sensors.
%
% The Sensor-class facilitates the communication with sensors. This mainly consists of
...
...
@@ -160,11 +160,6 @@ classdef Sensor < MaskedHandle
% * DeviceMode.HTColor.All
% See also SENSOR.VALUE, SENSOR.TYPE
mode
;
% 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
;
end
properties
(
Dependent
)
% Parameters to be read directly from physical brick
...
...
@@ -197,7 +192,7 @@ classdef Sensor < MaskedHandle
type
;
end
properties
(
Hidden
,
Access
=
pr
ivate
)
% Hidden properties for internal use only
properties
(
Hidden
,
Access
=
pr
otected
)
% Hidden properties for internal use only
% commInterface (CommunicationInterface): Commands are created and sent via the
% communication interface class.
commInterface
;
...
...
@@ -282,15 +277,6 @@ classdef Sensor < MaskedHandle
end
end
function
set
.
debug
(
sensor
,
debug
)
% Check if debug is valid and set sensor.debug if it is.
if
~
isBool
(
debug
)
error
(
'Sensor::set.debug: Given parameter is not a bool.'
);
end
sensor
.
debug
=
str2bool
(
debug
);
end
function
set
.
port
(
sensor
,
port
)
if
~
isPortStrValid
(
class
(
sensor
),
port
)
error
(
'Sensor::set.port: Given port is not a valid port.'
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment