Changeset 117
- Timestamp:
- 07/05/08 01:15:49 (5 years ago)
- Location:
- branches/atorf/RWTHMindstormsNXT
- Files:
-
- 1 added
- 12 modified
- 2 moved
-
GetMemoryCount.m (modified) (1 diff)
-
GetMotorSettings.m (modified) (2 diffs)
-
NXT_ResetMotorPosition.m (modified) (1 diff)
-
ResetMotorAngle.m (modified) (1 diff)
-
SendMotorSettings.m (modified) (2 diffs)
-
SetAngleLimit.m (modified) (3 diffs)
-
SetMemoryCount.m (modified) (1 diff)
-
SetPower.m (modified) (3 diffs)
-
SetRampMode.m (modified) (2 diffs)
-
SetTurnRatio.m (modified) (3 diffs)
-
SpeedRegulation.m (modified) (2 diffs)
-
SyncToMotor.m (modified) (3 diffs)
-
obsolete (added)
-
obsolete/getFullHandleStruct.m (moved) (moved from branches/atorf/RWTHMindstormsNXT/getFullHandleStruct.m)
-
obsolete/updateFullHandleStruct.m (moved) (moved from branches/atorf/RWTHMindstormsNXT/private/updateFullHandleStruct.m)
Legend:
- Unmodified
- Added
- Removed
-
branches/atorf/RWTHMindstormsNXT/GetMemoryCount.m
r3 r117 41 41 % *********************************************************************************************** 42 42 43 global NXTMOTOR_State; 44 45 if isempty(NXTMOTOR_State) 46 initializeGlobalMotorStateVar; 47 end%if 43 % get default handle & motorstate 44 h = COM_GetDefaultNXT(); 45 NXTMOTOR_State = h.NXTMOTOR_State(); 48 46 49 47 memory = NXTMOTOR_State(number+1).MemoryCount; -
branches/atorf/RWTHMindstormsNXT/GetMotorSettings.m
r3 r117 65 65 % *********************************************************************************************** 66 66 67 global NXTMOTOR_State;68 69 if isempty(NXTMOTOR_State)70 initializeGlobalMotorStateVar;71 end%if72 73 67 74 68 if whatmotor < 0 || whatmotor > 2 75 69 error('MATLAB:RWTHMindstormsNXT:Motor:invalidPort', 'Input argument for motor must be 0, 1, or 2') 76 70 end%if 71 72 % get default handle & motorstate 73 h = COM_GetDefaultNXT(); 74 NXTMOTOR_State = h.NXTMOTOR_State(); 77 75 78 76 … … 121 119 NXTMOTOR_State(whatmotor + 1).TachoCount = data.TachoCount; 122 120 121 % save motor state back to handle 122 h.NXTMOTOR_State(NXTMOTOR_State); 123 123 124 end%function 124 125 -
branches/atorf/RWTHMindstormsNXT/NXT_ResetMotorPosition.m
r110 r117 53 53 % check if bluetooth handle is given. if not use default one 54 54 if nargin > 2 55 handle = varargin{1};55 handle = varargin{1}; 56 56 else 57 57 handle = COM_GetDefaultNXT; -
branches/atorf/RWTHMindstormsNXT/ResetMotorAngle.m
r3 r117 48 48 % *********************************************************************************************** 49 49 50 %% Parameter check 51 % check if bluetooth handle is given. if not use default one 52 if nargin > 1 53 if (ispc && isa(varargin{1}, 'serial')) || (isunix && isscalar(varargin{1})) 54 handle = varargin{1}; 55 else 56 error('MATLAB:RWTHMindstormsNXT:Bluetooth:invalidHandle', 'Optional NXT bluetooth handle specified, but not a valid serial port handle'); 57 end%if 58 else 59 handle = BT_GetDefaultHandle; 60 end%if 61 62 NXT_ResetMotorPosition(port, true, handle); 50 % as we can see, just a little wrapper that maps the following NXT function and 51 % parameter combination to a more obvious name 52 NXT_ResetMotorPosition(port, true, handle); 63 53 64 54 end%function -
branches/atorf/RWTHMindstormsNXT/SendMotorSettings.m
r3 r117 64 64 end 65 65 66 67 global NXTMOTOR_State; 68 69 if isempty(NXTMOTOR_State) 70 initializeGlobalMotorStateVar; 71 end%if 66 %% get handle & motorstate 67 h = COM_GetDefaultNXT(); 68 NXTMOTOR_State = h.NXTMOTOR_State(); 69 72 70 73 71 … … 204 202 end% 205 203 204 205 %% save motor state back to handle 206 h.NXTMOTOR_State(NXTMOTOR_State); 207 208 206 209 end%function -
branches/atorf/RWTHMindstormsNXT/SetAngleLimit.m
r3 r117 49 49 50 50 %% Check parameter 51 global NXTMOTOR_State;52 53 if isempty(NXTMOTOR_State)54 initializeGlobalMotorStateVar;55 end%if56 57 51 whatmotor = GetMotor; 58 52 … … 66 60 67 61 62 %% get default handle & motorstate 63 h = COM_GetDefaultNXT(); 64 NXTMOTOR_State = h.NXTMOTOR_State(); 65 66 68 67 %% Set angle limit 69 68 NXTMOTOR_State(whatmotor + 1).AngleLimit = NewLimit; … … 74 73 end%if 75 74 75 76 %% save motor state back to handle 77 h.NXTMOTOR_State(NXTMOTOR_State); 78 79 76 80 end%function -
branches/atorf/RWTHMindstormsNXT/SetMemoryCount.m
r3 r117 41 41 % *********************************************************************************************** 42 42 43 global NXTMOTOR_State;44 43 45 if isempty(NXTMOTOR_State) 46 initializeGlobalMotorStateVar;47 end%if 44 % get default handle & motorstate 45 h = COM_GetDefaultNXT(); 46 NXTMOTOR_State = h.NXTMOTOR_State(); 48 47 49 48 NXTMOTOR_State(number+1).MemoryCount = angle; 50 49 50 % save motor state back to handle 51 h.NXTMOTOR_State(NXTMOTOR_State); 52 53 51 54 end % end function -
branches/atorf/RWTHMindstormsNXT/SetPower.m
r3 r117 45 45 46 46 %% Check parameter 47 global NXTMOTOR_State;48 49 if isempty(NXTMOTOR_State)50 initializeGlobalMotorStateVar;51 end%if52 53 47 whatmotor = GetMotor; 54 48 … … 60 54 error('MATLAB:RWTHMindstormsNXT:Motor:invalidPower', 'Power must be between -100 and 100') 61 55 end%if 56 57 %% Get handle & motorstate 58 h = COM_GetDefaultNXT(); 59 NXTMOTOR_State = h.NXTMOTOR_State(); 62 60 63 61 … … 78 76 end%if 79 77 78 %% save state back to handle 79 h.NXTMOTOR_State(NXTMOTOR_State); 80 81 80 82 end%function -
branches/atorf/RWTHMindstormsNXT/SetRampMode.m
r3 r117 46 46 47 47 %% Check parameter 48 global NXTMOTOR_State;49 50 if isempty(NXTMOTOR_State)51 initializeGlobalMotorStateVar;52 end%if53 54 48 % this catches errors if SetMotor wasn't called before 55 49 whatmotor = GetMotor; 50 51 52 %% get default handle & motorstate 53 h = COM_GetDefaultNXT(); 54 NXTMOTOR_State = h.NXTMOTOR_State(); 55 56 56 57 57 … … 72 72 end%if 73 73 74 75 %% save motor state back to handle 76 h.NXTMOTOR_State(NXTMOTOR_State); 77 78 74 79 end%function -
branches/atorf/RWTHMindstormsNXT/SetTurnRatio.m
r3 r117 60 60 61 61 %% Check parameter 62 global NXTMOTOR_State;63 64 if isempty(NXTMOTOR_State)65 initializeGlobalMotorStateVar;66 end%if67 68 62 whatmotor = GetMotor; 69 63 … … 75 69 error('MATLAB:RWTHMindstormsNXT:Motor:invalidTurnRatio', 'TurnRatio must be between -100 and 100') 76 70 end%if 71 72 73 %% get default handle & motorstate 74 h = COM_GetDefaultNXT(); 75 NXTMOTOR_State = h.NXTMOTOR_State(); 77 76 78 77 … … 88 87 end%if 89 88 89 90 %% save motor state back to handle 91 h.NXTMOTOR_State(NXTMOTOR_State); 92 93 90 94 end%function -
branches/atorf/RWTHMindstormsNXT/SpeedRegulation.m
r3 r117 51 51 52 52 %% Check parameter 53 global NXTMOTOR_State;54 55 if isempty(NXTMOTOR_State)56 initializeGlobalMotorStateVar;57 end%if58 53 59 54 % this catches errors if SetMotor wasn't called before 60 55 whatmotor = GetMotor; 56 57 %% get default handle & motorstate 58 h = COM_GetDefaultNXT(); 59 NXTMOTOR_State = h.NXTMOTOR_State(); 60 61 61 62 62 … … 100 100 end%if 101 101 102 %% save motor state back to handle 103 h.NXTMOTOR_State(NXTMOTOR_State); 104 105 102 106 end%function -
branches/atorf/RWTHMindstormsNXT/SyncToMotor.m
r3 r117 64 64 65 65 %% Check parameter 66 global NXTMOTOR_State;67 68 if isempty(NXTMOTOR_State)69 initializeGlobalMotorStateVar;70 end%if71 66 72 67 whatmotor = GetMotor; … … 78 73 end 79 74 end 75 76 %% get default handle & motorstate 77 h = COM_GetDefaultNXT(); 78 NXTMOTOR_State = h.NXTMOTOR_State(); 79 80 80 81 81 %% Set synchronization mode … … 145 145 end%if 146 146 147 %% save motor state back to handle 148 h.NXTMOTOR_State(NXTMOTOR_State); 149 150 151 147 152 end%function
