To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.roboticsOpen lugnet.robotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / 1653
1652  |  1654
Subject: 
Re: ROM stuff: Better than PWM
Newsgroups: 
lugnet.robotics
Date: 
Sat, 19 Dec 1998 13:39:55 GMT
Original-From: 
Markus L. Noga <markus.noga@inrialpes.IHATESPAMfr>
Viewed: 
3648 times
  
Kekoa Proudfoot wrote:
> You can avoid the O(n^2) table cost by keeping a counter.  Count p cycles
> on, then count n-p cycles off.  This works.  But as n gets large, the
> period of n ms drops low enough that the motor becomes ineffective.  For
> example, if n is 1000 and p is 500, the motor is on for 1/2 sec then off
> for 1/2 sec.  That won't drive the motor the way you want it to be driven.
> Even for n = 100, things are very jittery.
> 
> So here's my solution:
> 
> every 1/1000th sec:
>     count += p
>     if (count >= n)
>         turn motor on
>         count -= n
>     else
>         turn motor off
> 
> That's it.
> 
> I'm sure this algorithm has been thought of before; I got the idea from
> Bresenham's line drawing algorithm and from the Floyd-Steinberg error
> diffusion dithering algorithm, but I believe this algorithm is a typical
> one used in one-bit D/A converters.

In fact, I'm using exactly this algorithm to drive the motors for my
laser scanner - though the host platform is an embedded PC, not the RCX.

I'm currently rewriting the motor drivers to:

* keep an 1ms resolution system clock
* call the task scheduler every 20 ticks, thereby making it IR
compatible

I'll integrate the Bresenham algorithm with a practical n of, say, 256,
too.

--
Markus L. Noga noga@inrialpes.fr
INRIA Rhône-Alpes http://www.inrialpes.fr/
IPR Universität Karlsruhe   http://wwwipr.ira.uka.de/



Message is in Reply To:
  ROM stuff: Better than PWM
 
So I was thinking about writing a motor driver that is better than what is in the ROM already. Here's the problem: You have a function called once every 1/1000th of a second. You want to allow n speeds of the motor at minimal cost in lookup tables. (...) (28 years ago, 19-Dec-98, to lugnet.robotics)

3 Messages in This Thread:


Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR