Show
Ignore:
Timestamp:
12/02/09 14:43:17 (3 years ago)
Author:
atorf
Message:

Updating livecd branch with fixed see-also links (and fixed motor-tutorial typos)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/livecd/RWTHMindstormsNXT/doc/functions/help/NXC_MotorControl.html

    r823 r840  
    77This HTML is auto-generated from an M-file. 
    88To make changes, update the M-file and republish this document. 
    9       --><title>NXC_MotorControl</title><meta name="generator" content="MATLAB 7.9"><meta name="date" content="2009-10-07"><meta name="m-file" content="script_NXC_MotorControl"> 
     9      --><title>NXC_MotorControl</title><meta name="generator" content="MATLAB 7.9"><meta name="date" content="2009-11-27"><meta name="m-file" content="script_NXC_MotorControl"> 
    1010<link type="text/css" rel="stylesheet" href="../../style.css"> 
    11   </head><body><div class="content"><h1>NXC_MotorControl</h1><!--introduction--><p>Sends advanced motor-command to the NXC-program MotorControl on the NXT brick</p><!--/introduction--><h2>Contents</h2><div><ul><li><a href="#2">Syntax</a></li><li><a href="#5">Description</a></li><li><a href="#26">Limitations</a></li><li><a href="#32">Example</a></li><li><a href="#35">See also</a></li><li><a href="#37">Signature</a></li></ul></div><h2>Syntax<a name="2"></a></h2><p><tt>NXC_MotorControl(Port, Power, TachoLimit, SpeedRegulation, ActionAtTachoLimit, SmoothStart)</tt></p><p><tt>NXC_MotorControl(Port, Power, TachoLimit, SpeedRegulation, ActionAtTachoLimit, SmoothStart, handle)</tt></p><h2>Description<a name="5"></a></h2><p>The NXC-program "MotorControl" must be running on the brick, otherwise this function will not work. It is used to send advanced motor commands to the NXT that can perform better and more precise motor regulation than possible with only classic direct commands.</p><p>While one command is being executed (i.e. when the motor is still being controlled if a <tt>TachoLimit</tt> other than 0 was set), this motor cannot accept new commands. Use the NXTMotor classes command <tt>.WaitFor</tt> to make sure the motor has finished it's current operation, before sending a new one. If the NXC-program receives a new command while it is still busy, a warning signal (high beep, then low beep) will be played.</p><p>The command <tt>StopMotor</tt> (or NXTMotor's method <tt>.Stop</tt>) is always available to stop a controlled motor-operation, even before the <tt>TachoLimit</tt> is reached.</p><p><b>Input:</b></p><div><ul><li><tt>Port</tt> has to be a port number between 0 and 2, or an array with max. 2 different motors specified.</li></ul></div><div><ul><li><tt>Power</tt> is the power level applied to the motor, value between -100 and 100 (sign changes direction)</li></ul></div><div><ul><li><tt>TachoLimit</tt> - integer from 0 to 99999, specifies the angle in degrees the motor will try to reach, set 0 to run forever. Note that direction is specified by the sign of <tt>Power</tt>.</li></ul></div><div><ul><li><tt>SpeedRegulation</tt> must be <tt>false</tt> for "normal", unregulated motor control. If set to <tt>true</tt>, single motors will be operated in speed regulation mode. This means that the motor will increase its internal power setting to reach a constant turning speed. Use this option when working with motors under varying load. If you'd like to have motor movement with preferrably constant torque, it's advisable to disable this option. In conjunction with multiple motors (i.e. when <tt>Port</tt> is an array of 2 ports), you have to disable <tt>SpeedRegulation</tt>! Multiple motorss will enable synchronization between the two motors. They will run at the same speed as if they were connected through and axle, leading to straight movement for driving bots.</li></ul></div><div><ul><li><tt>ActionAtTachoLimit</tt> is a string parameter with valid options <tt>'Coast'</tt>, <tt>'Brake'</tt> or <tt>'HoldBrake'</tt>. It specifies how the motor(s) should react when their position counter reaches the set <tt>TachoLimit</tt>. In COAST mode, the motor(s) will simply be turned of when the <tt>TachoLimit</tt> is reached, leading to free movement until slowly stopping (called coasting). The <tt>TachoLimit</tt> won't be met, the motor(s) move way too far (overshooting), depending on their angular momentum. Use BRAKE mode (default) to let the motor(s) automatically slow down nice and smoothly shortly before the <tt>TachoLimit</tt>. This leads to a very high precision, usually the <tt>TachoLimit</tt> is met within +/- 1 degree (depending on the motor load and speed of course). After this braking, power to the motor(s) is turned off when they are at rest. HOLDBRAKE is similar to BRAKE, but in this case, the active brake of the motors stays enabled (careful, this consumes a lot of battery power), causing the motor(s) to actively keep holding their position.</li></ul></div><div><ul><li><tt>SmoothStart</tt> can be set to <tt>true</tt> to smoothly accelerate movement. This "manual ramp up" of power will occur fairly quickly. It's comfortable for driving robots so that they don't loose traction when starting to move. If used in conjunction with <tt>SpeedRegulation</tt> for single motors, after accleration is finished and the full power is applied, the speed regulation can possibly even accelerate a bit more.</li></ul></div><div><ul><li><tt>handle</tt> (optional) defines the given NXT connection. If no handle is specified, the default one (<tt>COM_GetDefaultNXT()</tt>) is used.</li></ul></div><h2>Limitations<a name="26"></a></h2><p>If you send a command to the NXT without waiting for the previous motor operation to have finished, the command will be dropped (the NXT indicates this with a high and low beep tone). Use NXTMotor classes <tt>WaitFor</tt> to make sure the motor is ready for new  commands, or stop the motor using NXTMotor's method <tt>.Stop</tt>.</p><p>The option <tt>SmoothStart</tt> in conjunction with <tt>ActionAtTachoLimit == 'Coast'</tt> is not available. As a workaround, disable <tt>SmoothStart</tt> for this mode.</p><p>With ActionAtTachoLimit = 'Coast' and synchronous driving (two motors), the motors will stay synced after movement (even after <tt>.WaitFor()</tt> has finished). This is by design. To disable the synchonization, just use <tt>StopMotor(port, 'off')</tt>.</p><h2>Example<a name="32"></a></h2><h2>See also<a name="35"></a></h2><p>WaitForMotor, NXT_SetOutputState, NXT_GetOutputState, NXC_ResetErrorCorrection, MOTOR_A, MOTOR_B, MOTOR_C</p><h2>Signature<a name="37"></a></h2><div><ul><li><b>Author:</b> Linus Atorf (see AUTHORS)</li><li><b>Date:</b> 2009/07/20</li><li><b>Copyright:</b> 2007-2009, RWTH Aachen University</li></ul></div><p class="footer"><br> 
    12 </p></div><!-- 
     11  </head><body><div class="content"><h1>NXC_MotorControl</h1><!--introduction--><p><a href="Sends advanced motor-command to the NXC-program MotorControl on the NXT brick.html">Sends advanced motor-command to the NXC-program MotorControl on the NXT brick</a>, </p><!--/introduction--><h2>Contents</h2><div><ul><li><a href="#2">Syntax</a></li><li><a href="#5">Description</a></li><li><a href="#26">Limitations</a></li><li><a href="#32">Example</a></li><li><a href="#35">See also</a></li><li><a href="#37">Signature</a></li></ul></div><h2>Syntax<a name="2"></a></h2><p><tt>NXC_MotorControl(Port, Power, TachoLimit, SpeedRegulation, ActionAtTachoLimit, SmoothStart)</tt></p><p><tt>NXC_MotorControl(Port, Power, TachoLimit, SpeedRegulation, ActionAtTachoLimit, SmoothStart, handle)</tt></p><h2>Description<a name="5"></a></h2><p>The NXC-program "MotorControl" must be running on the brick, otherwise this function will not work. It is used to send advanced motor commands to the NXT that can perform better and more precise motor regulation than possible with only classic direct commands.</p><p>While one command is being executed (i.e. when the motor is still being controlled if a <tt>TachoLimit</tt> other than 0 was set), this motor cannot accept new commands. Use the NXTMotor classes command <tt>.WaitFor</tt> to make sure the motor has finished it's current operation, before sending a new one. If the NXC-program receives a new command while it is still busy, a warning signal (high beep, then low beep) will be played.</p><p>The command <tt>StopMotor</tt> (or NXTMotor's method <tt>.Stop</tt>) is always available to stop a controlled motor-operation, even before the <tt>TachoLimit</tt> is reached.</p><p><b>Input:</b></p><div><ul><li><tt>Port</tt> has to be a port number between 0 and 2, or an array with max. 2 different motors specified.</li></ul></div><div><ul><li><tt>Power</tt> is the power level applied to the motor, value between -100 and 100 (sign changes direction)</li></ul></div><div><ul><li><tt>TachoLimit</tt> - integer from 0 to 99999, specifies the angle in degrees the motor will try to reach, set 0 to run forever. Note that direction is specified by the sign of <tt>Power</tt>.</li></ul></div><div><ul><li><tt>SpeedRegulation</tt> must be <tt>false</tt> for "normal", unregulated motor control. If set to <tt>true</tt>, single motors will be operated in speed regulation mode. This means that the motor will increase its internal power setting to reach a constant turning speed. Use this option when working with motors under varying load. If you'd like to have motor movement with preferrably constant torque, it's advisable to disable this option. In conjunction with multiple motors (i.e. when <tt>Port</tt> is an array of 2 ports), you have to disable <tt>SpeedRegulation</tt>! Multiple motorss will enable synchronization between the two motors. They will run at the same speed as if they were connected through and axle, leading to straight movement for driving bots.</li></ul></div><div><ul><li><tt>ActionAtTachoLimit</tt> is a string parameter with valid options <tt>'Coast'</tt>, <tt>'Brake'</tt> or <tt>'HoldBrake'</tt>. It specifies how the motor(s) should react when their position counter reaches the set <tt>TachoLimit</tt>. In COAST mode, the motor(s) will simply be turned of when the <tt>TachoLimit</tt> is reached, leading to free movement until slowly stopping (called coasting). The <tt>TachoLimit</tt> won't be met, the motor(s) move way too far (overshooting), depending on their angular momentum. Use BRAKE mode (default) to let the motor(s) automatically slow down nice and smoothly shortly before the <tt>TachoLimit</tt>. This leads to a very high precision, usually the <tt>TachoLimit</tt> is met within +/- 1 degree (depending on the motor load and speed of course). After this braking, power to the motor(s) is turned off when they are at rest. HOLDBRAKE is similar to BRAKE, but in this case, the active brake of the motors stays enabled (careful, this consumes a lot of battery power), causing the motor(s) to actively keep holding their position.</li></ul></div><div><ul><li><tt>SmoothStart</tt> can be set to <tt>true</tt> to smoothly accelerate movement. This "manual ramp up" of power will occur fairly quickly. It's comfortable for driving robots so that they don't loose traction when starting to move. If used in conjunction with <tt>SpeedRegulation</tt> for single motors, after accleration is finished and the full power is applied, the speed regulation can possibly even accelerate a bit more.</li></ul></div><div><ul><li><tt>handle</tt> (optional) defines the given NXT connection. If no handle is specified, the default one (<tt>COM_GetDefaultNXT()</tt>) is used.</li></ul></div><h2>Limitations<a name="26"></a></h2><p>If you send a command to the NXT without waiting for the previous motor operation to have finished, the command will be dropped (the NXT indicates this with a high and low beep tone). Use NXTMotor classes <tt>WaitFor</tt> to make sure the motor is ready for new  commands, or stop the motor using NXTMotor's method <tt>.Stop</tt>.</p><p>The option <tt>SmoothStart</tt> in conjunction with <tt>ActionAtTachoLimit == 'Coast'</tt> is not available. As a workaround, disable <tt>SmoothStart</tt> for this mode.</p><p>With ActionAtTachoLimit = 'Coast' and synchronous driving (two motors), the motors will stay synced after movement (even after <tt>.WaitFor()</tt> has finished). This is by design. To disable the synchonization, just use <tt>StopMotor(port, 'off')</tt>.</p><h2>Example<a name="32"></a></h2><h2>See also<a name="35"></a></h2><p>WaitForMotor, NXT_SetOutputState, NXT_GetOutputState, NXC_ResetErrorCorrection, MOTOR_A, MOTOR_B, MOTOR_C</p><h2>Signature<a name="37"></a></h2><div><ul><li><b>Author:</b> Linus Atorf (see AUTHORS)</li><li><b>Date:</b> 2009/07/20</li><li><b>Copyright:</b> 2007-2009, RWTH Aachen University</li></ul></div><p class="footer"><br> 
     12      Published with wg_publish; V1.0<br></p></div><!-- 
    1313##### SOURCE BEGIN ##### 
    1414%% NXC_MotorControl