TeamOpenIndustry / ImmersiveRailroading

GNU Lesser General Public License v2.1
226 stars 72 forks source link

Improvements to integration with openComputers #719

Closed leptun closed 4 years ago

leptun commented 4 years ago

Describe the suggestion
As of now, the only useful methods of the ir_remote_control are setThrottle(), setBrake() and maybe also horn(). These are working well enough, there is a really important piece missing: getSpeed(). As of now, you have to continuously poll getPos() and do some math on it to identify the deltaDistance in that time frame, aka the speed. It would be much better if the api would allow reporting back the speed. The precision is not really that important (aka 1 decimal is enough), but being able to get whether the train is moving forwards and not backwards is a must as that is impossible with my getPos() implementation. Another useful API method is detecting wheelSlip. Link: https://discord.gg/CS2RTGq

Applications of the suggestion
Both of these methods are really useful if you are building an automated train system. I'm trying to build a replica of my city's subway system and have automated trains running the lines. I'm still working on the Signaling/Junction side of the openComputers program, but it looks really promising. I was thinking of running each train on a separate computer/server with the API card and have them in a controlled environment where I always know an approximate position of the train on the network. I also intend to run PID loops for the speed control and here is where the getSpeed() command would be great. As for the wheelSlip, being able to detect when this happens is just a bonus, maybe the computer can compensate the throttle if it detects slipping.

Btw, is there any eta on #717 ?

leptun commented 4 years ago

Looking through the code, I think that if ir_augment_detector's functions were available to ir_remote_control then all issues would be gone. It has both traction and speed. Do you think it would be possible having this at the very least as a config option?

cam72cam commented 4 years ago

Yeah, I'll add it to the backlist. I originally wanted them to be distinct, but seeing how people use them shows that the exclusive nature is not the best design