Getting the stop point of a station for the ATS Plugin
3 posters
Page 1 of 1
Getting the stop point of a station for the ATS Plugin
I'm trying to develop an ATS Plugin that adapts stop point check function, but I found the OpenBVEApi.Station.DefaultTrackPosition refers to the "sta begin" event, causing the ATO in my plugin stops the train hundreds of miles before the correct position. I searched in the source code and found the PluginManager doesn't provide them to the Plugin. Is there any way to get the stop position of the station for the plugin? I mean, I really don't want to put beacons because it will cause the train only work on specific routes.
By the way, how to acquire whether the ATC is equipped?
By the way, how to acquire whether the ATC is equipped?
Re: Getting the stop point of a station for the ATS Plugin
I'm developing a route and trains with ATO too and as far as I know, it's impossible to get the exact stop position without beacons. While a set of "standard" ATO beacons could be great in OpenBVE, the truth is that real-life ATO systems are very rarely cross-compatible and each requires specific configuration.
There are two special beacons in OpenBVE, however, to automatically pass information about route ATC to plugins. They are universal and implicit (you don't need to add them to the route):
Beacon -16777215: If the optional data is 0, the track is not ATC-ready. If 1, ATC is available and the train must switch to ATC. If 2, the track is ATC-equipped. If 3, ATC is available and the train must switch to ATS.
Beacon -16777214: The optional data contains the current speed limit (beacon.Optional & 4095) and its track position (beacon.Optional >> 12).
OdakyufanAts uses both of them, so you can check the source to get more details about how to read all this data from a plugin. I think it should be documented in OpenBVE too, as this is part of the simulator but is not specified anywhere.
There are two special beacons in OpenBVE, however, to automatically pass information about route ATC to plugins. They are universal and implicit (you don't need to add them to the route):
Beacon -16777215: If the optional data is 0, the track is not ATC-ready. If 1, ATC is available and the train must switch to ATC. If 2, the track is ATC-equipped. If 3, ATC is available and the train must switch to ATS.
Beacon -16777214: The optional data contains the current speed limit (beacon.Optional & 4095) and its track position (beacon.Optional >> 12).
OdakyufanAts uses both of them, so you can check the source to get more details about how to read all this data from a plugin. I think it should be documented in OpenBVE too, as this is part of the simulator but is not specified anywhere.
Marc Riera- Posts : 28
Join date : 2015-12-21
Location : Barcelona, Spain
Re: Getting the stop point of a station for the ATS Plugin
Try today's build 
This adds the following to the API:
This describes the track location of the stop position applicable to the train, and requires no beacons.
Note:
This is not backwards compatible, but it's universal, which I think is as good as you're going to get
Assuming this works OK for you, I'll push a stable build (probably the end of next week now)

This adds the following to the API:
- Code:
OpenBveApi.Station.StopPosition
This describes the track location of the stop position applicable to the train, and requires no beacons.
Note:
This is not backwards compatible, but it's universal, which I think is as good as you're going to get

Assuming this works OK for you, I'll push a stable build (probably the end of next week now)
Re: Getting the stop point of a station for the ATS Plugin
Marc Riera wrote:Beacon -16777215: If the optional data is 0, the track is not ATC-ready. If 1, ATC is available and the train must switch to ATC. If 2, the track is ATC-equipped. If 3, ATC is available and the train must switch to ATS.
Beacon -16777214: The optional data contains the current speed limit (beacon.Optional & 4095) and its track position (beacon.Optional >> 12).
Odakyufan wrote the ATC implementation for openBVE (and for that matter, IIRC OdakyufanATS is actually a much newer version of the default ATC / ATS plugin)
I have absolutely no documentation on why these numbers are used, other than possibly just to not conflict with anything else. (16777215 is actually 256 * 256 * 256, so possibly the largest possible beacon number that could have been used, but that's just a guess....)
Looking at Mackoy's plugin headers, ATC / ATS switching don't appear to be members/ supported, and so I'd guess that these were only supported with the 'default' BVE2 / 4 safety systems implementation, which the included plugin clones.
Re: Getting the stop point of a station for the ATS Plugin
Thank you! I'll start working again. By the way, why don't you give the plugin the right to read the in-game data, rather than wrapped data?leezer3 wrote:Try today's build
This adds the following to the API:
- Code:
OpenBveApi.Station.StopPosition
This describes the track location of the stop position applicable to the train, and requires no beacons.
Note:
This is not backwards compatible, but it's universal, which I think is as good as you're going to get
Assuming this works OK for you, I'll push a stable build (probably the end of next week now)
Re: Getting the stop point of a station for the ATS Plugin
They are in OldCode/TrackManager.cs, line 517 "internal static class SpecialTransponderTypes".leezer3 wrote:Marc Riera wrote:Beacon -16777215: If the optional data is 0, the track is not ATC-ready. If 1, ATC is available and the train must switch to ATC. If 2, the track is ATC-equipped. If 3, ATC is available and the train must switch to ATS.
Beacon -16777214: The optional data contains the current speed limit (beacon.Optional & 4095) and its track position (beacon.Optional >> 12).
Odakyufan wrote the ATC implementation for openBVE (and for that matter, IIRC OdakyufanATS is actually a much newer version of the default ATC / ATS plugin)
I have absolutely no documentation on why these numbers are used, other than possibly just to not conflict with anything else. (16777215 is actually 256 * 256 * 256, so possibly the largest possible beacon number that could have been used, but that's just a guess....)
Looking at Mackoy's plugin headers, ATC / ATS switching don't appear to be members/ supported, and so I'd guess that these were only supported with the 'default' BVE2 / 4 safety systems implementation, which the included plugin clones.
Also, they're used by the built-in ATC system in the game.
Re: Getting the stop point of a station for the ATS Plugin
I know it. Actually according to the code there are five special beacons.Marc Riera wrote:I'm developing a route and trains with ATO too and as far as I know, it's impossible to get the exact stop position without beacons. While a set of "standard" ATO beacons could be great in OpenBVE, the truth is that real-life ATO systems are very rarely cross-compatible and each requires specific configuration.
There are two special beacons in OpenBVE, however, to automatically pass information about route ATC to plugins. They are universal and implicit (you don't need to add them to the route):
Beacon -16777215: If the optional data is 0, the track is not ATC-ready. If 1, ATC is available and the train must switch to ATC. If 2, the track is ATC-equipped. If 3, ATC is available and the train must switch to ATS.
Beacon -16777214: The optional data contains the current speed limit (beacon.Optional & 4095) and its track position (beacon.Optional >> 12).
OdakyufanAts uses both of them, so you can check the source to get more details about how to read all this data from a plugin. I think it should be documented in OpenBVE too, as this is part of the simulator but is not specified anywhere.
/// | |
internal const int AtcTrackStatus = -16777215; | |
/// | |
internal const int AtcSpeedLimit = -16777214; | |
/// | |
internal const int AtsPTemporarySpeedLimit = -16777213; | |
/// | |
internal const int AtsPPermanentSpeedLimit = -16777212; | |
/// | |
internal const int InternalAtsPTemporarySpeedLimit = -16777201; | |
} |
Re: Getting the stop point of a station for the ATS Plugin
zbx1425 wrote:Thank you! I'll start working again. By the way, why don't you give the plugin the right to read the in-game data, rather than wrapped data?leezer3 wrote:Try today's build
This adds the following to the API:
- Code:
OpenBveApi.Station.StopPosition
This describes the track location of the stop position applicable to the train, and requires no beacons.
Note:
This is not backwards compatible, but it's universal, which I think is as good as you're going to get
Assuming this works OK for you, I'll push a stable build (probably the end of next week now)
The internals of the game are in many places an absolute confusing jumble

The second reason is because it's somewhat complicated to do that easily.
Michelle's basic train plugin design is essentially a cloned version of Mackoy's original plugin interface, and it's dug rather closely into the internal workings of the sim itself, which is not designed to have modification of any of it's data externally.
Add to that the fact that most of the existing code has a lot of dangerous assumptions in place, and it's not going to happen any time soon

Re: Getting the stop point of a station for the ATS Plugin
leezer3 wrote:Try today's build
This adds the following to the API:
- Code:
OpenBveApi.Station.StopPosition
This describes the track location of the stop position applicable to the train, and requires no beacons.
Note:
This is not backwards compatible, but it's universal, which I think is as good as you're going to get
Assuming this works OK for you, I'll push a stable build (probably the end of next week now)
We have stastart before, and stastop now, why don't you add staend by the way?
Re: Getting the stop point of a station for the ATS Plugin
zbx1425 wrote:leezer3 wrote:Try today's build
This adds the following to the API:
- Code:
OpenBveApi.Station.StopPosition
This describes the track location of the stop position applicable to the train, and requires no beacons.
Note:
This is not backwards compatible, but it's universal, which I think is as good as you're going to get
Assuming this works OK for you, I'll push a stable build (probably the end of next week now)
We have stastart before, and stastop now, why don't you add staend by the way?
Should probably be able to add that, but it's a slightly more complex problem than the last-
Conceptually, it's not (so) clear as to whether the reported end of the station should be that defined by the last .Stop command (whether applicable to your train or not), or simply the acceptable outside bounds of the last acceptable stop point including tolerances.
Re: Getting the stop point of a station for the ATS Plugin
I mean the position of the "Station End" event.leezer3 wrote:zbx1425 wrote:leezer3 wrote:Try today's build
This adds the following to the API:
- Code:
OpenBveApi.Station.StopPosition
This describes the track location of the stop position applicable to the train, and requires no beacons.
Note:
This is not backwards compatible, but it's universal, which I think is as good as you're going to get
Assuming this works OK for you, I'll push a stable build (probably the end of next week now)
We have stastart before, and stastop now, why don't you add staend by the way?
Should probably be able to add that, but it's a slightly more complex problem than the last-
Conceptually, it's not (so) clear as to whether the reported end of the station should be that defined by the last .Stop command (whether applicable to your train or not), or simply the acceptable outside bounds of the last acceptable stop point including tolerances.

» Stop!!!
» any way to only allow doors to open if its an accurate stop
» Even though the AI train hasn't stop completely, the AI train is open the doors.
» How do I know when approaching a station?
» Station name game!
» any way to only allow doors to open if its an accurate stop
» Even though the AI train hasn't stop completely, the AI train is open the doors.
» How do I know when approaching a station?
» Station name game!
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|