Changeset 272

Show
Ignore:
Timestamp:
09/18/08 17:57:06 (5 years ago)
Author:
atorf
Message:

Added changes from /branches/telle/RWTHMindstormsNXT-Lejos to current testing-branch

Location:
branches/atorf/RWTHMindstormsNXT-Lejos-Combined/@NXTmotor
Files:
1 added
10 modified

Legend:

Unmodified
Added
Removed
  • branches/atorf/RWTHMindstormsNXT-Lejos-Combined/@NXTmotor/NXTmotor.m

    r267 r272  
    7777%     end 
    7878%  
    79     obj.port           = 0; 
    80     obj.power          = 0; 
    81     obj.motorOn        = 1; 
    82     obj.brake          = 1; 
    83     obj.regulationMode = 'SPEED'; 
    84     obj.turnRatio      = 0; 
    85     obj.runState       = 'RUNNING'; 
    86     obj.tachoLimit     = 0; 
     79    obj.Port           = 0; 
     80    obj.Power          = 0; 
     81    obj.MotorOn        = 1; 
     82    obj.Brake          = 1; 
     83    obj.RegulationMode = 'SPEED'; 
     84    obj.TurnRatio      = 0; 
     85    obj.RunState       = 'RUNNING'; 
     86    obj.TachoLimit     = 0; 
    8787end 
    8888 
  • branches/atorf/RWTHMindstormsNXT-Lejos-Combined/@NXTmotor/get.m

    r267 r272  
    4646    switch prop 
    4747        case 'Port' 
    48             val = obj.port; 
     48            val = obj.Port; 
    4949        case 'Power' 
    50             val = obj.power; 
     50            val = obj.Power; 
    5151        case 'MotorOn' 
    52             if obj.motorOn == 1 
     52            if obj.MotorOn == 1 
    5353                val = 'on'; 
    5454            else 
     
    5656            end 
    5757        case 'Brake' 
    58             if obj.brake == 1 
     58            if obj.Brake == 1 
    5959                val = 'on'; 
    6060            else 
     
    6262            end 
    6363        case 'RegulationMode' 
    64             switch obj.regulationMode 
     64            switch obj.RegulationMode 
    6565                case 'IDLE' 
    6666                    val = 'idle'; 
     
    7373            end 
    7474        case 'TurnRatio' 
    75             val = obj.turnRatio; 
     75            val = obj.TurnRatio; 
    7676        case 'RunState' 
    77             switch obj.runState 
     77            switch obj.RunState 
    7878                case 'IDLE'; 
    7979                    val = 'idle'; 
     
    8888            end 
    8989        case 'TachoLimit' 
    90             val = obj.tachoLimit; 
     90            val = obj.TachoLimit; 
    9191        otherwise 
    9292            error('MATLAB:RWTHMindstormsNXT:UnsupportedProperty',... 
  • branches/atorf/RWTHMindstormsNXT-Lejos-Combined/@NXTmotor/read.m

    r267 r272  
    4949%% THIS HAS TO BE FIXED. ONLY THE OUTPUT STATE OF FIRST PORT IS RETURNED 
    5050%% WHEN APPLYING CHANGES BE AWARE OF USAGE IN WAIT 
    51 settings = NXT_GetOutputState(obj.port(motorindex)); 
     51settings = NXT_GetOutputState(obj.Port(motorindex)); 
    5252 
    5353% Translate output of NXT_GetOutputState to motor settings 
  • branches/atorf/RWTHMindstormsNXT-Lejos-Combined/@NXTmotor/reset.m

    r267 r272  
    3939switch lower(type) 
    4040    case 'absolute' 
    41         NXT_ResetMotorPosition(obj.port, 0); 
     41        NXT_ResetMotorPosition(obj.Port, 0); 
    4242%     case 'relative' 
    43 %         NXT_ResetMotorPosition(obj.port, 1); 
     43%         NXT_ResetMotorPosition(obj.Port, 1); 
    4444%     case 'full' 
    4545%         NXT_StartProgram('ResetCounter'); 
  • branches/atorf/RWTHMindstormsNXT-Lejos-Combined/@NXTmotor/send.m

    r267 r272  
    3939 
    4040    out = NXT_SetOutputState(... 
    41         obj.port, ... 
    42         obj.power, ... 
    43         obj.motorOn, ... 
    44         obj.brake, ... 
    45         obj.regulationMode, ... 
    46         obj.turnRatio, ... 
    47         obj.runState, ... 
    48         obj.tachoLimit, ... 
     41        obj.Port, ... 
     42        obj.Power, ... 
     43        obj.MotorOn, ... 
     44        obj.Brake, ... 
     45        obj.RegulationMode, ... 
     46        obj.TurnRatio, ... 
     47        obj.RunState, ... 
     48        obj.TachoLimit, ... 
    4949        'reply'... 
    5050        ); 
    5151else 
    5252    NXT_SetOutputState(... 
    53         obj.port, ... 
    54         obj.power, ... 
    55         obj.motorOn, ... 
    56         obj.brake, ... 
    57         obj.regulationMode, ... 
    58         obj.turnRatio, ... 
    59         obj.runState, ... 
    60         obj.tachoLimit, ... 
     53        obj.Port, ... 
     54        obj.Power, ... 
     55        obj.MotorOn, ... 
     56        obj.Brake, ... 
     57        obj.RegulationMode, ... 
     58        obj.TurnRatio, ... 
     59        obj.RunState, ... 
     60        obj.TachoLimit, ... 
    6161        'dontreply'... 
    6262        ); 
  • branches/atorf/RWTHMindstormsNXT-Lejos-Combined/@NXTmotor/set.m

    r267 r272  
    108108                    end 
    109109                     
    110                     obj.port = fix(val); 
     110                    obj.Port = fix(val); 
    111111                else 
    112112                    error('MATLAB:RWTHMindstormsNXT:InvalidPort',... 
     
    122122                            'Power is not an integer.'); 
    123123                    end 
    124                     obj.power = fix(val); 
     124                    obj.Power = fix(val); 
    125125                else 
    126126                    error('MATLAB:RWTHMindstormsNXT:InvalidPower',... 
     
    130130            case 'MotorOn' 
    131131                if isscalar(val) && isnumeric(val) && (val == 0 || val == 1) 
    132                     obj.motorOn = val; 
     132                    obj.MotorOn = val; 
    133133                elseif islogical(val) 
    134134                    if val 
    135                         obj.motorOn = 1; 
    136                     else 
    137                         obj.motorOn = 0; 
     135                        obj.MotorOn = 1; 
     136                    else 
     137                        obj.MotorOn = 0; 
    138138                    end 
    139139                elseif ischar(val) 
    140140                    if strcmpi(val,'on') 
    141                         obj.motorOn = 1; 
     141                        obj.MotorOn = 1; 
    142142                    elseif strcmpi(val,'off') 
    143                         obj.motorOn = 0; 
     143                        obj.MotorOn = 0; 
    144144                    else 
    145145                        error('MATLAB:RWTHMindstormsNXT:InvalidMotorOn',... 
     
    153153            case 'Brake' 
    154154                if isscalar(val) && isnumeric(val) && (val == 0 || val == 1) 
    155                     obj.brake = val; 
     155                    obj.Brake = val; 
    156156                elseif islogical(val) 
    157157                    if val 
    158                         obj.brake = 1; 
    159                     else 
    160                         obj.brake = 0; 
     158                        obj.Brake = 1; 
     159                    else 
     160                        obj.Brake = 0; 
    161161                    end 
    162162                elseif ischar(val) 
    163163                    if strcmpi(val,'on') 
    164                         obj.brake = 1; 
     164                        obj.Brake = 1; 
    165165                    elseif strcmpi(val,'off') 
    166                         obj.brake = 0; 
     166                        obj.Brake = 0; 
    167167                    else 
    168168                        error('MATLAB:RWTHMindstormsNXT:InvalidBrake',... 
     
    178178                    switch lower(val) 
    179179                        case 'idle' 
    180                             obj.regulationMode = 'IDLE'; 
     180                            obj.RegulationMode = 'IDLE'; 
    181181                        case 'speed' 
    182                             obj.regulationMode = 'SPEED'; 
     182                            obj.RegulationMode = 'SPEED'; 
    183183                        otherwise 
    184184                            error('MATLAB:RWTHMindstormsNXT:InvalidRegulationMode',... 
     
    196196                            'TurnRatio is not an integer.'); 
    197197                    end 
    198                     obj.turnRatio = fix(val); 
     198                    obj.TurnRatio = fix(val); 
    199199                else 
    200200                    error('MATLAB:RWTHMindstormsNXT:InvalidTurnRatio',... 
     
    206206                    switch lower(val) 
    207207                        case 'idle' 
    208                             obj.runState = 'IDLE'; 
     208                            obj.RunState = 'IDLE'; 
    209209% Not supported at the moment                             
    210210%                         case 'rampup' 
    211211%                             obj.runState = 'RAMPUP'; 
    212212                        case 'running' 
    213                             obj.runState = 'RUNNING'; 
     213                            obj.RunState = 'RUNNING'; 
    214214% Not supported at the moment                             
    215215%                         case 'rampdown' 
     
    231231                            'TachoLimit is not an integer.'); 
    232232                    end 
    233                     obj.tachoLimit = fix(val); 
     233                    obj.TachoLimit = fix(val); 
    234234                else 
    235235                    error('MATLAB:RWTHMindstormsNXT:InvalidTachoLimit',... 
  • branches/atorf/RWTHMindstormsNXT-Lejos-Combined/@NXTmotor/stop.m

    r267 r272  
    4848 
    4949% Parameter checking is done in StopMotor 
    50 StopMotor(obj.port, brakemode); 
     50StopMotor(obj.Port, brakemode); 
  • branches/atorf/RWTHMindstormsNXT-Lejos-Combined/@NXTmotor/subsasgn.m

    r267 r272  
    4545% *********************************************************************************************** 
    4646 
     47if ~isa(obj,'NXTmotor') 
     48    error('MATLAB:RWTHMindstormsNXT:InvalidObject',... 
     49        'No NXTmotor object.'); 
     50end 
     51 
    4752StructLength = length(Struct); 
    4853 
  • branches/atorf/RWTHMindstormsNXT-Lejos-Combined/@NXTmotor/subsref.m

    r267 r272  
    1515%   obj(k) 
    1616 
    17 % Author: Aulis Telle, IND, RWTH Aachen 
     17% Signature 
     18%   Author: Aulis Telle (see AUTHORS) 
     19%   Date: 2008/08/15 
     20%   Copyright: 2007-2008, RWTH Aachen University 
     21% 
     22% 
     23% *********************************************************************************************** 
     24% *  This file is part of the RWTH - Mindstorms NXT Toolbox.                                    * 
     25% *                                                                                             * 
     26% *  The RWTH - Mindstorms NXT Toolbox is free software: you can redistribute it and/or modify  * 
     27% *  it under the terms of the GNU General Public License as published by the Free Software     * 
     28% *  Foundation, either version 3 of the License, or (at your option) any later version.        * 
     29% *                                                                                             * 
     30% *  The RWTH - Mindstorms NXT Toolbox is distributed in the hope that it will be useful,       * 
     31% *  but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS  * 
     32% *  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.             * 
     33% *                                                                                             * 
     34% *  You should have received a copy of the GNU General Public License along with the           * 
     35% *  RWTH - Mindstorms NXT Toolbox. If not, see <http://www.gnu.org/licenses/>.                 * 
     36% *********************************************************************************************** 
     37 
     38if ~isa(obj,'NXTmotor') 
     39    error('MATLAB:RWTHMindstormsNXT:InvalidObject',... 
     40        'No NXTmotor object.'); 
     41end 
    1842 
    1943result = obj; 
  • branches/atorf/RWTHMindstormsNXT-Lejos-Combined/@NXTmotor/wait.m

    r267 r272  
    2727% 
    2828 
    29 % Author: Aulis Telle, IND, RWTH Aachen 
     29% Signature 
     30%   Author: Aulis Telle (see AUTHORS) 
     31%   Date: 2008/08/15 
     32%   Copyright: 2007-2008, RWTH Aachen University 
     33% 
     34% 
     35% *********************************************************************************************** 
     36% *  This file is part of the RWTH - Mindstorms NXT Toolbox.                                    * 
     37% *                                                                                             * 
     38% *  The RWTH - Mindstorms NXT Toolbox is free software: you can redistribute it and/or modify  * 
     39% *  it under the terms of the GNU General Public License as published by the Free Software     * 
     40% *  Foundation, either version 3 of the License, or (at your option) any later version.        * 
     41% *                                                                                             * 
     42% *  The RWTH - Mindstorms NXT Toolbox is distributed in the hope that it will be useful,       * 
     43% *  but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS  * 
     44% *  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.             * 
     45% *                                                                                             * 
     46% *  You should have received a copy of the GNU General Public License along with the           * 
     47% *  RWTH - Mindstorms NXT Toolbox. If not, see <http://www.gnu.org/licenses/>.                 * 
     48% *********************************************************************************************** 
     49 
     50 
     51if ~isa(obj,'NXTmotor') 
     52    error('MATLAB:RWTHMindstormsNXT:InvalidObject',... 
     53        'No NXTmotor object.'); 
     54end 
    3055 
    3156if nargout > 0 
     
    4166 
    4267data = read(obj); 
    43 if data.TachoLimit == 0 && ~ strcmp(data.RunState,'idle') 
     68if data.TachoLimit == 0 && ~ strcmpi(data.RunState,'idle') 
    4469    warning('RWTHMINDSTORMS:MotorWait',... 
    4570        'Motor running infinitely. Not waiting for this motor!'); 
     
    4772end 
    4873 
    49 while ~ strcmp(data.RunState,'idle') 
     74while ~ strcmpi(data.RunState,'idle') 
    5075    if exist('timedOut', 'var') && timeout > 0 && now >= endtime 
    5176        timedOut = 1;