Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Limiting acceleration in easyC (http://www.chiefdelphi.com/forums/showthread.php?t=62908)

Neurovirus 30-01-2008 21:59

Limiting acceleration in easyC
 
today we let someone besides the drivers/programmers drive and they almost flipped the bot by switching from full forward to full reverse

so i was thinking about limiting the acceleration, namely not allowing switching back and forth between forward and back.

the question is how?
and
is this even a good idea?

DonRotolo 30-01-2008 22:19

Re: Limiting acceleration in easyC
 
How?
Create 2 variables, "Out" and "Old_Out", default them to 127. Store the real final PWM output to Out, and subtract Old_Out, and if the difference is greater than some rate of change (say 50), reset the value to the rate of change (Out - 50). Then set Old_Out == Out, and repeat each loop. You'll have to manage the math a little bit, to prevent exceeding 255 or zero, and maybe elsewhere, but that basic idea is a simple PID loop with only D being used.

Good idea? Maybe not. Driver training is probably a better approach.

Don

jskene 30-01-2008 23:10

Re: Limiting acceleration in easyC
 
We've been using code like that for several years. It not only helps the driver, but takes a big load off the drive train - chains, belts, gears, and reduces the chances of a tripped circuit breaker.

Neurovirus 31-01-2008 21:39

Re: Limiting acceleration in easyC
 
@jskene

how did u do it? like how Don R. described it?

Thanks, Don

Neuro

jskene 31-01-2008 22:40

Re: Limiting acceleration in easyC
 
Yes, in a similar fashion.

billbo911 31-01-2008 22:45

Re: Limiting acceleration in easyC
 
Quote:

Originally Posted by jskene (Post 689217)
We've been using code like that for several years. It not only helps the driver, but takes a big load off the drive train - chains, belts, gears, and reduces the chances of a tripped circuit breaker.

We've written a "Torque_Limit" function for this year. We can set the max delta for each loop to any value. Out of curiosity, what range have you found to be reasonable? 50, 75, 100 per loop?

jskene 01-02-2008 08:47

Re: Limiting acceleration in easyC
 
We used different values for forward and reverse. We want to be able to stop faster than we can accelerate.

Our acceleration rate was limited to 3, deceleration to 8.

billbo911 01-02-2008 10:10

Re: Limiting acceleration in easyC
 
Quote:

Originally Posted by jskene (Post 690083)
We used different values for forward and reverse. We want to be able to stop faster than we can accelerate.

Our acceleration rate was limited to 3, deceleration to 8.

Ah, excellent. Thank you.
One more question. Our code works on a change in pwm value per loop. The values you gave seem lower than I would expect. Are your values for change in pwm/loop or loops for a full direction change?

jskene 01-02-2008 12:38

Re: Limiting acceleration in easyC
 
Quote:

Originally Posted by billbo911 (Post 690133)
Ah, excellent. Thank you.
One more question. Our code works on a change in pwm value per loop. The values you gave seem lower than I would expect. Are your values for change in pwm/loop or loops for a full direction change?

Change/Loop.

It also applies to directional change - forward<--->reverse

billbo911 01-02-2008 12:48

Re: Limiting acceleration in easyC
 
Quote:

Originally Posted by jskene (Post 690213)
Change/Loop.

It also applies to directional change - forward<--->reverse

Those numbers are tighter than I assumed they would need to be, but the math agrees.
You can go from STOP to FULL in 1.1 sec. and FULL to STOP in .4 seconds.
Very nice!
How do the drivers like the response?

scottanderson 01-02-2008 12:51

Re: Limiting acceleration in easyC
 
We wrote some code for that this year, but then were given advice by a very experienced team that we shouldn't worry about the drive train and that putting a full reverse on the motors is a good way to brake.

The problem with the limiting code is that the robot really doesn't stop very quickly at all when the outputs are just set to 0.

Regards,
-scott

jskene 01-02-2008 13:48

Re: Limiting acceleration in easyC
 
"How do the drivers like the response?"

They don't notice a big difference.


Quote:

Originally Posted by scottanderson (Post 690222)

The problem with the limiting code is that the robot really doesn't stop very quickly at all when the outputs are just set to 0.

Regards,
-scott

You probably have the "BRAKE" jumper on the Victor set to "COAST".

scottanderson 02-02-2008 12:41

Re: Limiting acceleration in easyC
 
Quote:

You probably have the "BRAKE" jumper on the Victor set to "COAST".
You are correct. Thanks for the tip.

What do folks think about the advice we were given about thrashing the gearboxes, though? Was that sound advice, or do we need to worry about adding some sort of intelligent damping to avoid it?

Regards,
-scott

paulcd2000 02-02-2008 12:50

Re: Limiting acceleration in easyC
 
one method we are attempting this year is to use the accelerometer, can actually limit the acceleration itself, instead of just pwm values


All times are GMT -5. The time now is 10:58.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi