Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there any way to change the position of idle vehicles? #9

Open
Xiaobing-Shen opened this issue Nov 23, 2020 · 4 comments
Open

Is there any way to change the position of idle vehicles? #9

Xiaobing-Shen opened this issue Nov 23, 2020 · 4 comments

Comments

@Xiaobing-Shen
Copy link

It seems we have to give the information about stations where idle vehicles can stop at. (Fleet.infleet_from_geojson), can I modify this limitation? I mean, I want vechicles stop at the positions when they finish one route and wait for new command.

Actually, I want to rebalance the idle vehicles and want to know how to do this.

@Xiaobing-Shen
Copy link
Author

One more question, I just found that vehicle can be in the state "is_moving_to"
image
But I cannot find the definition of such state. It seems self.is_moving_to is always none?????

@sash-ko
Copy link
Owner

sash-ko commented Dec 2, 2020

@icyshenfighting Sorry for the delayed response. Regarding vehicle states, there are 3 states "offline", "idling" and "moving_to". You can check if the vehicle is one of those states by calling is_moving_to or is_offline or is_idling. These methods are autogenerated by state machine (one of the features of transition framework)

@sash-ko
Copy link
Owner

sash-ko commented Dec 2, 2020

Fleet.infleet_from_geojson is just one of the ways to create a simulation scenario. It just reads a GeoJSON file with points (stations) and randomly selects one of the stations for each new vehicle. But it does not restrict vehicles from moving only between the stations (it can be implemented with routers). In general, you can create new vehicles at any position you need.

@sash-ko
Copy link
Owner

sash-ko commented Dec 2, 2020

For rebalancing, you first check if a vehicle in state "idling" (vehicle.is_idling()). If yes, you create a simple itinerary:

if vehicle.is_idling():
    itinerary = Itinerary(clock.now, vehicle)
    itinerary.move_to(some_random_location)
    dispatcher.dispatch(itinerary)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants