Absolute position reglation in firmware

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: Absolute position reglation in firmware

Post by HaWe »

matt,
your idea is not bad, but if the motor once has started, it keeps on running, and you can't change the target counter intermediately...

and having this on a remote brick (via BT) you can send the encoder target to the slave and the slave itself controls the actions just by his own - no more checks or value transfers back and forth are necessary! :)
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: Absolute position reglation in firmware

Post by mattallen37 »

No, that is one of the HUGE advantages of this new feature, you CAN change the target at any time, and as often as you want. I use it in a control loop for a steering mechanism for an RC car.

I know you can send the target position to slave using BT, but I want to be able to do it with RS-485, and standard FW doesn't allow for that.

The point of my if statement as follows:

Code: Select all

if(  MotorTachoCount (OUT_A)>=(TargetPosition-Threshold)  &&  MotorTachoCount (OUT_A)<=(TargetPosition+Threshold)  )
is to detect if the motor is near the target position (to detect if it has completed it's assignment).
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
schodet
Posts: 139
Joined: 29 Sep 2010, 11:21
Contact:

Re: Absolute position reglation in firmware

Post by schodet »

mattallen37 wrote:That is good, but wouldn't it be better for John to add your single function to his tried and proven FW, than for you to add his countless modifications to your single one? I need RS-485 support, as well as the math (bitwise operators, sin, and cosin), among other things.
Yes, I see my firmware more like an experimental development firmware.
mattallen37 wrote:
schodet wrote:This can be done, but it is not always sufficient. The motor can be off by one or two degree depending on how well your PID coefficients are tuned.
Well, I understand, but if it must be EXACTLY on the position, what difference will there be in making another function? I would just use a range to find out if it is at the right place. Something like the following:

Code: Select all

if(  MotorTachoCount (OUT_A)>=(TargetPosition-Threshold)  &&  MotorTachoCount (OUT_A)<=(TargetPosition+Threshold)  )
It will check the position compared to the target position, + or - the threshold. Basically, if the target was 180, and the threshold was 5, the "if" statement would be true if the MotorTachoCount was in the range of 175-185.
OK, this is part of the solution.

But I have other ideas too. In our APBTeam robot we simply check that the regulated position matches the desired position; if this is true, we consider the movement is finished. Combined with a blocking detection, this works really well, but it is only applicable with speed limitation.
LEGO things http://ni.fr.eu.org/lego/ - NXT Improved Firmware (GCC) http://nxt-firmware.ni.fr.eu.org/ - Other robots http://apbteam.org
schodet
Posts: 139
Joined: 29 Sep 2010, 11:21
Contact:

Re: Absolute position reglation in firmware

Post by schodet »

Matt, have you seen any regression in other regulation methods?

Thanks for testing!
LEGO things http://ni.fr.eu.org/lego/ - NXT Improved Firmware (GCC) http://nxt-firmware.ni.fr.eu.org/ - Other robots http://apbteam.org
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: Absolute position reglation in firmware

Post by mattallen37 »

schodet wrote:Matt, have you seen any regression in other regulation methods?

Thanks for testing!
I am not exactly sure what you mean. This is the only motor position controller that I have been able to use that works for what I want. No other has allowed me to update the desired position on-the-fly, or been anywhere near this stable (no overshooting and resonating and all that).

I do not understand PID stuff to make my own controller, so this is really awesome for me. I have been wanting something like this now for about a year now.

Edit: Oh, and you're welcome for "testing" it. It is so cool, I have built two robots already, just to "test" it (one of them is a robotic arm with 5 motors, two NXT... about 80cm tall).
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
schodet
Posts: 139
Joined: 29 Sep 2010, 11:21
Contact:

Re: Absolute position reglation in firmware

Post by schodet »

mattallen37 wrote:I am not exactly sure what you mean. This is the only motor position controller that I have been able to use that works for what I want. No other has allowed me to update the desired position on-the-fly, or been anywhere near this stable (no overshooting and resonating and all that).
I do not understand PID stuff to make my own controller, so this is really awesome for me. I have been wanting something like this now for about a year now.
Edit: Oh, and you're welcome for "testing" it. It is so cool, I have built two robots already, just to "test" it (one of them is a robotic arm with 5 motors, two NXT... about 80cm tall).
Whaou! Thanks :)
LEGO things http://ni.fr.eu.org/lego/ - NXT Improved Firmware (GCC) http://nxt-firmware.ni.fr.eu.org/ - Other robots http://apbteam.org
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests