PKU-Alignment / omnisafe

OmniSafe is an infrastructural framework for accelerating SafeRL research.
https://www.omnisafe.ai
Apache License 2.0
901 stars 129 forks source link

Customizing my environment #273

Closed Royalvice closed 11 months ago

Royalvice commented 1 year ago

Required prerequisites

Questions

Thank you very much for your contribution to this valuable repository.

I would like to quickly utilize the efficient safe-rl algorithm implemented in this repository in my own environment. Specifically, I have created a custom Unmanned Aerial Vehicle communication environment from scratch, including custom state and action spaces, as well as a custom reward function. I would like to quickly convert my custom environment into the API format accepted by this repository, but I haven't found many tutorials on creating custom environments. Could you please advise me on how to proceed? Could you recommend any resources for me to refer to?

Once again, thank you for your efforts, and I look forward to your response. Thank you!

Gaiejj commented 1 year ago

Thank you very much for your recognition of our work. OmniSafe currently supports custom environment. Specifically:

However, if you still have questions about the customization of OmniSafe's environment after reading the above information, or if you encounter unexpected errors during the process, please feel free to provide more detailed information so that we can better assist you in resolving your issues.

Royalvice commented 1 year ago

Thank you again. I currently have no more questions.

Royalvice commented 1 year ago

Thank you very much for your recognition of our work. OmniSafe currently supports custom environment. Specifically:

However, if you still have questions about the customization of OmniSafe's environment after reading the above information, or if you encounter unexpected errors during the process, please feel free to provide more detailed information so that we can better assist you in resolving your issues.

How should I proceed if the action space of the environment I want to design is discrete, but Omnisafe only accepts continuous action spaces of the Box class?

Gaiejj commented 1 year ago

Currently, OmniSafe does not support discrete action space environments. We would support it in the future version since the discrete environment also matters a lot in the SafeRL area.

Royalvice commented 1 year ago

Currently OmniSafe does not support discrete action space environment. We would support it in future version since discrete environment also matters a lot in SafeRL area. We feel sorry that OmniSafe do not meet your requirement currently.

I would like to quickly run the safe-rl algorithm in my personal environment. Is it feasible to discretize the actions directly in the 'step' function?

Royalvice commented 1 year ago

I look forward to your prompt reply.

zmsn-2077 commented 1 year ago

If you directly discretize actions within the step function, you need to consider whether the current algorithm supports discrete inputs. Currently, the algorithms we have implemented cannot handle discrete action inputs directly. This is mainly because most of the algorithm's original authors did not specify the algorithm's performance in a discrete environment. Supporting discrete action inputs is on our roadmap, but it will be implemented in future versions.

If this feature is crucial for you, we would greatly appreciate your leadership in adding this feature to Omnisafe, and we would also welcome your participation in the development of this feature.

According to our original roadmap, we will have this feature updated by early October.

Royalvice commented 1 year ago

Thank you for your response. As you mentioned, discretizing the actions predicted by the actor and inputting them directly to the environment did not yield satisfactory results. This feature is indeed important to me, but as a newcomer to RL, I will do my best to contribute to Omnisafe if possible. Thank you again.

Gaiejj commented 11 months ago

Feel free to open if you have further issue.