|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Trapezoidal Motion Profile Using Discrete Method
Hi,
I'm trying to program an arduino to generate a Trapezoidal Motion Profile to control a DC motor with a quadrature encoder. Essentially, the user will input the desired Target Position, Max Velocity and Acceleration (decel = -accel) and the code will calculate the target position versus time which will then be compared with the actual position. The result will then be subject to a PID calculation My initial assumption was that I could use basic Newtonian physics to determine position (i.e. PT = P0 + V0T + 1/2AT2, VT = V0 + AT). However, after reading through documentation for pre-existing motion controllers, I discovered that the prevalent method was to use a discrete time method, which is as follows: VK = VK-1 + A (A = Acceleration) PK = PK-1 + VK-1 + A/2 I'm having a hard time understanding quite how this equation would generate the target position versus time. In the case of Velocity, it seems to just add the acceleration to the current velocity. But what about everything in between? Could anybody take a shot at explaining to me how this method is used? I've spent ages searching for answers online but have had no such luck. Thanks, Martin |
|
#2
|
||||
|
||||
|
Re: Trapezoidal Motion Profile Using Discrete Method
|
|
#3
|
|||
|
|||
|
Re: Trapezoidal Motion Profile Using Discrete Method
Thanks for your reply!
I'm trying to stay away from S-Curve profiles for the time being. I think I should probably understand the trapezoidal method before I start jumping into some more complicated. |
|
#4
|
||||
|
||||
|
Re: Trapezoidal Motion Profile Using Discrete Method
Quote:
Quote:
FWIW, I just updated the paper to revA to include a plot of accel vs velocity so you can check to make sure the profile does not run afoul of motor saturation. Last edited by Ether : 09-03-2015 at 18:30. |
|
#5
|
|||
|
|||
|
Re: Trapezoidal Motion Profile Using Discrete Method
Thanks, I'll certainly take another look.
Potentially, I could generate an sigmoid function to represent position, using parameters from a trapezoidal profile. I suppose calculating position at a given time would then be as simple as plugging t into the equation. This would then do away with the need to have 3 section for accel, max velocity and decel. Does that sound feasible? This was how I originally assumed things were done. |
|
#6
|
||||
|
||||
|
Re: Trapezoidal Motion Profile Using Discrete Method
The a(t), v(t), and x(t) functions in the paper are stand-alone. If you are not going to use velocity or acceleration in your control algorithm, you don't need to compute a(t) or v(t). Just use x(t). |
|
#7
|
|||
|
|||
|
Re: Trapezoidal Motion Profile Using Discrete Method
Any idea how I would take 3 variables for a trapezoidal profile (Accel, Max Velocity and Target Position, *decel=-accel*) and convert that into x(t)?
|
|
#8
|
||||
|
||||
|
Re: Trapezoidal Motion Profile Using Discrete Method
Quote:
http://www.chiefdelphi.com/media/papers/download/4287 http://www.chiefdelphi.com/media/papers/download/4288 Knock yourself out. |
|
#9
|
|||
|
|||
|
Re: Trapezoidal Motion Profile Using Discrete Method
Thanks for that!
Afraid I can't open the .exe as I'm using a mac. Any chance you have a mac version or source code available? Thanks |
|
#10
|
||||
|
||||
|
Re: Trapezoidal Motion Profile Using Discrete Method
Quote:
|
|
#11
|
||||
|
||||
|
Re: Trapezoidal Motion Profile Using Discrete Method
Quote:
Assuming you meant the Logistic Function: x(t) = L/(1+exp(-k*(t-tm))),...that would be a poor choice. To see why, suppose you want to go from x=0 and v=0 and a=0 at t=0 to x=5ft and v=0 and a=0 at t=3seconds. Then L and tm would be L=5 tm=3/2. The only free parameter left is k; try k=2, k=3, k=4, k=5. As can be seen from the graphs, there is no acceptable value for k. k=2: a, v, and x are non-zero at beginning and end points, and x has not reached 5 at t=3. k=3: better, but a and v are still nonzero at endpoints k=4: a is still not quite zero at endpoints. max accel has grown to 7.7 k=5: endpoints look good, but max accel is now 12, and max jerk is 77 Compare those graphs to the Figure on page 1 of this paper, which uses a sinusoidal function for x(t), resulting in x=0, v=0, and a=0 at t=0, and Last edited by Ether : 10-03-2015 at 17:25. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|