h-g-t wrote:Been trying to follow this but it is all a bit too complex, even after reading the tutorial (several times).
Can this be used with standard firmware by just including the posreg.h file?
No, you need John Hansen Enhanced firmware, or NXT Improved Firmware if you feel like hacking on the firmware.
If I use posreg.h, do I still have to set the rate from 100ms to 10ms or is this handled by the firmware?
Yes, however this is not mandatory but you will get better result if you reduce the regulation interval. Use SetMotorRegulationTime.
What are the upper and lower limits of the 3 PID parameters?
They are the same as the default control, you can use
PID constants.
What are the default values of the PID parameters?
See
PosRegEnable documentation.
If I set regulation parameters for ports A and B at the start of a program, do I only have to use the standard motor commands thereafter and regulation is applied automatically?
If you leave the absolute position regulation mode, you will have to enable it again.
I use worm drives in my project so there is no movement unless the motors are turning. The motors are therefore set to float to avoid using battery power when idle.
Can I set regulation before using a motor then cancel it when movement is complete, then re-engage regulation before the next movement and so on?
Or can I set them to float when regulation is complete for a specific movement?
If I understand the questions right, yes and yes.
Or does the system not use any power when friction (rather than regulation) is preventing movement?
I am used to never disable regulation, you could use a multimeter to measure current if you like.
Are there any examples of programs using regulation written in NXC that I can look at?
Here is one:
http://ni.fr.eu.org/blog/position_control_test/