From bf5fa80a1133969560890e2eeba55f19ece9e518 Mon Sep 17 00:00:00 2001 From: Maximilian Schnabel <maximilian.schnabel@rwth-aachen.de> Date: Tue, 14 Jan 2020 14:08:49 +0100 Subject: [PATCH] adjusted doc formatting --- source/Sensor.m | 149 +++++++++++++++++++++++------------------------- 1 file changed, 70 insertions(+), 79 deletions(-) diff --git a/source/Sensor.m b/source/Sensor.m index b3a3956..df52ae2 100644 --- a/source/Sensor.m +++ b/source/Sensor.m @@ -1,9 +1,21 @@ classdef Sensor < MaskedHandle - % 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. + % Information given in this section can be used to configure a sensor's measurements. + % For example the Touch-Sensor is capable of either detecting whether it is being pushed, or count the number of pushes. + % In order to change it's mode and hence it's return values, an EV3 object has to be created and connected beforehand. Assuming the physical sensor has + % been connected to sensor port 1 of the physical brick, the mode change is done as follows: + % + % :: + % + % Example: + % //initialization: + % brick = EV3() + % brick.connect('usb') + % + % //changing mode of sensor: + % brick.sensor1.mode = DeviceMode.Touch.Bumps + % + % The available modes to a given sensor are described in the Attributes section. % - % The Sensor-class facilitates the communication with sensors. This mainly consists of - % reading the sensor's type and current value in a specified mode. % % Notes: % * You don't need to create instances of this class. The EV3-class automatically creates @@ -19,124 +31,99 @@ classdef Sensor < MaskedHandle % % * Touch-Sensor: % * DeviceMode.Touch.Pushed *[Default]* - % *Output: 0: not pushed, 1: pushed + % * Output: 0: not pushed, 1: pushed % * DeviceMode.Touch.Bumps - % *Output: n: number of times being pushed + % * Output: n: number of times being pushed % * Ultrasonic-Sensor: % * DeviceMode.UltraSonic.DistCM *[Default]* - % *Output: distance in cm - % *Note: actively creates ultrasonic sound + % * Output: distance in cm + % * Note: actively creates ultrasonic sound % * DeviceMode.UltraSonic.DistIn - % *Output: distance in inches - % *Note: actively creates ultrasonic sound + % * Output: distance in inches + % * Note: actively creates ultrasonic sound % * DeviceMode.UltraSonic.Listen - % *Output: distance in cm - % *Note: ONLY listens to other sources (sensors) of ultrasonic sound + % * Output: distance in cm + % * Note: ONLY listens to other sources (sensors) of ultrasonic sound % * Color-Sensor: % * DeviceMode.Color.Reflect *[Default]* - % *Output: value in range 0% to 100% brightness + % * Output: value in range 0% to 100% brightness % * DeviceMode.Color.Ambient - % *Output: value in range 0% to 100% brightness + % * Output: value in range 0% to 100% brightness % * DeviceMode.Color.Col - % *Output: none, black, blue, green. yellow, red, white, brown + % * Output: none, black, blue, green. yellow, red, white, brown % * Gyro-Sensor: % * DeviceMode.Gyro.Angular *[Default]* - % *Note: value appears to be rising indefinitely, even in resting position + % * Note: value appears to be rising indefinitely, even in resting position % * DeviceMode.Gyro.Rate - % *Output: rotational speed [degree/s]. Expect small offset in resting position + % * Output: rotational speed [degree/s]. Expect small offset in resting position % * Infrared-Sensor: % * DeviceMode.InfraRed.Prox *[Default]* - % * Note: currently not recognized + % * Note: currently not recognized % * DeviceMode.InfraRed.Seek % * DeviceMode.InfraRed.Remote % * NXTColor-Sensor: % * DeviceMode.NXTColor.Reflect *[Default]* - % *Output: value in range 0% to 100% brightness + % * Output: value in range 0% to 100% brightness % * DeviceMode.NXTColor.Ambient - % *Output: value in range 0% to 100% brightness + % * Output: value in range 0% to 100% brightness % * DeviceMode.NXTColor.Color - % *Output: value representing color: - % 1 - black - % 2 - blue - % 3 - green - % 4 - yellow - % 5 - red - % 6 - white - % 7 - brown + % * Output: value representing color: 1-black, 2-blue, 3-green, 4-yellow, 5-red, 6-white, 7-brown % * DeviceMode.NXTColor.Green - % *Output: value in range 0% to 100% of green reflectivity + % * Output: value in range 0% to 100% of green reflectivity % * DeviceMode.NXTColor.Blue - % *Output: value in range 0% to 100% of blue reflectivity + % * Output: value in range 0% to 100% of blue reflectivity % * DeviceMode.NXTColor.Raw - % *Note: obsolete, functionality available in other modes. Also not working properly. Returning 1 value instead of 3 + % * Note: obsolete, functionality available in other modes. Also not working properly. Returning 1 value instead of 3 % * NXTLight-Sensor: % * DeviceMode.NXTLight.Reflect *[Default]* - % *Output: value in range 0% to 100% brightness + % * Output: value in range 0% to 100% brightness % * DeviceMode.NXTLight.Ambient - % *Output: value in range 0% to 100% brightness + % * Output: value in range 0% to 100% brightness % * NXTSound-Sensor: % * DeviceMode.NXTSound.DB *[Default]* - % *Output: value in decibel + % * Output: value in decibel % * DeviceMode.NXTSound.DBA - % *Output: value in dba weighted according to human hearing + % * Output: value in dba weighted according to human hearing % * NXTTemperature-Sensor % * DeviceMode.NXTTemperature.C *[Default]* - % *Output: value in Celsius + % * Output: value in Celsius % * DeviceMode.NXTTemperature.F - % *Output: value in Fahrenheit + % * Output: value in Fahrenheit % * NXTTouch-Sensor: % * DeviceMode.NXTTouch.Pushed *[Default]* - % * Output: 0: not pushed, 1: pushed + % * Output: 0: not pushed, 1: pushed % * DeviceMode.NXTTouch.Bumps - % * Output: n: number of times pressed and released + % * Output: n: number of times pressed and released % * NXTUltraSonic-Sensor: % * DeviceMode.NXTUltraSonic.CM *[Default]* - % * Output: distance in cm + % * Output: distance in cm % * DeviceMode.NXTUltraSonic.IN - % * Output: distance in inches + % * Output: distance in inches % * HTAccelerometer-Sensor: % * DeviceMode.HTAccelerometer.Acceleration *[Default]* % * DeviceMode.HTAccelerometer.AccelerationAllAxes - % * Note: Not working properly. Returning 1 value instead of 6 + % * Note: Not working properly. Returning 1 value instead of 6 % * HTCompass-Sensor: % * DeviceMode.HTCompass.Degrees *[Default]* - % * Note: 'Error' mode assigned, value still appears to be correct. - % * Output: 0 to 180 degree. 45° being north, 90° east etc + % * Note: 'Error' mode assigned, value still appears to be correct. + % * Output: 0 to 180 degree. 45° being north, 90° east etc % * HTColor-Sensor: % * 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 + % * 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 - % *Output: value in range 0 to 255 of red reflectivity + % * Output: value in range 0 to 255 of red reflectivity % * DeviceMode.HTColor.Green - % *Output: value in range 0 to 255 of green reflectivity + % * Output: value in range 0 to 255 of green reflectivity % * DeviceMode.HTColor.Blue - % *Output: value in range 0 to 255 of blue reflectivity + % * Output: value in range 0 to 255 of blue reflectivity % * DeviceMode.HTColor.White - % *Output: value in range 0 to 255 of white reflectivity + % * Output: value in range 0 to 255 of white reflectivity % * DeviceMode.HTColor.Raw - % *Note: obsolete, color values available in other modes. Also not working properly. Returning 1 value instead of 3 + % * 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 + % * Note: obsolete, normalized values available in other modes. Also not working properly. Returning 1 value instead of 4 % * DeviceMode.HTColor.All - % *Note: obsolete, all values available in other modes. Also not working properly. Returning 1 value instead of 4 + % * 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 % the sublayer ('communication layer'), there is feedback in the console about what % command has been called. *[WRITABLE]* @@ -163,6 +150,8 @@ classdef Sensor < MaskedHandle % * DeviceType.Unknown % * DeviceType.None % * DeviceType.Error + % + properties % Standard properties to be set by user % mode (DeviceMode.{Type}): Sensor mode in which the value will be read. By default, @@ -355,16 +344,18 @@ classdef Sensor < MaskedHandle % debug (bool): *[OPTIONAL]* % mode (DeviceMode.{Type}): *[OPTIONAL]* % - % Example: - % b = EV3(); |br| - % b.connect('bt', 'serPort', '/dev/rfcomm0'); |br| - % - % % use the following line: - % b.sensor1.setProperties('debug', 'on', 'mode', DeviceMode.Color.Ambient); |br| + % :: + % + % Example: + % brick = EV3() + % brick.connect('bt', 'serPort', '/dev/rfcomm0'); + % + % % use the following line: + % brick.sensor1.setProperties('debug', 'on', 'mode', DeviceMode.Color.Ambient); % - % % Instead of: - % b.sensor1.debug = 'on'; |br| - % b.sensor1.mode = DeviceMode.Color.Ambient; |br| + % % Instead of: + % brick.sensor1.debug = 'on'; + % brick.sensor1.mode = DeviceMode.Color.Ambient; % p = inputParser(); -- GitLab