Home \ Help \ Search \ Login RSS

Welcome, Guest. Please Login

This forum is now READ-ONLY! Please visit http://forum.wiring.co/ for the new forum.

Wiring ForumProgramming Questions & HelpPrograms › trapezoidal velocity profile?

Page Index Toggle Pages: 1
trapezoidal velocity profile? (Read 9768 times)
01/06/08 at 17:25:21

roypardi   Offline
Junior Member
I Love YaBB 2!
Boston USA

Posts: 57
(I may have asked this here before. If so sorry for the rerun- getting a bit desperate    Cry )

Has anyone here worked with motion control (and/or is less math impaired than me - which is probably everyone...)

I have a 6' x 6' drawing machine in progress (basically a big 2 axis plotter). The rig is all constructed and the drive system is done (4 24v DC motors with optical encoders controlled through the Wiring) board. I've got parts of the programming done but I got stalled trying to write a trapezoidal velocity routine to enable smooth movement.

I've googled to little result. A description/explanation of what I am trying to do is here:

I am probably over-complicating this but the sight of certain sorts of equations just elicit my deer-in-the-headlights response.


IP Logged
Reply #1 - 01/06/08 at 18:34:30

Alan_Kilian   Offline
Full Member
Wiring? It looks like
Java to me.

Posts: 118
You probably need to do a step before you get to the velocity profile I'm afraid.

You will need to write a small motor-control algorithm to run your DC motors
and that's not a trivial thing to do.

Just to get started, can you describe your setup?

Are you driving a DC motor driver chip with PWM outputs?
How are you controlling the direction of the motor?
How are you doing the encoder input counting?
How many counts-per-second will you get at maximum motor RPM?
Do your motors have gearboxes?

I've done a few of these, so I should be able to walk you through it
and get a working system once we get some more information.
IP Logged
Reply #2 - 01/10/08 at 16:25:47

roypardi   Offline
Junior Member
I Love YaBB 2!
Boston USA

Posts: 57
Hi Alan,

Any help would be much appreciated!

I'm pretty far along in this. I am using a couple of H-bridge motor driver boards to control 24v Maxon DC gearhead motors. The motors have tacho encoders. From the specs:  6:1 ratio spur gear head @ about 660 RPM at 24V DC. The encoder: 100 counts per turn and 2 channels.

I have it all working- reading encoder counts using interrupts, speed control through PWM, hard stopping the motors, etc.

I got stalled on the routine to ramp the speed up/down in order to reduce jerk and be able to stop without momentum causing overshooting the target position or a hard stop jerk the rig.

The rig is a 2 axis plotter using synchromesh cable for positive drive control.

Things I have tried so far:
--simply incrementing the speed by some rampRate each loop()
--using a cubic easing algorithm (tweening)

The velocity profile and PID code I have seen on the web has been too complicated for my math impaired brain.

Ideally I'd like the axes to be proportional- so that they arrive at the target xy position at the same time, but that may be out of my reach. Basically I am trying to write the sort of firmware that the Gamoto motor driver (apparently) uses:

I may breakdown and buy a couple of those if I can't solve this.

IP Logged
Page Index Toggle Pages: 1