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 / 341
340  |  342
Subject: 
Re: train control
Newsgroups: 
lugnet.robotics.rcx.java
Date: 
Thu, 8 Jul 2004 10:06:25 GMT
Viewed: 
7322 times
  
Juergen Stuber wrote:
Hi Daniel,

Daniel Carvalho <danielpc@isutc.transcom.co.mz> writes:

I want to use rcx to control a lego train, but the fact that
lejos only have 7 levels makes it dificult to set the speed.

Jürgen Stube wrote in september2001:

"Yes, the standard LEGO routines make it very hard to control
speed.  Basically with an 8ms cycle they set the motor output
part of the time (depending on power level) to full voltage,
and the rest they let it float."

i've made a java program to imitate this, using a 20 ms
cycle, but the result is not satisfying. It's not so smooth
as when the train is controlled with the Electric Train
Speed Regulator (#4548).


sorry to reply so late, I wanted to try it myself but didn't
get around to do it yet (I'm starting an IT-Business as a
consultant/systems programmer, see http://www.jstuber.net/).

I managed to run a train from an RCX with the standard power levels
using the view example, and that was quite nice with the metroliner
train, I could regulate from standstill to full speed.
If you just have a motor without load it will probably not so nice
and runs always at almost full speed.


hi Juergen

I tried it with load, and it works much better! Only that the speed is
not very stable in the curves.



Or is it a problem with my code (see at end of message)?


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...

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...


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



Hope this helps

it helped!

daniel



Message has 1 Reply:
  Re: train control
 
Hi Daniel, (...) 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 (...) (20 years ago, 9-Jul-04, to lugnet.robotics.rcx.java)

Message is in Reply To:
  Re: train control
 
Hi Daniel, (...) sorry to reply so late, I wanted to try it myself but didn't get around to do it yet (I'm starting an IT-Business as a consultant/systems programmer, see (URL) managed to run a train from an RCX with the standard power levels using (...) (20 years ago, 5-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

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

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