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

Add use_fire_reset option in atari env #223

Merged
merged 1 commit into from
Nov 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/env/atari.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ Options
result);
* ``use_inter_area_resize (bool)``: whether to use ``cv::INTER_AREA`` for
image resize, default to ``True``.
* ``use_fire_reset (bool)``: whether to use ``fire-reset`` wrapper, default to
``True``.


Observation Space
-----------------
Expand Down
14 changes: 9 additions & 5 deletions envpool/atari/atari_env.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ class AtariEnvFns {
return MakeDict(
"stack_num"_.Bind(4), "frame_skip"_.Bind(4), "noop_max"_.Bind(30),
"zero_discount_on_life_loss"_.Bind(false), "episodic_life"_.Bind(false),
"reward_clip"_.Bind(false), "img_height"_.Bind(84),
"img_width"_.Bind(84), "task"_.Bind(std::string("pong")),
"reward_clip"_.Bind(false), "use_fire_reset"_.Bind(true),
"img_height"_.Bind(84), "img_width"_.Bind(84),
"task"_.Bind(std::string("pong")),
"repeat_action_probability"_.Bind(0.0f),
"use_inter_area_resize"_.Bind(true), "gray_scale"_.Bind(true));
}
Expand Down Expand Up @@ -126,9 +127,12 @@ class AtariEnv : public Env<AtariEnvSpec> {
env_->setInt("random_seed", seed_);
env_->loadROM(rom_path_);
action_set_ = env_->getMinimalActionSet();
for (auto a : action_set_) {
if (a == 1) {
fire_reset_ = true;
if (spec.config["use_fire_reset"_]) {
// https://github.com/sail-sg/envpool/issues/221
for (auto a : action_set_) {
if (a == 1) {
fire_reset_ = true;
}
}
}
// init buf
Expand Down