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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mindstorms
ev3-toolbox-matlab
Commits
a8eb7041
Commit
a8eb7041
authored
5 years ago
by
Maximilian Schnabel
Browse files
Options
Downloads
Patches
Plain Diff
Added additional information about output of sensors
parent
238631b5
No related branches found
No related tags found
2 merge requests
!7
Keep going if mountpoint exists (persistent)
,
!6
Docs NXT compatibility
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
source/Sensor.m
+77
-10
77 additions, 10 deletions
source/Sensor.m
with
77 additions
and
10 deletions
source/Sensor.m
+
77
−
10
View file @
a8eb7041
classdef
Sensor
<
MaskedHandle
classdef
Sensor
<
MaskedHandle
% High-level class to work with sensors.
% High-level class to work with sensors. Information given in this doc can be used to adjust settings of
% sensor objects within the EV3 class.
%
%
% The Sensor-class facilitates the communication with sensors. This mainly consists of
% The Sensor-class facilitates the communication with sensors. This mainly consists of
% reading the sensor's type and current value in a specified mode.
% reading the sensor's type and current value in a specified mode.
...
@@ -18,58 +19,120 @@ classdef Sensor < MaskedHandle
...
@@ -18,58 +19,120 @@ classdef Sensor < MaskedHandle
%
%
% * Touch-Sensor:
% * Touch-Sensor:
% * DeviceMode.Touch.Pushed *[Default]*
% * DeviceMode.Touch.Pushed *[Default]*
% *Output: 0: not pushed, 1: pushed
% * DeviceMode.Touch.Bumps
% * DeviceMode.Touch.Bumps
% *Output: n: number of times being pushed
% * Ultrasonic-Sensor:
% * Ultrasonic-Sensor:
% * DeviceMode.UltraSonic.DistCM *[Default]*
% * DeviceMode.UltraSonic.DistCM *[Default]*
% *Output: distance in cm
% *Note: actively creates ultrasonic sound
% * DeviceMode.UltraSonic.DistIn
% * DeviceMode.UltraSonic.DistIn
% *Output: distance in inches
% *Note: actively creates ultrasonic sound
% * DeviceMode.UltraSonic.Listen
% * DeviceMode.UltraSonic.Listen
% *Output: distance in cm
% *Note: ONLY listens to other sources (sensors) of ultrasonic sound
% * Color-Sensor:
% * Color-Sensor:
% * DeviceMode.Color.Reflect *[Default]*
% * DeviceMode.Color.Reflect *[Default]*
% *Output: value in range 0% to 100% brightness
% * DeviceMode.Color.Ambient
% * DeviceMode.Color.Ambient
% *Output: value in range 0% to 100% brightness
% * DeviceMode.Color.Col
% * DeviceMode.Color.Col
% *Output: none, black, blue, green. yellow, red, white, brown
% * Gyro-Sensor:
% * Gyro-Sensor:
% * DeviceMode.Gyro.Angular *[Default]*
% * DeviceMode.Gyro.Angular *[Default]*
% * DeviceMode.Gyro.Rate
% * DeviceMode.Gyro.Rate
% *Output: rotational speed [degree/s]. Expect small offset in resting position
% * Infrared-Sensor:
% * Infrared-Sensor:
% * DeviceMode.InfraRed.Prox *[Default]*
% * DeviceMode.InfraRed.Prox *[Default]*
% * Note: currently not recognized
% * DeviceMode.InfraRed.Seek
% * DeviceMode.InfraRed.Seek
% * DeviceMode.InfraRed.Remote
% * DeviceMode.InfraRed.Remote
% * NXTColor-Sensor:
% * NXTColor-Sensor:
% * DeviceMode.NXTColor.Reflect *[Default]*
% * DeviceMode.NXTColor.Reflect *[Default]*
% *Output: value in range 0% to 100% brightness
% * DeviceMode.NXTColor.Ambient
% * DeviceMode.NXTColor.Ambient
% *Output: value in range 0% to 100% brightness
% * DeviceMode.NXTColor.Color
% * DeviceMode.NXTColor.Color
% *Output: value representing color:
% 1 - black
% 2 - blue
% 3 - green
% 4 - yellow
% 5 - red
% 6 - white
% 7 - brown
% * DeviceMode.NXTColor.Green
% * DeviceMode.NXTColor.Green
% *Output: value in range 0% to 100% of green reflectivityniedrige intensität farbe
% * DeviceMode.NXTColor.Blue
% * DeviceMode.NXTColor.Blue
% *Output: value in range 0% to 100% of blue reflectivity
% * DeviceMode.NXTColor.Raw
% * DeviceMode.NXTColor.Raw
% *Note: obsolete, functionality available in other modes. Also not working properly. Returning 1 value instead of 3
% * NXTLight-Sensor:
% * NXTLight-Sensor:
% * DeviceMode.NXTLight.Reflect *[Default]*
% * DeviceMode.NXTLight.Reflect *[Default]*
% *Output: value in range 0% to 100% brightness
% * DeviceMode.NXTLight.Ambient
% * DeviceMode.NXTLight.Ambient
% *Output: value in range 0% to 100% brightness
% * NXTSound-Sensor:
% * NXTSound-Sensor:
% * DeviceMode.NXTSound.DB *[Default]*
% * DeviceMode.NXTSound.DB *[Default]*
% *Output: value in decibel
% * DeviceMode.NXTSound.DBA
% * DeviceMode.NXTSound.DBA
% *Output: value in dba weighted according to human hearing
% * NXTTemperature-Sensor
% * NXTTemperature-Sensor
% * DeviceMode.NXTTemperature.C *[Default]*
% * DeviceMode.NXTTemperature.C *[Default]*
% * DeviceMode.NXTTemperature.F
% * DeviceMode.NXTTemperature.F
% * NXTTouch-Sensor:
% * NXTTouch-Sensor:
% * DeviceMode.NXTTouch.Pushed *[Default]*
% * DeviceMode.NXTTouch.Pushed *[Default]*
% *Output: 0: not pushed, 1: pushed
% * DeviceMode.NXTTouch.Bumps
% * DeviceMode.NXTTouch.Bumps
% *Output: n: number of times pressed and released
% * NXTUltraSonic-Sensor:
% * NXTUltraSonic-Sensor:
% * DeviceMode.NXTUltraSonic.CM *[Default]*
% * DeviceMode.NXTUltraSonic.CM *[Default]*
% *Output: distance in cm
% * DeviceMode.NXTUltraSonic.IN
% * DeviceMode.NXTUltraSonic.IN
% *Output: distance in inches
% * HTAccelerometer-Sensor:
% * HTAccelerometer-Sensor:
% * DeviceMode.HTAccelerometer.Acceleration *[Default]*
% * DeviceMode.HTAccelerometer.Acceleration *[Default]*
% * DeviceMode.HTAccelerometer.AccelerationAllAxes
% * DeviceMode.HTAccelerometer.AccelerationAllAxes
% *Note: Not working properly. Returning 1 value instead of 6
% * HTCompass-Sensor:
% * HTCompass-Sensor:
% * DeviceMode.HTCompass.Degrees *[Default]*
% * DeviceMode.HTCompass.Degrees *[Default]*
% * Note: currently not recognized
% * HTColor-Sensor:
% * HTColor-Sensor:
% * DeviceMode.HTColor.Col *[Default]*
% * DeviceMode.HTColor.Col *[Default]*
% *Output: value representing color:
% 0 - black
% 1 - purple
% 2 - blue
% 3 - cyan
% 4 - green
% 5 - green/ yellow
% 6 - yellow
% 7 - orange
% 8 - red
% 9 - magenta
% 10 - pink
% 11 - low saturation blue
% 12 - low saturation green
% 13 - low saturation yellow
% 14 - low saturation orange
% 15 - low saturation red
% 16 - low saturation pink
% 17 - white
% * DeviceMode.HTColor.Red
% * DeviceMode.HTColor.Red
% *Output: value in range 0 to 255 of red reflectivity
% * DeviceMode.HTColor.Green
% * DeviceMode.HTColor.Green
% *Output: value in range 0 to 255 of green reflectivity
% * DeviceMode.HTColor.Blue
% * DeviceMode.HTColor.Blue
% *Output: value in range 0 to 255 of blue reflectivity
% * DeviceMode.HTColor.White
% * DeviceMode.HTColor.White
% *Output: value in range 0 to 255 of white reflectivity
% * DeviceMode.HTColor.Raw
% * DeviceMode.HTColor.Raw
% * DeviceMode.HTColor.Nr,
% *Note: obsolete, color values available in other modes. Also not working properly. Returning 1 value instead of 3
% * DeviceMode.HTColor.Nrm,
% *Note: obsolete, normalized values available in other modes. Also not working properly. Returning 1 value instead of 4
% * DeviceMode.HTColor.All
% * DeviceMode.HTColor.All
% *Note: obsolete, all values available in other modes. Also not working properly. Returning 1 value instead of 4
% debug (bool): Debug turned on or off. In debug mode, everytime a command is passed to
% 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
% the sublayer ('communication layer'), there is feedback in the console about what
% command has been called. *[WRITABLE]*
% command has been called. *[WRITABLE]*
...
@@ -100,7 +163,7 @@ classdef Sensor < MaskedHandle
...
@@ -100,7 +163,7 @@ classdef Sensor < MaskedHandle
properties
% Standard properties to be set by user
properties
% Standard properties to be set by user
% mode (DeviceMode.{Type}): Sensor mode in which the value will be read. By default,
% mode (DeviceMode.{Type}): Sensor mode in which the value will be read. By default,
% mode is set to DeviceMode.Default.Undefined. Once a physical sensor is connected
% mode is set to DeviceMode.Default.Undefined. Once a physical sensor is connected
% to the port *and* the physical Brick is connected to the EV3-object, the allowed
% to the port *and* the physical Brick is connected to the EV3-object
afterwards
, the allowed
% mode and the default mode for a Sensor-object are the following (depending on the
% mode and the default mode for a Sensor-object are the following (depending on the
% sensor type): [WRITABLE]
% sensor type): [WRITABLE]
%
%
...
@@ -289,11 +352,15 @@ classdef Sensor < MaskedHandle
...
@@ -289,11 +352,15 @@ classdef Sensor < MaskedHandle
% mode (DeviceMode.{Type}): *[OPTIONAL]*
% mode (DeviceMode.{Type}): *[OPTIONAL]*
%
%
% Example:
% Example:
% b = EV3(); % |br|
% b = EV3(); |br|
% b.connect('bt', 'serPort', '/dev/rfcomm0'); % |br|
% b.connect('bt', 'serPort', '/dev/rfcomm0'); |br|
% b.sensor1.setProperties('debug', 'on', 'mode', DeviceMode.Color.Ambient); % |br|
%
% % Instead of: b.sensor1.debug = 'on'; |br|
% % use the following line:
% % b.sensor1.mode = DeviceMode.Color.Ambient; |br|
% b.sensor1.setProperties('debug', 'on', 'mode', DeviceMode.Color.Ambient); |br|
%
% % Instead of:
% b.sensor1.debug = 'on'; |br|
% b.sensor1.mode = DeviceMode.Color.Ambient; |br|
%
%
p
=
inputParser
();
p
=
inputParser
();
...
...
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