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

[Contribution] New Scenario - Road Traffic #98

Closed
Jianye-Xu opened this issue May 24, 2024 · 5 comments
Closed

[Contribution] New Scenario - Road Traffic #98

Jianye-Xu opened this issue May 24, 2024 · 5 comments

Comments

@Jianye-Xu
Copy link
Contributor

I have developed a road-traffic scenario based on VMAS and is published in my GitHub repository to support my preprint. Would you want this scenario included in your repository?

Note that my scenario utilizes some utility functions and an HD map. Incorporating this scenario would require including these utility functions and the HD map data. Please let me know if I should prepare and open a PR. It will include around ~2k lines of code and an XML file for the HD map with ~10k lines.

This is an visualization of my scenario:
generalizable-MARL

@matteobettini
Copy link
Member

Hello!

Thanks for reaching out! Amazing work! the sceanrio looks extremetly interesting and I would be very happy to review a PR to add it to vmas.

Regarding the code, it is not a problem if your scenario requires further optional dependendices as long as you can document this in the scenario file.

The process for having a new scenario is to add a file called scenario_name.py in the scenarios folder.
Do you think you can fit your utility functions in this file?

Regarding the map, how we choose to make this available depends on the size, what is the size of the map file? If its size is negligelable we can think of hosting it in a new scenario_data folder in the repo.

@Jianye-Xu
Copy link
Contributor Author

Hello,

Thanks!

Sure, I will put all the utility functions in this scenario file.

The map size is just 300KB. Should I put it in the new folder you suggested? If yes, which path should I use? For example, I could create this folder at:
VectorizedMultiAgentSimulator/vmas/scenarios/scenario_data/.
How should I name the map file? For example, would you prefer road_traffic.xml or road_traffic_cpm_lab.xml? "CPM Lab" is our lab name, and the map data matches the physical map of our lab. I may probably name the scenario road_traffic.py. Let me know if you have better suggestions :)

Regarding the scenario, I think there are two options. Let me know which one you prefer.

  1. I create a minimal version of the scenario, meaning that all irrelevant parts (i.e., parts that serve for training) will be simplified/removed. The reason this scenario has more than 1k lines of code is mainly because I need them to suit my training process (I use MAPPO as the training algorithm).
  2. I keep the current version, which features a comprehensive observation function (bird's-eye view and top-down view, sampling of nearing lane boundaries, sampling of long-term reference paths, distance to lane center line, distance to left and right boundaries, distance to other agents, etc.) and a comprehensive reward function (collision detection and collision penalty, too-close-to-other-agents penalty, too-close-to-lane-boundaries penalty, etc.).

@matteobettini
Copy link
Member

matteobettini commented May 26, 2024

The map size is just 300KB. Should I put it in the new folder you suggested? If yes, which path should I use? For example, I could create this folder at:
VectorizedMultiAgentSimulator/vmas/scenarios/scenario_data/.
How should I name the map file? For example, would you prefer road_traffic.xml or road_traffic_cpm_lab.xml? "CPM Lab" is our lab name, and the map data matches the physical map of our lab. I may probably name the scenario road_traffic.py. Let me know if you have better suggestions :)

I would create a folder VectorizedMultiAgentSimulator/vmas/scenarios_data/ and create a further folder for your scenario VectorizedMultiAgentSimulator/vmas/scenarios_data/road_traffic. Then in this folder you can place the map. My preferred name would be road_traffic_cpm_lab.xml

For the observation and reward functions I would go with the most complete possible (the ones that mostly match your paper). The observation function should only contain data that is fed to an actor (i.e., data about the ego agent or eventually some neighbours). This is the data that is fed to the policy.

If you have global data that is fed to a centralized critic (like in MAPPO for example), you could have this in a new function def state() which would return global info (such as a birds eye view for example). This would be the info to feed to the MAPPO critic.

I could then find a way for vmas to return global states from the step function. Maybe they could be returned as part of info

The general idea is for this scenario to be a useful MARL challenge that other users can benchmark their solution on.

@Jianye-Xu
Copy link
Contributor Author

Jianye-Xu commented May 29, 2024

Thanks for the suggestions and the information.

If you have global data that is fed to a centralized critic (like in MAPPO for example), you could have this in a new function def state() which would return global info (such as a birds eye view for example). This would be the info to feed to the MAPPO critic.

In my case, I do not fed any global data to the centralized critic. The critic simply concatenates the observations of all agents as inputs.

The general idea is for this scenario to be a useful MARL challenge that other users can benchmark their solution on.

I think this idea is great!

I created a PR in #99 just now. Let me know there if you have any comments.

@matteobettini
Copy link
Member

matteobettini commented Jul 10, 2024

Added in #99

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