Changeset 57
- Timestamp:
- 05/22/08 20:38:12 (5 years ago)
- Location:
- branches/workshop/IOModules
- Files:
-
- 6 modified
-
GetOutputModuleMap.m (modified) (5 diffs)
-
NXT_PlaySoundFile.m (modified) (2 diffs)
-
NXT_Read_IO_Map.m (modified) (2 diffs)
-
NXT_StopSoundPlayback.m (modified) (2 diffs)
-
NXT_Write_IO_Map.m (modified) (2 diffs)
-
SetOutputModuleMap.m (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/workshop/IOModules/GetOutputModuleMap.m
r56 r57 3 3 % 4 4 % Syntax 5 % map = GetOutputModuleMap(motor)5 % |map = GetOutputModuleMap(motor)| 6 6 % 7 7 % Description … … 20 20 % since program start) 21 21 % 22 % map.TachoLimit % current settacho/angle limit, 0 means none set22 % map.TachoLimit % tacho/angle limit, 0 means none set 23 23 % 24 24 % map.MotorRPM % current pulse width modulation ? … … 30 30 % map.ModeName % output mode name interpreted by output mode bitfield 31 31 % 32 % map.Speed % currentmotor power/speed32 % map.Speed % motor power/speed 33 33 % 34 34 % map.ActualSpeed % current actual percentage of full power (regulation mode) … … 54 54 % 55 55 % Examples 56 % map = GetOutputModuleMap(MOTOR_A);56 %+ map = GetOutputModuleMap(MOTOR_A); 57 57 % 58 % map = GetOutputModuleMap('all');58 %+ map = GetOutputModuleMap('all'); 59 59 % 60 60 % See also: NXT_Read_IO_Map … … 79 79 % * You should have received a copy of the GNU General Public License along with the * 80 80 % * RWTH - Mindstorms NXT Toolbox. If not, see <http://www.gnu.org/licenses/>. * 81 % ********************************************************************************************* **81 % *********************************************************************************************** 82 82 83 83 % Information from -
branches/workshop/IOModules/NXT_PlaySoundFile.m
r54 r57 3 3 % 4 4 % Syntax 5 % NXT_PlaySoundFile(filename, 1)5 % |NXT_PlaySoundFile(filename, 1)| 6 6 % 7 % NXT_PlaySoundFile(filename, bt_handle)7 % |NXT_PlaySoundFile(filename, bt_handle)| 8 8 % 9 9 % Description … … 21 21 % 22 22 % Examples 23 % NXT_PlaySoundFile('Goodmorning', 0);23 %+ NXT_PlaySoundFile('Goodmorning', 0); 24 24 % 25 % bt_handle = BT_OpenHandle('bluetooth.ini','check');26 % NXT_StartProgram('Goodmorning.rso', 1, bt_handle);25 %+ bt_handle = BT_OpenHandle('bluetooth.ini','check'); 26 %+ NXT_StartProgram('Goodmorning.rso', 1, bt_handle); 27 27 % 28 28 % See also: NXT_StopSoundPlayback -
branches/workshop/IOModules/NXT_Read_IO_Map.m
r53 r57 3 3 % 4 4 % Syntax 5 % bytes = NXT_Read_IO_Map(mod_id, offset, n_bytes)5 % |bytes = NXT_Read_IO_Map(mod_id, offset, n_bytes)| 6 6 % 7 % bytes = NXT_Read_IO_Map(mod_id, offset, n_bytes, bt_handle)7 % |bytes = NXT_Read_IO_Map(mod_id, offset, n_bytes, bt_handle)| 8 8 % 9 9 % Description … … 20 20 % 21 21 % Examples 22 % OutputModuleID = 13107323 % bytes = NXT_Read_IO_Map(OutputModuleID, 0, 29);22 %+ OutputModuleID = 131073 23 %+ bytes = NXT_Read_IO_Map(OutputModuleID, 0, 29); 24 24 % 25 % bt_handle = BT_OpenHandle('bluetooth.ini','check');26 % OutputModuleID = 13107327 % SoundModuleID = 524289, 0, 30, bt_handle);25 %+ bt_handle = BT_OpenHandle('bluetooth.ini','check'); 26 %+ OutputModuleID = 131073 27 %+ SoundModuleID = 524289, 0, 30, bt_handle); 28 28 % 29 29 % See also: NXT_Write_IO_Map, BT_GetDefaultHandle -
branches/workshop/IOModules/NXT_StopSoundPlayback.m
r54 r57 3 3 % 4 4 % Syntax 5 % NXT_StopSoundPlayback()5 % |NXT_StopSoundPlayback()| 6 6 % 7 % NXT_StopSoundPlayback(bt_handle)7 % |NXT_StopSoundPlayback(bt_handle)| 8 8 % 9 9 % Description … … 18 18 % 19 19 % Examples 20 % NXT_StopSoundPlayback();20 %+ NXT_StopSoundPlayback(); 21 21 % 22 % bt_handle = BT_OpenHandle('bluetooth.ini','check');23 % NXT_StopSoundPlayback(bt_handle);22 %+ bt_handle = BT_OpenHandle('bluetooth.ini','check'); 23 %+ NXT_StopSoundPlayback(bt_handle); 24 24 % 25 25 % See also: NXT_PlaySoundFile, NXT_PlayTone, BT_GetDefaultHandle -
branches/workshop/IOModules/NXT_Write_IO_Map.m
r53 r57 3 3 % 4 4 % Syntax 5 % NXT_Write_IO_Map(mod_id, offset, n_bytes, data)5 % |NXT_Write_IO_Map(mod_id, offset, n_bytes, data)| 6 6 % 7 % NXT_Write_IO_Map(mod_id, offset, n_bytes, data, bt_handle)7 % |NXT_Write_IO_Map(mod_id, offset, n_bytes, data, bt_handle)| 8 8 % 9 9 % Description … … 20 20 % 21 21 % Examples 22 % OutputModuleID = 13107323 % NXT_Write_IO_Map(OutputModuleID, 0, 30, bytes;22 %+ OutputModuleID = 131073 23 %+ NXT_Write_IO_Map(OutputModuleID, 0, 30, bytes; 24 24 % 25 % bt_handle = BT_OpenHandle('bluetooth.ini','check');26 % OutputModuleID = 13107327 % NXT_Write_IO_Map(OutputModuleID, 0, 30, bytes, bt_handle);25 %+ bt_handle = BT_OpenHandle('bluetooth.ini','check'); 26 %+ OutputModuleID = 131073 27 %+ NXT_Write_IO_Map(OutputModuleID, 0, 30, bytes, bt_handle); 28 28 % 29 29 % See also: NXT_Read_IO_Map, BT_GetDefaultHandle -
branches/workshop/IOModules/SetOutputModuleMap.m
r52 r57 1 1 function SetOutputModuleMap(motor, map, varargin) 2 2 % Writes the IO map to the output module 3 % 4 % Syntax 5 % |SetOutputModuleMap(motor, map)| 6 % 7 % |SetOutputModuleMap(motor, map, varargin)| 8 % 9 % Description 10 % map = SetOutputModuleMap(motor, map) writes the IO map to the output module at the given motor 11 % port. The motor port can be addressed by MOTOR_A, MOTOR_B, MOTOR_C. The map structure has 12 % to provide all output module information, listed below. 13 % 14 % Input: 15 % map.TachoCount % internal, non-resettable rotation-counter (in degrees) 16 % 17 % map.BlockTachoCount % block tacho counter, current motor position, resettable using, 18 % ResetMotorAngle (NXT-G counter since block start) 19 % 20 % map.RotationCount % rotation tacho counter, current motor position (NXT-G counter 21 % since program start) 22 % 23 % map.TachoLimit % current set tacho/angle limit, 0 means none set 24 % 25 % map.MotorRPM % current pulse width modulation ? 26 % 27 % map.Flags % update flag bitfield, commits any changing (see also varargin) 28 % 29 % map.Mode % output mode bitfield 1: MOTORON, 2: BRAKE, 4: REGULATED 30 % 31 % map.Speed % current motor power/speed 32 % 33 % map.ActualSpeed % current actual percentage of full power (regulation mode) 34 % 35 % map.RegPParameter % proportional term of the internal PID control algorithm 36 % 37 % map.RegIParameter % integral term of the internal PID control algorithm 38 % 39 % map.RegDParameter % derivate term of the internal PID control algorithm 40 % 41 % map.RunStateByte % run state byte 42 % 43 % map.RegModeByte % regulation mode byte 44 % 45 % map.Overloaded % overloaded flag (true: speed regulation is unable to onvercome 46 % physical load on the motor) 47 % 48 % map.SyncTurnParam % current turn ratio, 1: 25%, 2:50%, 3:75%, 4:100% of full volume 49 % 50 % map = SetOutputModuleMap(motor, map, varargin) sets the update flags explicit by the given 51 % arguments. 52 % 'UpdateMode': commits changes to the mode property 53 % 'UpdateSpeed': commits changes to the speed property 54 % 'UpdateTachoLimit': commits changes to the tacho limit property 55 % 'ResetErrorCorrection': resets internal movement counters, cancels current goal, and resets 56 % internal error-correction system 57 % 'UpdatePID': commits changes to PID regulation parameters 58 % 'ResetBlockTachoCount': resets block tacho count (block-relative position counter (NXT-G)) 59 % 'ResetRotationCount': resets rotation count (program-relative position counter (NXT-G)) 60 % 61 % Examples 62 %+ SetOutputModuleMap(MOTOR_A, map); 63 % 64 %+ SetOutputModuleMap(MOTOR_A, map, 'UpdateSpeed', 'UpdateTachoLimit', 'UpdatePID'); 65 % 66 % See also: GetOutputModuleMap, NXT_Write_IO_Map 67 % 68 % Signature 69 % Author: Alexander Behrens (see AUTHORS) 70 % Date: 2008/05/22 71 % Copyright: 2008, RWTH Aachen University 72 % 73 % 74 % *********************************************************************************************** 75 % * This file is part of the RWTH - Mindstorms NXT Toolbox. * 76 % * * 77 % * The RWTH - Mindstorms NXT Toolbox is free software: you can redistribute it and/or modify * 78 % * it under the terms of the GNU General Public License as published by the Free Software * 79 % * Foundation, either version 3 of the License, or (at your option) any later version. * 80 % * * 81 % * The RWTH - Mindstorms NXT Toolbox is distributed in the hope that it will be useful, * 82 % * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * 83 % * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * 84 % * * 85 % * You should have received a copy of the GNU General Public License along with the * 86 % * RWTH - Mindstorms NXT Toolbox. If not, see <http://www.gnu.org/licenses/>. * 87 % *********************************************************************************************** 88 % 89 % 3 90 % Information from 4 91 % Not eXactly C (NXC) Programmer's Guide … … 26 113 % OutputOffsetPwnFreq 96 1 27 114 115 116 %% Parameter check 117 % check if bluetooth handle is given; if not use default one 118 if nargin < 3 119 warning('IO map changes have to be committed by the output module update flag!\n'... 120 'Update information is interpreted according the flag bitfield!\n'... 121 'Changes maybe will not be committed'); 122 end 123 28 124 if nargin > 2 29 125 bitfield = 0; … … 45 141 bitfield = bitfield + 64; %#ok<NASGU> %hex2dec('40'); 46 142 otherwise 47 error('MATLAB:RWTHMindstormsNXT: lalalaa', 'unkown mode: %s', varargin{i});143 error('MATLAB:RWTHMindstormsNXT:unknown', 'unkown output module flag: %s', varargin{i}); 48 144 end 49 145 end … … 58 154 end 59 155 156 OutputModuleID = 131073; %#ok<NASGU> %hex2dec('00020001'); 60 157 61 158 if ~strcmp(motor, 'all') … … 80 177 81 178 % return values of specified motor port 82 NXT_Write_IO_Map( 131073, motor*32, size(bytes,2), bytes);179 NXT_Write_IO_Map(OutputModuleID, motor*32, size(bytes,2), bytes); 83 180 84 181 … … 111 208 112 209 % return values of specified motor port 113 NXT_Write_IO_Map( 131073, 0, size(bytes,2), bytes);114 115 end 116 117 118 end 210 NXT_Write_IO_Map(OutputModuleID, 0, size(bytes,2), bytes); 211 212 end 213 214 215 end
