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

Merge for P2 #101

Merged
merged 27 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
d2bda52
first version with hfield in observation space; hfield randomization …
P-Schumacher Sep 28, 2023
252defc
randomization of patches works; partial heightmap seems to work; need…
P-Schumacher Oct 1, 2023
b5ee57f
initial state works; maximum of 2 hilly patches works; TODO rangefind…
P-Schumacher Oct 2, 2023
6199cf4
chasing opponent works, still need to correclty update scores; TODO r…
P-Schumacher Oct 2, 2023
a72f54a
reduced heightmap viewing distance for testing
P-Schumacher Oct 2, 2023
9456921
point-based observation heightmap should work
P-Schumacher Oct 2, 2023
f4c6983
added relief patch; tasks are now computed in get_score, get_win_cond…
P-Schumacher Oct 3, 2023
b9bd992
added relocate P2; still uses mujoco 2.3.6 mjb file and cannot be pla…
P-Schumacher Oct 3, 2023
78411d3
added mjb for relocate p2
P-Schumacher Oct 3, 2023
0595902
added new mjb files
P-Schumacher Oct 3, 2023
02fe936
updated to newest relocate version
P-Schumacher Oct 4, 2023
ac4b286
update init and mjb for relocate
P-Schumacher Oct 4, 2023
acc5f1e
fixed heightmap
P-Schumacher Oct 4, 2023
716e951
phases work with separate mjbs now
P-Schumacher Oct 4, 2023
46e2871
randomization ranges; working now with 1 mjb;
P-Schumacher Oct 4, 2023
8f75933
Added new registration for relocateP2eval
elladyr Oct 5, 2023
27f1ebf
Added rng to opponent vel during chase
elladyr Oct 5, 2023
65352f9
Capped opp linear vel to 2
elladyr Oct 5, 2023
4d1c139
Fixed score
elladyr Oct 5, 2023
c325c74
Updated chasetag
elladyr Oct 5, 2023
0949ff6
merge
elladyr Oct 5, 2023
c171df9
Corrected merged files
elladyr Oct 5, 2023
596b682
Removed backup files
elladyr Oct 5, 2023
a580f94
Clean up init file
elladyr Oct 5, 2023
e2b9c58
Clean up
elladyr Oct 5, 2023
b855a7f
Cleaned Init
elladyr Oct 5, 2023
cdcf556
Cleaned spaces
elladyr Oct 6, 2023
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
1 change: 0 additions & 1 deletion myosuite/envs/myo/myochallenge/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
}
)


# MyoChallenge Locomotion P2
register(id='myoChallengeChaseTagP2-v0',
entry_point='myosuite.envs.myo.myochallenge.chasetag_v0:ChaseTagEnvV0',
Expand Down
7 changes: 4 additions & 3 deletions myosuite/envs/myo/myochallenge/chasetag_v0.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def move_opponent(self, vel: list):
self.opponent_vel = vel
assert len(vel) == 2
vel[0] = np.abs(vel[0])
vel = np.clip(vel, -2, 2)
vel = np.clip(vel, -5, 5)
pose = self.get_opponent_pose()
x_vel = vel[0] * np.cos(pose[-1]+0.5*np.pi)
y_vel = vel[0] * np.sin(pose[-1] +0.5*np.pi)
Expand Down Expand Up @@ -156,7 +156,7 @@ def chase_player(self):
new_vec = np.array([np.cos(theta), np.sin(theta)])
new_vec2 = pel - vec
vel = np.dot(new_vec, new_vec2)
return np.array([1.0, vel])
return np.array([self.rng.uniform(1, 5), vel])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elladyr is this wanted here?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to set vel per reset, not sample it everytime in this function

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me correct that too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sample chaser velocities corrected.



class HeightField:
Expand Down Expand Up @@ -387,6 +387,7 @@ def _setup(self,
**kwargs,
):


self._setup_convenience_vars()
# check that this works everywhere and is efficient.
self.heightfield = HeightField(sim=self.sim,
Expand Down Expand Up @@ -459,7 +460,7 @@ def get_reward_dict(self, obs_dict):
score = self._get_score(float(self.obs_dict['time'])) if win_cdt else 0
self.obs_dict['time'] = self.maxTime if lose_cdt else self.obs_dict['time']
elif self.current_task == 'evade':
score = self._get_score(float(self.obs_dict['time']))
score = self._get_score(float(self.obs_dict['time'])) if (win_cdt or lose_cdt) else 0
# ----------------------

# Example reward, you should change this!
Expand Down
1 change: 1 addition & 0 deletions myosuite/envs/myo/myochallenge/relocate_v0.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ def get_reward_dict(self, obs_dict):
return rwd_dict



def get_metrics(self, paths, successful_steps=5):
"""
Evaluate paths and report metrics
Expand Down