To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcxOpen lugnet.robotics.rcx in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / 2939
2938  |  2940
Subject: 
LDCC control from PC
Newsgroups: 
lugnet.trains, lugnet.robotics.rcx
Followup-To: 
lugnet.trains
Date: 
Tue, 19 Feb 2008 21:08:48 GMT
Viewed: 
2865 times
  
Hello people,

I got a bit tired of compiling and uploading programs to a second RCX every time I need to make a small change (ok, adding the possibility to do adjustments with the remote control helps a bit), so I decided to make a win-program that would control the trains directly from the PC using the USB IR tower. If anyone else thinks they might have use for it, even better (it is written in C# so it requires .NET, but I guess nowadays it is not an issue).

Idea: The main idea is that of using states+actions and transitions (hence the current working title “Trainsition”), while at the same time displaying the picture of the expected current situation on the layout. Here are two screenshots of an example layout:


Each state can have several consecutive actions (e.g. loco1 forward at speed 30 -> wait 3000ms -> loco1 stop) and can then move to the next state. Transitions are triggered either by a sensor on the layout or by a timer, and each state can have transitions to more than one other state. More independent state machines can co-exist and run in parallel (two in the above example, one for each loop).

Visual details: The layout picture can be anything. In the above example I used a screenshot from the Track Designer, where I altered the background color to be magenta (default transparency color). The distinction between locos and non-loco-motors is purely cosmetic (and if someone has nicer icons for locos/motors, I’ll be happy to change them :) ).

Technicalities: I plan on making a PIC-based hardware thingy that will gather inputs from up to 10 sensors (reed switches) and notify the program through the serial port. Another possibility is to have a second RCX (or more) with sensors, running a simple program that sends notifications via IR messages.

Since I am quite new to LEGO IR messaging, I need some suggestions in order not to cause IR chaos - what code and format should I use for the messages? Should some of it be customizable? As for the contents of the message, I basically only need to send 1-2 bytes to the IR tower (1 bit per sensor if all inputs are sent each time, or 1 byte if one message is sent each time a sensor is pressed). Is there any need for events when sensors are released, by the way? It was not in the initial plans, but I could consider adding it.

These are the DCC commands currently supported by the program, let me know if there are others that might be necessary/useful:
  • Setting loco’s direction (fwd, bwd, stop)
  • Setting loco’s speed
  • Turning on/off a function
Should the program send a power on/off message to LDCC on start/stop? I plan on putting the possibility to warn the user before actually turning on power on the tracks, as some of decoders perform a factory reset if they are on the track at that point. I still haven’t goot feedback from Mark Riley on whether it soon might be possible to choose not to send the (standard, but fatal) reset sequence which seems to be causing that.

Any suggestions are of course more than welcome :)


Cheers,
Matija

FuT lugnet.trains



Message has 1 Reply:
  Re: LDCC control from PC
 
(...) Cool! Keep posting on your progress. Benn (17 years ago, 21-Feb-08, to lugnet.trains, FTX)

13 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