-
Notifications
You must be signed in to change notification settings - Fork 74
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
Modification of observations/actor states #24
Comments
Hi @Neel1302 , Cool! This should be doable by creating a new environment that provides the positions as the observation space instead of the images. Because the MACAD-Gym was started as a platform for Deep RL, the image observation spaces were the main focus but the support for lower dimensional observations like positions exists. The macad-gym/src/macad_gym/core/vehicle_manager.py Lines 275 to 294 in c344414
Creating a new Gym-compatible RL environment using MACAD-Gym should be as easy as generating a JSON/Dict config. For example, the |
Thanks @praveen-palanisamy! I see, I created a new environment (changed the SUI and modified actors) based on the wiki. I also disabled discrete_actions as I mainly want to work with pedestrian agents (Homogeneous). I will continue to work on changing the observation space to include the measurements I need. I would appreciate if you could leave this thread open for a bit for follow ups as I will be working on this (daily) for about a week. Thanks, |
Sounds good! |
Thanks! Just listing two quick and minor typos in the readme that I spotted: In the Getting Started section, Option 2 for developers: Create a new conda env named "macad-gym" and install the required packages: conda env create -f conda_env.y Activate the macad-gym conda python env: source activate Also one quick question I had: after the example code runs (i.e. all episodes are done), I am getting a segmentation fault (core dumped). Did you observe this as well? |
Thanks for spotting and sharing the typos! I have fixed one Ah! Thank you for reporting. I missed adding the |
The other typo was in: conda env create -f conda_env.yaml. This should be: conda env create -f conda_env.yml. I think the strikethrough on the "a" in my previous comment wasn't quite noticeable due to it being on only one letter. Since conda expects a .yml file to create a new environment, it threw an error when I pasted the command with .yaml. And alas, adding Thanks, |
Oh I see it now! Yeah, the strike-through on the letter "a" seems camouflaged :). Conda should work fine with an environment file with the extension Cool. |
Oh I see, makes sense. One other quick correction in: macad-gym/src/macad_gym/core/sensors/derived_sensors.py Lines 137 to 138 in 51da765
Should be:
I checked this and it seems like the actor type from the collision sensor event (i.e. event.other_actor) for pedestrians yields 'Walker' rather than 'Pedestrian'. After I made this change (and set early_terminate_on_collision to True), the episode would terminate upon collision with other pedestrians which can help cut down training time. |
Good catch! Yes. The Actor class name should be |
Hey @Neel1302 , Were you able to create the environment with custom observation space (position, velocity) for your needs? |
Yes, indeed! Thanks for your help throughout this process. To use the custom observation space I created a function that replaces the function: macad-gym/src/macad_gym/carla/multi_env.py Lines 864 to 868 in 38884ac
macad-gym/src/macad_gym/carla/multi_env.py Lines 1169 to 1174 in 38884ac
with:
The function returns returns into I was able to then import these in my training file to train a custom agent. Although, this training has not concluded, I think using I am closing this issue, and can post a link to my fork if someone else needs these measurements as observations rather than images or feel free to include this function as an addition if you think it would help others. Thanks again @praveen-palanisamy, |
That's nice! Glad to hear that you created the custom environment you needed. Feel free to submit a PR. Ideally, the observation type (images or measurements only or both) should be made a configuration parameter so that creating such a custom environment requires only a configuration file change. Good luck for your work and feel free to reach out. |
Hi @praveen-palanisamy,
Now that I have macad-gym setup, I am planning to setup an environment with states being global position (x,y) of the actors (cars or pedestrians) and their velocities (I think carla doesn't provide actor velocity, but I can use a time window in the past to estimate velocity): in a practical setting, this can be for instance coming from on-board GPS.
I understand you used the image itself as the state/observation, thus, do you have any recommendations regarding how to modify the observation space? (potential enhancement feature)
Thanks,
Neel
The text was updated successfully, but these errors were encountered: