| 1 | |
|---|
| 2 | <!DOCTYPE html |
|---|
| 3 | PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"> |
|---|
| 4 | <html xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd"> |
|---|
| 5 | <head> |
|---|
| 6 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|---|
| 7 | |
|---|
| 8 | <!-- |
|---|
| 9 | This HTML is auto-generated from an M-file. |
|---|
| 10 | To make changes, update the M-file and republish this document. |
|---|
| 11 | --> |
|---|
| 12 | <title>SyncToMotor</title> |
|---|
| 13 | <meta name="generator" content="MATLAB 7.5"> |
|---|
| 14 | <meta name="date" content="2008-01-28"> |
|---|
| 15 | <meta name="m-file" content="script_SyncToMotor"> |
|---|
| 16 | <link type="text/css" rel="stylesheet" href="../../style.css"> |
|---|
| 17 | </head> |
|---|
| 18 | <body> |
|---|
| 19 | <p class="header">RWTH - Mindstorms NXT Toolbox</p> |
|---|
| 20 | <div class="content"> |
|---|
| 21 | <h1>SyncToMotor</h1> |
|---|
| 22 | <introduction> |
|---|
| 23 | <p>Enables synchronization regulation for current active and specified motor</p> |
|---|
| 24 | </introduction> |
|---|
| 25 | <h2>Contents</h2> |
|---|
| 26 | <div> |
|---|
| 27 | <ul> |
|---|
| 28 | <li><a href="#1">Syntax</a></li> |
|---|
| 29 | <li><a href="#2">Description</a></li> |
|---|
| 30 | <li><a href="#7">Example</a></li> |
|---|
| 31 | <li><a href="#8">See also</a></li> |
|---|
| 32 | <li><a href="#9">Signature</a></li> |
|---|
| 33 | </ul> |
|---|
| 34 | </div> |
|---|
| 35 | <h2>Syntax<a name="1"></a></h2> |
|---|
| 36 | <p><tt>SyncToMotor(OtherMotor)</tt></p> |
|---|
| 37 | <h2>Description<a name="2"></a></h2> |
|---|
| 38 | <p><tt>SyncToMotor(OtherMotor)</tt> sets the synchronization mode to the curren active motor (set by <tt>SetMotor</tt>) and the given motor port <tt>OtherMotor</tt>. The value <tt>OtherMotor</tt> can be addressed by the symbolic constants <tt>MOTOR_A</tt> , <tt>MOTOR_B</tt> and <tt>MOTOR_C</tt> analog to the labeling on the NXT Brick. The synchronization mode can be set off if the value <tt>OtherMotor</tt> is set equal to <tt>'off'</tt>. The synchronization setting takes only affect with the next <tt>SendMotorSettings</tt> command. |
|---|
| 39 | </p> |
|---|
| 40 | <p>This means that both motors will act as if they were connected through an axle. Motors with more load on them (rough underground) |
|---|
| 41 | will automatically be corrected and regulated for example. This "synchronization regulation" is the setting you want to use |
|---|
| 42 | when driving with your robot. Also turning (SetTurnRatio) only affects motors that are synced. |
|---|
| 43 | </p> |
|---|
| 44 | <p><b>Note:</b></p> |
|---|
| 45 | <p>One motor can not be synchronized to itself. The synchronization mode and the speed regulation mode can be set only together |
|---|
| 46 | at one time. Once a motor is synced to another motor, all settings set to it will be applied to both motors (until synchronisation |
|---|
| 47 | is lost of course). Once 2 motors are synced, you effectively control 2 motors with 1 set of commands. This means, when calling |
|---|
| 48 | <tt>SendMotorSettings</tt>, in fact 2 packets will be send to the 2 synced motors, hence you will experience about twice the lag than usual. Take this |
|---|
| 49 | into consideration... |
|---|
| 50 | </p> |
|---|
| 51 | <p>When using several motor commands with <tt>SyncToMotor</tt> statements, unexpected behaviour can occur, due to the NXTs internal error correction counters. Sometimes it can help to |
|---|
| 52 | issue the commands <tt>NXT_ResetMotorPosition(port, true)</tt>, <tt>NXT_ResetMotorPosition(port, false)</tt> and <tt>StopMotor(port, 'off')</tt> for each of both motors. Although this seems like a waste of packets, this can do the trick, especially when working with |
|---|
| 53 | certain turn ratios (see <tt>SetTurnRatio</tt>). |
|---|
| 54 | </p> |
|---|
| 55 | <h2>Example<a name="7"></a></h2><pre class="codeinput"> SetMotor(MOTOR_B); |
|---|
| 56 | SyncToMotor(MOTOR_C); |
|---|
| 57 | SetPower(76); |
|---|
| 58 | SendMotorSettings(); |
|---|
| 59 | </pre><h2>See also<a name="8"></a></h2> |
|---|
| 60 | <p><a href="SendMotorSettings.html">SendMotorSettings</a>, <a href="SetMotor.html">SetMotor</a>, <a href="SetPower.html">SetPower</a>, <a href="SetTurnRatio.html">SetTurnRatio</a></p> |
|---|
| 61 | <h2>Signature<a name="9"></a></h2> |
|---|
| 62 | <div> |
|---|
| 63 | <ul> |
|---|
| 64 | <li><b>Author:</b> Linus Atorf, Alexander Behrens (see AUTHORS) |
|---|
| 65 | </li> |
|---|
| 66 | <li><b>Date:</b> 2007/10/15 |
|---|
| 67 | </li> |
|---|
| 68 | <li><b>Copyright:</b> 2007, RWTH Aachen University |
|---|
| 69 | </li> |
|---|
| 70 | </ul> |
|---|
| 71 | </div> |
|---|
| 72 | <p class="footer"><br> |
|---|
| 73 | Published with wg_publish; V1.0<br></p> |
|---|
| 74 | </div> |
|---|
| 75 | <!-- |
|---|
| 76 | ##### SOURCE BEGIN ##### |
|---|
| 77 | %% SyncToMotor |
|---|
| 78 | % Enables synchronization regulation for current active and specified motor |
|---|
| 79 | %% |
|---|
| 80 | %% Syntax |
|---|
| 81 | % |SyncToMotor(OtherMotor)| |
|---|
| 82 | %% |
|---|
| 83 | %% Description |
|---|
| 84 | % |SyncToMotor(OtherMotor)| sets the synchronization mode to the curren active motor (set by |
|---|
| 85 | % |SetMotor|) and the given motor port |OtherMotor|. The value |OtherMotor| can be addressed by |
|---|
| 86 | % the symbolic constants |MOTOR_A| , |MOTOR_B| and |MOTOR_C| analog to the labeling on the NXT |
|---|
| 87 | % Brick. The synchronization mode can be set off if the value |OtherMotor| is set equal to |
|---|
| 88 | % |'off'|. The synchronization setting takes only affect with the next |SendMotorSettings| command. |
|---|
| 89 | %% |
|---|
| 90 | % This means that both motors will act as if they were connected through an axle. Motors with more |
|---|
| 91 | % load on them (rough underground) will automatically be corrected and regulated for example. This |
|---|
| 92 | % "synchronization regulation" is the setting you want to use when driving with your robot. Also |
|---|
| 93 | % turning (SetTurnRatio) only affects motors that are synced. |
|---|
| 94 | %% |
|---|
| 95 | %% |
|---|
| 96 | % *Note:* |
|---|
| 97 | %% |
|---|
| 98 | % One motor can not be synchronized to itself. The synchronization mode and the speed regulation |
|---|
| 99 | % mode can be set only together at one time. Once a motor is synced to another motor, all |
|---|
| 100 | % settings set to it will be applied to both motors (until synchronisation is lost of course). |
|---|
| 101 | % Once 2 motors are synced, you effectively control 2 motors with 1 set of commands. This means, |
|---|
| 102 | % when calling |SendMotorSettings|, in fact 2 packets will be send to the 2 synced motors, hence |
|---|
| 103 | % you will experience about twice the lag than usual. Take this into consideration... |
|---|
| 104 | %% |
|---|
| 105 | % When using several motor commands with |SyncToMotor| statements, |
|---|
| 106 | % unexpected behaviour can occur, due to the NXTs internal error correction counters. |
|---|
| 107 | % Sometimes it can help to issue the commands |NXT_ResetMotorPosition(port, true)|, |
|---|
| 108 | % |NXT_ResetMotorPosition(port, false)| and |StopMotor(port, 'off')| for each of both |
|---|
| 109 | % motors. Although this seems like a waste of packets, this can do the trick, especially |
|---|
| 110 | % when working with certain turn ratios (see |SetTurnRatio|). |
|---|
| 111 | %% |
|---|
| 112 | %% Example |
|---|
| 113 | SetMotor(MOTOR_B); |
|---|
| 114 | SyncToMotor(MOTOR_C); |
|---|
| 115 | SetPower(76); |
|---|
| 116 | SendMotorSettings(); |
|---|
| 117 | %% |
|---|
| 118 | %% See also |
|---|
| 119 | % SendMotorSettings, SetMotor, SetPower, SetTurnRatio |
|---|
| 120 | %% |
|---|
| 121 | %% Signature |
|---|
| 122 | %% |
|---|
| 123 | % * *Author:* Linus Atorf, Alexander Behrens (see AUTHORS) |
|---|
| 124 | % * *Date:* 2007/10/15 |
|---|
| 125 | % * *Copyright:* 2007, RWTH Aachen University |
|---|
| 126 | % |
|---|
| 127 | |
|---|
| 128 | ##### SOURCE END ##### |
|---|
| 129 | --> |
|---|
| 130 | </body> |
|---|
| 131 | </html> |
|---|