Changeset 730

Show
Ignore:
Timestamp:
07/20/09 19:55:48 (4 years ago)
Author:
atorf
Message:

Cleaned up demos:

  • Added toolbox installation version check
  • Removed old demos
  • Improved / added comments / minor details
  • Renamed to correct names
Location:
trunk/demos
Files:
3 removed
3 modified
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/demos

    • Property svn:ignore set to
      *.asv
  • trunk/demos/Example_1_PlayTone.m

    r615 r730  
    11%% Example 1: Play Tone and Get Battery Level 
    22% Example to play a specific tone with the NXT Brick and retrieve the current battery level:  
     3 
     4% Signature 
     5%   Author: Linus Atorf, Alexander Behrens 
     6%   Date: 2009/07/17 
     7%   License: BSD 
     8%   RWTH - Mindstorms NXT Toolbox: http://www.mindstorms.rwth-aachen.de 
     9 
     10% verify that the RWTH - Mindstorms NXT toolbox is installed. 
     11if verLessThan('RWTHMindstormsNXT', '2.00'); 
     12    error('This program requires the RWTH - Mindstorms NXT Toolbox version 2.00 or greater. Go to http://www.mindstorms.rwth-aachen.de and follow the installation instructions!'); 
     13end%if 
     14 
    315 
    416% Close previous handles (if existing) 
     
    1224%  - Device drivers (Fantom on Windows, libusb on Linux) have to be already installed for USB to work. 
    1325%  - For using Bluetooth a previous configuration file has to be generated COM_MakeBTConfigFile) 
     26%  - This call will not try to open a Bluetooth connection... 
    1427handle = COM_OpenNXT(); 
     28% at this place we could call COM_SetDefaultNXT(handle); 
    1529 
    1630% Play tone with frequency 800Hz and duration of 500ms.  
  • trunk/demos/Example_2_ReadSoundSensor.m

    r668 r730  
    11%% Example 2: Read Sound Sensor 
    22% Example to read the sound sensor value in db: 
     3 
     4% Signature 
     5%   Author: Linus Atorf, Alexander Behrens 
     6%   Date: 2009/07/17 
     7%   License: BSD 
     8%   RWTH - Mindstorms NXT Toolbox: http://www.mindstorms.rwth-aachen.de 
     9 
     10% verify that the RWTH - Mindstorms NXT toolbox is installed. 
     11if verLessThan('RWTHMindstormsNXT', '2.00'); 
     12    error('This program requires the RWTH - Mindstorms NXT Toolbox version 2.00 or greater. Go to http://www.mindstorms.rwth-aachen.de and follow the installation instructions!'); 
     13end%if 
     14 
    315 
    416% Close previous handles (if existing) 
     
    921 
    1022% Open new NXT Bluetooth connection according to the previous generated configuration file. 
     23% Please note that a USB connection will be used if one is present. If no 
     24% USB device is found, the Bluetooth configuration file will be used. 
    1125handle = COM_OpenNXT('bluetooth.ini'); 
    1226 
  • trunk/demos/Example_3_DriveAroundTable_MotorClass.m

    r669 r730  
    1 %% Example 7: Drive Around Table (Motor Class) 
    2 % This example equals demo 3, but uses the motor class and an advanced motor control. 
     1%% Example 3: Drive Around Table (Motor Class) 
     2% Let's a robot (e.g. Tribot or CATTbot) to drive a square on the floor 
    33% 
    4 % Note: For using the advanced motor control the MotorControl program has to be downloaded onto your 
    5 % NXT. The MotorControl program is located at /tools/MotorControl. 
     4% Signature 
     5%   Author: Linus Atorf, Alexander Behrens 
     6%   Date: 2009/07/17 
     7%   License: BSD 
     8%   RWTH - Mindstorms NXT Toolbox: http://www.mindstorms.rwth-aachen.de 
     9 
     10% verify that the RWTH - Mindstorms NXT toolbox is installed. 
     11if verLessThan('RWTHMindstormsNXT', '3.00'); 
     12    error('This program requires the RWTH - Mindstorms NXT Toolbox version 3.00 or greater. Go to http://www.mindstorms.rwth-aachen.de and follow the installation instructions!'); 
     13end%if 
    614 
    715 
     
    1422%% Constants and so on 
    1523TableLength      = 1000;     % in degrees of motor rotations :-) 
    16 QuarterTurnTicks = 217;      % in motor degrees, how much is a 90° turn of the bot? 
     24QuarterTurnTicks = 219;      % in motor degrees, how much is a 90° turn of the bot? 
    1725Ports = [MOTOR_B; MOTOR_C];  % motorports for left and right wheel 
    18 DrivingSpeed     = 50; 
    19 TurningSpeed     = 30; 
     26DrivingSpeed     = 60; 
     27TurningSpeed     = 40; 
    2028 
    2129 
     
    3442mStraight.Power             = DrivingSpeed; 
    3543mStraight.TachoLimit        = TableLength; 
    36 mStraight.BrakeAtTachoLimit = true; 
     44mStraight.ActionAtTachoLimit = 'Brake'; 
    3745 
    3846 
    3947mTurn1                      = NXTMotor(Ports(2)); % ports swapped because it's nicer 
    40 mTurn1.SpeedRegulation      = true;   
     48mTurn1.SpeedRegulation      = false;  % we could use it if we wanted 
    4149mTurn1.Power                = TurningSpeed; 
    4250mTurn1.TachoLimit           = QuarterTurnTicks; 
    43 mTurn1.BrakeAtTachoLimit    = true; 
     51mStraight.ActionAtTachoLimit = 'Brake'; 
    4452 
    4553 
     
    8189 
    8290 
    83  
    8491% Hey! End of a hard day's work 
    8592% Just to show good style, we close down our motors again: 
  • trunk/demos/Example_4_NextGenerationUltrasound.m

    r615 r730  
    1 %% Example 5: Next Generation Ultrasound 
     1%% Example 4: Next Generation Ultrasound 
    22% This script demonstrates the results of the ultrasound "snapshot mode"! 
    33% Interpretation of the results however is difficult. 
     
    66% SENSOR_2), and see what's happening. The script will exit after 200 
    77% measurements... 
     8% 
     9% Signature 
     10%   Author: Linus Atorf, Alexander Behrens 
     11%   Date: 2009/07/17 
     12%   License: BSD 
     13%   RWTH - Mindstorms NXT Toolbox: http://www.mindstorms.rwth-aachen.de 
     14 
     15% verify that the RWTH - Mindstorms NXT toolbox is installed. 
     16if verLessThan('RWTHMindstormsNXT', '2.00'); 
     17    error('This program requires the RWTH - Mindstorms NXT Toolbox version 3.00 or greater. Go to http://www.mindstorms.rwth-aachen.de and follow the installation instructions!'); 
     18end%if 
    819 
    920 
     
    1122% Close previous handles (if existing) 
    1223COM_CloseNXT all 
     24 
    1325 
    1426%% Set up Matlab