Elvas Tower: Autonommous Driving and Synchronized Simulation in OR - Elvas Tower

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Autonommous Driving and Synchronized Simulation in OR Discussing feasability and pathways to implement a machine interface Rate Topic: -----

#1 User is offline   traincarl 

  • Apprentice
  • Group: Status: New Hire
  • Posts: 1
  • Joined: 14-November 23
  • Gender:Male
  • Simulator:OpenRails
  • Country:

Posted 14 November 2023 - 06:07 AM

Hi!

I feel like this topic would be better suited in the "Developing" forum, but since I can not post there, I will write it here and trust the moderators to move it if deemed appropriate.

For a university project, I would like to extend OpenRails to support an autonomous driving function "pushing the buttons" instead of a human player. The idea is to build something that is similar to CARLA (https://carla.org/), which allows testing autonomous driving functions for cars by plugging them into a simulation using a standardized API. Especially, the simulation should be synchronuous, i.e the driving function should be able to give a new control signal after each simulation step. Sadly, tools that provide this functionality are quite common in the car industry, but not so much in rail. I have some ideas on how to achieve this and hope to find someone here who can confirm or correct my approach (or tell me that I am on the completely wrong path, for that matter ;) ).

These are the basic requirements:

1. Implement an interface which allows to control the player train via network, e.g. via ROS
2. The driving function controlling the player train must be able to give a new input before each simulation step,
3. The driving function controlling the player train must be able to gain machine-readable output about the simulation state after each simulation step
4. (Optional) Multiple trains can be controlled through that interface at the same time (All trains receive control signals on each time step)

After reviewing the code, it seems to me that simply using the multiplayer interface and having my driving functions communicate as clients over the network is not feasible, as each client conducts its own simulation asynchronuously to the others and gets updated eventually, therefore not fulfilling the requirement of synchronuous simulation. (First question: Is that correct?)

My approach is therefore as follows: As far as I understand, before each simulation step (UpdaterProcess::StartUpdate), the user input from Mouse and Keyboard is collected and used as input for that step (UserInput::Update). I want to replace the UserInput via Mouse and Keyboard by a different input method, e.g. a system where some communication over network is received. This input method would be blocking until all input was received, so that the simulation is synchronuous to the input. After each simulation step, information about the new simulation state would have to be sent out. I also want to send out the rendered image as my driving function may need it to determine its next control action. Currently, the next simulation step is calculated while the current one is still rendering to save time. I want to remove that parallel processing in order to achieve synchronuous output.

As for controlling multiple trains, my basic idea is to switch the train that is currently controlled by the player (my driving function) multiple times during the user input gathering so that all trains are controlled at the same time step, but this is not something I have put much thought into as of yet.

If there is someone who can tell me if I am on the right track or who would like to give me any pointers, I would appreciate it very much.

Best regards
Carl

#2 User is offline   joe_star 

  • Fireman
  • Group: Status: Active Member
  • Posts: 209
  • Joined: 16-January 13
  • Gender:Male
  • Simulator:MSTS
  • Country:

Posted 06 December 2023 - 11:30 PM

Hello

This thread might be of interest to you

https://www.elvastow...er/page__st__20

I have not delved into it, but I believe the Webserver can Support direct control inputs (not sure if this is already merged into the master code)

In the past, I used a combination of autoit and Webserver read to implement a joystick interface for OR. It worked as follows-

a. The autoit script reads the joystick axis position
b. The autoit script (via Webserver) reads the current control states
C. The autoit script sends sufficient keystrokes to match the control state with the joystick axis position

This worked pretty well for my purposes, but with Webserver write functionality this should be much simpler to implement now

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users