Ah ok, that makes sense and justifies the question of the whole thread, of course . I didn't have the chance to play around with APR before, and it's sime while ago that I read the article about it. Thanks for clearing that up!mattallen37 wrote:I don't think you understand the APR. It never says "Ok, I'm done regulating, motor is free again."; never. It is always actively trying to go to the position (that's what's so incredibly awesome about it).
Absolute Position Regulation Tips [NXC]
Re: Absolute Position Regulation Tips [NXC]
RWTH - Mindstorms NXT Toolbox for MATLAB
state of the art in nxt remote control programming
http://www.mindstorms.rwth-aachen.de
MotorControl now also in Python, .net, and Mathematica
state of the art in nxt remote control programming
http://www.mindstorms.rwth-aachen.de
MotorControl now also in Python, .net, and Mathematica
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: Absolute Position Regulation Tips [NXC]
Indeed, it has come a long way since the old control commands
IMO APR is the best single addition to NXC (Edit: that is, since I started using it in '09).
IMO APR is the best single addition to NXC (Edit: that is, since I started using it in '09).
Matt
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
-
- Posts: 117
- Joined: 27 Dec 2010, 19:27
Re: Absolute Position Regulation Tips [NXC]
Ahmahm, good discussion.
But then, what is the criteria of the FW to change the runstate?? The graph you showed (http://www.mindstorms.rwth-aachen.de/tr ... tateEx.png) makes me believe that judging by the runstate is a better option, if I really need accuracy in the end position.
But then, what is the criteria of the FW to change the runstate?? The graph you showed (http://www.mindstorms.rwth-aachen.de/tr ... tateEx.png) makes me believe that judging by the runstate is a better option, if I really need accuracy in the end position.
Re: Absolute Position Regulation Tips [NXC]
Hello,
There is two regulation modes. When you did not set any speed limitation, the best is to monitor the actual position (or speed) to know whether the movement is finished.
When you use speed limitation, what I usually do is to consider that the movement is finished once the consign (which is speed limited and is the current controlled position) reaches the final position.
As said Matt, the absolute position regulation will never change the runstate, the motor is always controlled.ricardocrl wrote:But then, what is the criteria of the FW to change the runstate?
There is two regulation modes. When you did not set any speed limitation, the best is to monitor the actual position (or speed) to know whether the movement is finished.
When you use speed limitation, what I usually do is to consider that the movement is finished once the consign (which is speed limited and is the current controlled position) reaches the final position.
LEGO things http://ni.fr.eu.org/lego/ - NXT Improved Firmware (GCC) http://nxt-firmware.ni.fr.eu.org/ - Other robots http://apbteam.org
Re: Absolute Position Regulation Tips [NXC]
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.hfile?
If I use posreg.h, do I still have to set the rate from 100ms to 10ms or is this handled by the firmware?
What are the upper and lower limits of the 3 PID parameters?
What are the default values of the PID parameters?
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?
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?
Or does the system not use any power when friction (rather than regulation) is preventing movement?
Are there any examples of programs using regulation written in NXC that I can look at?
Sorry to ask so many questions but I think the smoother movement under regulation would minimise vibration, if only I could understand it.
Can this be used with standard firmware by just including the posreg.hfile?
If I use posreg.h, do I still have to set the rate from 100ms to 10ms or is this handled by the firmware?
What are the upper and lower limits of the 3 PID parameters?
What are the default values of the PID parameters?
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?
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?
Or does the system not use any power when friction (rather than regulation) is preventing movement?
Are there any examples of programs using regulation written in NXC that I can look at?
Sorry to ask so many questions but I think the smoother movement under regulation would minimise vibration, if only I could understand it.
A sophistical rhetorician, inebriated with the exuberance of his own verbosity, and gifted with an egotistical imagination that can at all times command an interminable and inconsistent series of arguments to malign an opponent and to glorify himself.
Re: Absolute Position Regulation Tips [NXC]
No, you need John Hansen Enhanced firmware, or NXT Improved Firmware if you feel like hacking on the firmware.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?
Yes, however this is not mandatory but you will get better result if you reduce the regulation interval. Use SetMotorRegulationTime.If I use posreg.h, do I still have to set the rate from 100ms to 10ms or is this handled by the firmware?
They are the same as the default control, you can use PID constants.What are the upper and lower limits of the 3 PID parameters?
See PosRegEnable documentation.What are the default values of the PID parameters?
If you leave the absolute position regulation mode, you will have to enable it again.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 I understand the questions right, yes and yes.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?
I am used to never disable regulation, you could use a multimeter to measure current if you like.Or does the system not use any power when friction (rather than regulation) is preventing movement?
Here is one: http://ni.fr.eu.org/blog/position_control_test/Are there any examples of programs using regulation written in NXC that I can look at?
LEGO things http://ni.fr.eu.org/lego/ - NXT Improved Firmware (GCC) http://nxt-firmware.ni.fr.eu.org/ - Other robots http://apbteam.org
Re: Absolute Position Regulation Tips [NXC]
Thank you very much for taking the time to assist me.
A sophistical rhetorician, inebriated with the exuberance of his own verbosity, and gifted with an egotistical imagination that can at all times command an interminable and inconsistent series of arguments to malign an opponent and to glorify himself.
Re: Absolute Position Regulation Tips [NXC]
Just wanted to say that I finally bit the bullet and used the new motor regulation.
Much simpler than I expected, only needed the following commands -
PosRegEnable (OUT_A); // Enable positive regulation for panning motor- Port A
PosRegSetMax (OUT_A, 75, 75); // Speed and acceleration limit
SetMotorRegulationTime (10); // Speed up the regulation process
PosRegAddAngle (OUT_A, h_move); // Pan to next column
I thought it might be too slow but it is just as fast, although noticeably smoother.
Thank you very much Mr Schodet!
Much simpler than I expected, only needed the following commands -
PosRegEnable (OUT_A); // Enable positive regulation for panning motor- Port A
PosRegSetMax (OUT_A, 75, 75); // Speed and acceleration limit
SetMotorRegulationTime (10); // Speed up the regulation process
PosRegAddAngle (OUT_A, h_move); // Pan to next column
I thought it might be too slow but it is just as fast, although noticeably smoother.
Thank you very much Mr Schodet!
A sophistical rhetorician, inebriated with the exuberance of his own verbosity, and gifted with an egotistical imagination that can at all times command an interminable and inconsistent series of arguments to malign an opponent and to glorify himself.
Re: Absolute Position Regulation Tips [NXC]
I want to add a facility to go back a fixed number of steps by continually storing the motor positions n steps back so that I can regress to that point.
The problem is that my program is proceeding in increments using the 'add' method and not storing the total values.
Can I read one of the rotation counters to get the absolute values without cancelling the positive regulation mode?
Is so, which one would be best?
As an alternative, I could calculate absolute values for all points for both motors and store these in a 2-dimensional matrix before moving.
Problem is that under some circumstances the matrix would need about 180 elements (360 'cells') with values ranging from 0 to 40,000 in one column and 0 to 5,000 in the other.
Would the NXT be capable of holding arrays of that length and with such large contents?
I am trying to determine what my options are before re-writing the program so any comments would be appreciated.
The problem is that my program is proceeding in increments using the 'add' method and not storing the total values.
Can I read one of the rotation counters to get the absolute values without cancelling the positive regulation mode?
Is so, which one would be best?
As an alternative, I could calculate absolute values for all points for both motors and store these in a 2-dimensional matrix before moving.
Problem is that under some circumstances the matrix would need about 180 elements (360 'cells') with values ranging from 0 to 40,000 in one column and 0 to 5,000 in the other.
Would the NXT be capable of holding arrays of that length and with such large contents?
I am trying to determine what my options are before re-writing the program so any comments would be appreciated.
A sophistical rhetorician, inebriated with the exuberance of his own verbosity, and gifted with an egotistical imagination that can at all times command an interminable and inconsistent series of arguments to malign an opponent and to glorify himself.
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: Absolute Position Regulation Tips [NXC]
Instead of always adding a value using something like PosRegAddAngle, why not keep a running total in the program? I use PosRegSetAngle instead of PosRegAddAngle.
As far as the NXT being able to hold that many values, that isn't anywhere near the RAM limit. Assuming you used arrays of long (even though 40,000 would fit in an unsigned int), 360 elements would only use 1,440 bytes of RAM, out of the 32k available.
As far as the NXT being able to hold that many values, that isn't anywhere near the RAM limit. Assuming you used arrays of long (even though 40,000 would fit in an unsigned int), 360 elements would only use 1,440 bytes of RAM, out of the 32k available.
Matt
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
Who is online
Users browsing this forum: No registered users and 2 guests