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 pre-commit hook for black #130

Merged
merged 1 commit into from
Dec 20, 2024
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
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
repos:
- repo: https://github.com/psf/black
rev: 23.9.1 # Use the latest version or specify the version you prefer
hooks:
- id: black
args: ["--config=pyproject.toml"]
13 changes: 7 additions & 6 deletions examples/locomotion/go2_backflip.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ def get_cfgs():
"dof_vel": 0.05,
},
}
reward_cfg = {"reward_scales": {},}
reward_cfg = {
"reward_scales": {},
}
command_cfg = {
"num_commands": 3,
"lin_vel_x_range": [0, 0],
Expand All @@ -76,16 +78,14 @@ def get_cfgs():


class BackflipEnv(Go2Env):

def get_observations(self):

phase = torch.pi * self.episode_length_buf[:, None] / self.max_episode_length
self.obs_buf = torch.cat(
[
self.base_ang_vel * self.obs_scales['ang_vel'], # 3
self.base_ang_vel * self.obs_scales["ang_vel"], # 3
self.projected_gravity, # 3
(self.dof_pos - self.default_dof_pos) * self.obs_scales['dof_pos'], # 12
self.dof_vel * self.obs_scales['dof_vel'], # 12
(self.dof_pos - self.default_dof_pos) * self.obs_scales["dof_pos"], # 12
self.dof_vel * self.obs_scales["dof_vel"], # 12
self.actions, # 12
self.last_actions, # 12
torch.sin(phase),
Expand All @@ -105,6 +105,7 @@ def step(self, actions):
self.get_observations()
return self.obs_buf, None, self.rew_buf, self.reset_buf, self.extras


def main():
parser = argparse.ArgumentParser()
parser.add_argument("-e", "--exp_name", type=str, default="single")
Expand Down