Skip to content

Commit

Permalink
Merge pull request #130 from YilingQiao/main
Browse files Browse the repository at this point in the history
add pre-commit hook for black
  • Loading branch information
YilingQiao authored Dec 20, 2024
2 parents dd7154a + 5eeb010 commit be62afe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
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

0 comments on commit be62afe

Please sign in to comment.