To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.javaOpen lugnet.robotics.rcx.java in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / Java / 344
343  |  345
Subject: 
Re: train control
Newsgroups: 
lugnet.robotics.rcx.java
Date: 
Fri, 9 Jul 2004 16:59:13 GMT
Viewed: 
7622 times
  
Hi Daniel,

Daniel Carvalho <danielpc@isutc.transcom.co.mz> writes:
Juergen Stuber <juergen@jstuber.net> wrote:

What you are doing is to switch the power level quickly,
so effectively you get less power and with bigger gaps
in between.
To really slow down a motor without load you should
alternate
between on and stop, and to make it smooth I'd try to stay below
10ms for a full cycle (the cycle time of the ROM code is 8ms).

If i use a cycle of 10ms, then i could only use 10 different
speeds, because the Thread.sleep has a resolution of 1ms...

you can do more levels by something like the Bresenham algorithm,
i.e. for speed 4.5 you turn it on for 4ms and 5ms of the 10ms
alternatively.  Though 10 levels should normally suffice,
the standard LEGO train controller has fewer levels.

Maybe i could try this: Insteed of alternating the power
between 0 and 7, to it between to values, which would be
calculated by the program.

For instance, for slow speeds, between 0 and 4. If the user
want's to increase the speed, change to 4 and 5. Then 5 and
6 and so one...

It's better not to use the built-in power levels and always use
full power, otherwise it will confuse things.
It won't help anyway, because they also have the same 1ms resolution.

(by the way, i concluded that it's the same thing to use
motor.flt or motor.stop)

No, it is not, motor.flt means coasting and motor.stop braking.
But motor.stop is also affected by the power level,
e.g. it will brake very softly if the power level is 1.
You can play with the view example and feel it :-)


Jürgen

--
Jürgen Stuber <juergen@jstuber.net>
http://www.jstuber.net/
gnupg key fingerprint = 2767 CA3C 5680 58BA 9A91  23D9 BED6 9A7A AF9E 68B4



Message is in Reply To:
  Re: train control
 
(...) hi Juergen I tried it with load, and it works much better! Only that the speed is not very stable in the curves. (...) If i use a cycle of 10ms, then i could only use 10 different speeds, because the Thread.sleep has a resolution of 1ms... (...) (20 years ago, 8-Jul-04, to lugnet.robotics.rcx.java)

7 Messages in This Thread:


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

Custom Search

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