Thursday, January 15, 2009

What can train robots do? (PART 1)

I've been asked about using a computer display of the railroad, so this time I thought I'd show something with a display.

[left] Here is my son Dan. He is an HO model railroader. He does not have a layout yet, or DCC.

Looks like he is having fun.


[RIGHT] A closeup shows he is using two wireless Digitrax cabs (four throttle knobs) to run four trains.

Below is a nice picture of Dan checking the progress of a F3 AB, you can just barely see the B unit at the upper left edge of the picture. He is also running the steamer just to the right coming toward the camera, and the two entering and exiting the field of view in the lower left.



Two other trains were being run by collision avoidance robotic control.
Here is a screen dump from the old windows 98 PC that was controlling the robotic trains.
This was my first generation control software. It used way points to calculate speed to estimate the position of each train. Accuracy was within about two feet. Trains could be controlled manually, or , by turning on F9 the robot would take over.

The robot avoided collisions by restricting the distance between it and the rear of any train ahead of it. The minimum distance that it would approach the train ahead was determined to be half the distance between the robots caboose and the train behind it. Another way of understand this is; A robot subtracts the length of all the trains on the track from the length of the track to find how much empty track there is. It divides the track into thirds. It divides that by the number of trains on the track.

When there are only two trains, that resulted in the robot keeping about one third of the empty track between it and the train it was following. Double that to four trains and one sixth of the empty track will be the minimum distance for following. We ran 6 trains at once, so each train had a 1/18 if the empty track as the minimum. The trains totaled about 30 feet. The main is about 235 feet. Divide 205 feet by 18 and we had an 11 foot minimum. With an accuracy of two feet we have a eight foot margin of safety.

Here is a diagram showing the relationship between the picture and the computer display.

The robots don't just stop when they hit that minimum distance. You won't see them waiting for the engine ahead to clear a block like they do on a conventional block system. Instead, they try to run at whatever speed they have "learned" from a human operator. They slow down in yards or the approaches to tunnels. They will never go faster on any spot of the railroad than a human has driven. ( It's one reason they never run off the end of a siding unless some human went faster than speed zero off the end of that siding.) Instead, Robots run at the "learned" speed as long as they are in the rear half of their share of the empty track. They reduce their speed in proportion to the where they are in their share of the empty track. The closer they are to only having one third of their share of the empty left, the more they slow below their learned speed. They only stop when the train ahead stops and the robot has used up two thirds of it's available space. If the train ahead is going slower than the speed that the robot has learned, then it will gradually match speed with the loco ahead.

The result is a very pleasing appearance. Locos don't appear to be playing follow the leader, nor do they stop and start except when they need to stop at a station or passing siding.

One side effect has to do with very slow moving locos. My shay, for example, has been "taught" to go very slow. Just like a real railroad, it will eventually have all the other trains bunched up behind it. You have to teach the shay to pull off at a passing siding and let other trains pass.

On future versions, I'd like to make the robots smarter and identify when they are clogging the main and then identify the next available passing siding that is (1) empty, and (2) long enough for it's cars. Then, the Shay would allow other trains to pass, even if the operator had not told the robot to stop periodically. The other improvement is to have the robot wait until all the jammed up trains pass before going back on the main. Currently, it only allows a fixed number of trains to pass before pulling out.

Dan spent about four hours running trains that day. At one point we had 7 trains all running at the same time. There were no mishaps. It was a fun day.

2 comments:

Steeeeve said...

Hi Bob,

I'd be interested in knowing if in manual mode the trains can override the collision avoidance controls you have.

Also, I'd like to know how you created the map of the layout (if drawn automatically).

Great blog, without a doubt my favorite G scale blog.

Also, why not create a product that will do all of this?

JC said...

The collision avoidance control sounds like a great tool.
JC