uniba-swt / libbidib

A library for communication with a BiDiB (www.bidib.org) system using a serial connection.
GNU General Public License v3.0
10 stars 4 forks source link

Question about orientation vs direction #9

Open timvanoostrom opened 2 years ago

timvanoostrom commented 2 years ago

Hello, I was looking at this commit https://github.com/uniba-swt/libbidib/commit/d2ed8ca3670a01cbba6de850f4812c9ad03cf4c0#diff-50d858e0985ecc7f60418aaf0cc5ab587f42c2570a884095a9e8ccacd0f6545c and was wondering, what is the reason this was renamed? A loco is more likely to be recognized and addressed by it's driving direction than it's left/right orientation.

eyip002 commented 2 years ago

Hi @timvanoostrom, good question. You are right, the BiDiB protocol for MSG_CS_DRIVE messages says that it should be direction with forward and reverse as the possible values.

When we were developing an automatic train driving algorithm, the notion of a train being "forward" or "reverse" seemed ambiguous because it depends on the polarity of the track rails and on the orientation of the train. For example, if the train is "forward", would the train drive forwards to the left or to the right? This was the rationale behind using left and right.

However, now that we've had more experience with our model railway (track plan), we can define forward as the anti-clockwise direction and reverse as the clockwise direction without ambiguity. I will probably revert the name change at some point in the future!

timvanoostrom commented 2 years ago

Or to avoid ambiguity (a bit), THAT_WAY or THE_OTHER_WAY. Though humans controlling the trains will probably want to use terms like forward, back, reverse, left, right for comprehension and real-world orientation. I think that some loco decoders can broadcast their own direction as source of truth.

eyip002 commented 2 years ago

Forward, backward, and reverse aren't always suitable when a train has gone through a reversing loop. In the image below, the train begins in the forward direction, but exits in the reverse direction which can be confusing because the train is physically going "forward". Note that the track polarity gets swapped as the train drives through the reversing loop:

image

Left and right aren't always suitable when people do not realise that a collection of tracks are on opposite sides of a loop:

image

I don't know whether there is a suitable solution to this problem 😄

timvanoostrom commented 2 years ago

Indeed.