Clarification about regulating speed on NXT motors
Page 1 of 1

Author:  JamesD [ Wed Apr 18, 2007 7:52 pm ]
Post subject:  Clarification about regulating speed on NXT motors

I’m just trying to clarify my understanding of regulating speed on the NXT motors.
For example there are two settings for NXT motors on the “Motors and Sensors Setup Wizard”. One is with speed control and the other is without.

Does that mean that if you choose “with speed control” it automatically regulates the speed levels consistently across motors?

Do you still have to add the code below to regulate the motors if you wish to correctly regulate the speed?
nMotorPIDSpeedCtrl[motorA] = mtrSpeedReg;
nPidUpdateInterval = 10;

If that is the case and you need to add code to make speed regulation work anyway what is the setting “NXT motor without Speed Control” used for? When would you use it? Is it needed?


Author:  Dick Swan [ Thu Apr 26, 2007 9:34 am ]
Post subject: 

The intent is that the wizard will do the code for you and you don't have to explicitly set it up in your program.

If you find this not to be the case, then it is a bug. Please report it.

There's a bunch of code that RobotC automatically generates in a "prolog" -- before user code is run -- and in a "epilog" -- after user code is run but just before task ends that is invisible to the end user. If you're technically inclined and can understand assembly code then hit key "F9" and you'll get a listing of the individual assembly opcodes that are generated by your code.

If you use F9 you should see the prolog code at the start of the task includes a bunch of instructions generated by the setup wizard related to motors and sensors.

Don't be overwhelmed by the term "assembly" code. RobotC's "aseembly" code (i.e. individual instructions) are a lot higher level than the typical assembly code from a conventional microprocessor and the assembly listing is not that hard to read.

Author:  JamesD [ Sun Apr 29, 2007 9:40 am ]
Post subject: 

Thanks Dick,

Having followed your directions above and after re-reading the section on "Motor Speed/Power Control" in the RobotC help guide (For others: double click the Motors heading in the left pane (Templates section)), I now understand what you "get" when you choose the closed loop section.

My confusion over this issue arose because I previously thought in order to go straight you had use the motor Synchronisation feature.
ie const TSynchedMotors kSyncType = synchAB;
Probably a prejudice I brought from Robolab 2.4.

As a suggestion for refinement down the track it may be worth making the nMaxRegulatedSpeed setting a grayed out or hidden option in the wizard dialog box. Then, when the novice user selects the "motorNxtEncoderClosedLoop" option it would appear or no longer be grayed out. It could automatically default to the "safe" option of 750 counts but giving advanced users the option to set it at 1000 with its inherent "risks".

Also am I correct in assuming if you set the nMaxRegulatedSpeed = 750 that when you set a motor speed to 50 it will achieve 375 counts per second. The upside of this is that the nMaxRegulatedSpeed would also be a very easy and central way for novices to regulate the core speed settings throughout their programs.

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group