Compare commits
13 Commits
merge_upst
...
grab_goals
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a59d9e4b09 | ||
|
|
70fb365601 | ||
|
|
470f8caf1d | ||
|
|
ad1afa8547 | ||
|
|
595d3af4f4 | ||
|
|
739f9a61a7 | ||
|
|
e24b4477c5 | ||
|
|
1ca009339a | ||
|
|
541a145e2d | ||
|
|
92231d9c3c | ||
|
|
795ce9b71c | ||
|
|
d09f2cffe0 | ||
|
|
644a69a066 |
@@ -5,15 +5,15 @@ IF NOT EXIST bin\openvr64pi.dll copy examples\ThirdPartyLibs\openvr\bin\win64\o
|
|||||||
#aargh, see https://github.com/ValveSoftware/openvr/issues/412
|
#aargh, see https://github.com/ValveSoftware/openvr/issues/412
|
||||||
|
|
||||||
|
|
||||||
#find a python version (hopefully just 1) and use this
|
REM #find a python version (hopefully just 1) and use this
|
||||||
dir c:\python* /b /ad > tmp1234.txt
|
REM dir c:\python* /b /ad > tmp1234.txt
|
||||||
|
|
||||||
set /p myvar1= < tmp1234.txt
|
REM set /p myvar1= < tmp1234.txt
|
||||||
set myvar=c:/%myvar1%
|
REM set myvar=c:/%myvar1%
|
||||||
del tmp1234.txt
|
REM del tmp1234.txt
|
||||||
|
|
||||||
rem you can also override and hardcode the Python path like this (just remove the # hashmark in next line)
|
rem you can also override and hardcode the Python path like this (just remove the # hashmark in next line)
|
||||||
rem SET myvar=c:\python-3.5.2
|
SET myvar=C:\Users\Bart\AppData\Local\Programs\Python\Python36
|
||||||
|
|
||||||
cd build3
|
cd build3
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,9 @@ timeStep = 1. / 600.
|
|||||||
|
|
||||||
p.setPhysicsEngineParameter(fixedTimeStep=timeStep)
|
p.setPhysicsEngineParameter(fixedTimeStep=timeStep)
|
||||||
|
|
||||||
path = pybullet_data.getDataPath() + "/data/motions/humanoid3d_backflip.txt"
|
path = pybullet_data.getDataPath() + "/data/motions/blender_ik_test.txt"
|
||||||
|
# path = pybullet_data.getDataPath() + "/data/motions/humanoid3d_zero_pos.txt"
|
||||||
|
# path = pybullet_data.getDataPath() + "/data/motions/humanoid3d_backflip.txt"
|
||||||
#path = pybullet_data.getDataPath()+"/data/motions/humanoid3d_cartwheel.txt"
|
#path = pybullet_data.getDataPath()+"/data/motions/humanoid3d_cartwheel.txt"
|
||||||
#path = pybullet_data.getDataPath()+"/data/motions/humanoid3d_walk.txt"
|
#path = pybullet_data.getDataPath()+"/data/motions/humanoid3d_walk.txt"
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
--scene imitate
|
||||||
|
|
||||||
|
--num_update_substeps 10
|
||||||
|
--num_sim_substeps 2
|
||||||
|
--world_scale 4
|
||||||
|
|
||||||
|
--terrain_file data/terrain/plane.txt
|
||||||
|
|
||||||
|
--char_types general
|
||||||
|
--character_files data/characters/humanoid3d.txt
|
||||||
|
--enable_char_soft_contact false
|
||||||
|
--fall_contact_bodies 0 1 2 3 4 6 7 8 9 10 12 13 14
|
||||||
|
|
||||||
|
--char_ctrls ct_pd
|
||||||
|
--char_ctrl_files data/controllers/humanoid3d_ctrl.txt
|
||||||
|
--motion_file data/motions/humanoid_grasp_test.txt
|
||||||
|
--sync_char_root_pos true
|
||||||
|
--sync_char_root_rot false
|
||||||
|
--goal_type Grab
|
||||||
|
|
||||||
|
--agent_files data/agents/ct_agent_humanoid_ppo.txt
|
||||||
|
--train_agents false
|
||||||
|
|
||||||
|
#--output_path output
|
||||||
|
#--int_output_path output/intermediate
|
||||||
|
--model_files output/grasp_goal_partial_run/agent0_model.ckpt
|
||||||
|
#--model_files output/spinkick_partial_run/agent0_model.ckpt
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
--scene imitate
|
||||||
|
|
||||||
|
--num_update_substeps 10
|
||||||
|
--num_sim_substeps 2
|
||||||
|
--world_scale 4
|
||||||
|
|
||||||
|
--terrain_file data/terrain/plane.txt
|
||||||
|
|
||||||
|
--char_types general
|
||||||
|
--character_files data/characters/humanoid3d.txt
|
||||||
|
--enable_char_soft_contact false
|
||||||
|
--fall_contact_bodies 0 1 2 3 4 6 7 8 9 10 12 13 14
|
||||||
|
|
||||||
|
--char_ctrls ct_pd
|
||||||
|
--char_ctrl_files data/controllers/humanoid3d_ctrl.txt
|
||||||
|
--motion_file data/motions/humanoid_grasp_test.txt
|
||||||
|
--sync_char_root_pos true
|
||||||
|
--sync_char_root_rot false
|
||||||
|
--goal_type NoGoal
|
||||||
|
|
||||||
|
--agent_files data/agents/ct_agent_humanoid_ppo.txt
|
||||||
|
--train_agents false
|
||||||
|
|
||||||
|
#--output_path output
|
||||||
|
#--int_output_path output/intermediate
|
||||||
|
--model_files output/grasp_partial_run/agent0_model.ckpt
|
||||||
|
#--model_files output/spinkick_partial_run/agent0_model.ckpt
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
--scene imitate
|
||||||
|
|
||||||
|
--num_update_substeps 10
|
||||||
|
--num_sim_substeps 2
|
||||||
|
--world_scale 4
|
||||||
|
|
||||||
|
--terrain_file data/terrain/plane.txt
|
||||||
|
|
||||||
|
--char_types general
|
||||||
|
--character_files data/characters/humanoid3d.txt
|
||||||
|
--enable_char_soft_contact false
|
||||||
|
--fall_contact_bodies 0 1 2 3 4 6 7 8 9 10 12 13 14
|
||||||
|
|
||||||
|
--char_ctrls ct_pd
|
||||||
|
--char_ctrl_files data/controllers/humanoid3d_ctrl.txt
|
||||||
|
--motion_file data/motions/humanoid3d_run.txt
|
||||||
|
--sync_char_root_pos true
|
||||||
|
--sync_char_root_rot false
|
||||||
|
|
||||||
|
--agent_files data/agents/ct_agent_humanoid_ppo.txt
|
||||||
|
--train_agents false
|
||||||
|
|
||||||
|
#--output_path output
|
||||||
|
#--int_output_path output/intermediate
|
||||||
|
--model_files output/agent0_model.ckpt
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
--scene imitate
|
||||||
|
|
||||||
|
--time_lim_min 0.5
|
||||||
|
--time_lim_max 0.5
|
||||||
|
--time_lim_exp 0.2
|
||||||
|
--time_end_lim_min 20
|
||||||
|
--time_end_lim_max 20
|
||||||
|
--time_end_lim_exp 50
|
||||||
|
--anneal_samples 32000000
|
||||||
|
|
||||||
|
--num_update_substeps 10
|
||||||
|
--num_sim_substeps 2
|
||||||
|
--world_scale 4
|
||||||
|
|
||||||
|
--terrain_file data/terrain/plane.txt
|
||||||
|
|
||||||
|
--char_types general
|
||||||
|
--character_files data/characters/humanoid3d.txt
|
||||||
|
--enable_char_soft_contact false
|
||||||
|
--fall_contact_bodies 0 1 2 3 4 6 7 8 9 10 12 13 14
|
||||||
|
|
||||||
|
--char_ctrls ct_pd
|
||||||
|
--char_ctrl_files data/controllers/humanoid3d_ctrl.txt
|
||||||
|
--motion_file data/motions/humanoid3d_run.txt
|
||||||
|
--sync_char_root_pos true
|
||||||
|
--sync_char_root_rot false
|
||||||
|
|
||||||
|
--agent_files data/agents/ct_agent_humanoid_ppo.txt
|
||||||
|
#--train_agents false
|
||||||
|
|
||||||
|
#--output_path output
|
||||||
|
#--int_output_path output/intermediate
|
||||||
|
--model_files output/agent0_model.ckpt
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
--scene imitate
|
||||||
|
|
||||||
|
--time_lim_min 0.5
|
||||||
|
--time_lim_max 0.5
|
||||||
|
--time_lim_exp 0.2
|
||||||
|
--time_end_lim_min 20
|
||||||
|
--time_end_lim_max 20
|
||||||
|
--time_end_lim_exp 50
|
||||||
|
--anneal_samples 32000000
|
||||||
|
|
||||||
|
--num_update_substeps 10
|
||||||
|
--num_sim_substeps 2
|
||||||
|
--world_scale 4
|
||||||
|
|
||||||
|
--terrain_file data/terrain/plane.txt
|
||||||
|
|
||||||
|
--char_types general
|
||||||
|
--character_files data/characters/humanoid3d.txt
|
||||||
|
--enable_char_soft_contact false
|
||||||
|
--fall_contact_bodies 0 1 2 3 4 6 7 8 9 10 12 13 14
|
||||||
|
|
||||||
|
--char_ctrls ct_pd
|
||||||
|
--char_ctrl_files data/controllers/humanoid3d_ctrl.txt
|
||||||
|
--motion_file data/motions/humanoid_grasp_test.txt
|
||||||
|
--sync_char_root_pos true
|
||||||
|
--sync_char_root_rot false
|
||||||
|
|
||||||
|
--agent_files data/agents/ct_agent_humanoid_ppo.txt
|
||||||
|
#--train_agents false
|
||||||
|
|
||||||
|
--output_path output
|
||||||
|
#--int_output_path output/intermediate
|
||||||
|
#--model_files data/policies/humanoid3d/agent0_model.ckpt
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
--scene imitate
|
||||||
|
|
||||||
|
--time_lim_min 0.5
|
||||||
|
--time_lim_max 0.5
|
||||||
|
--time_lim_exp 0.2
|
||||||
|
--time_end_lim_min 20
|
||||||
|
--time_end_lim_max 20
|
||||||
|
--time_end_lim_exp 50
|
||||||
|
--anneal_samples 32000000
|
||||||
|
|
||||||
|
--num_update_substeps 10
|
||||||
|
--num_sim_substeps 2
|
||||||
|
--world_scale 4
|
||||||
|
|
||||||
|
--terrain_file data/terrain/plane.txt
|
||||||
|
|
||||||
|
--char_types general
|
||||||
|
--character_files data/characters/humanoid3d.txt
|
||||||
|
--enable_char_soft_contact false
|
||||||
|
--fall_contact_bodies 0 1 2 3 4 6 7 8 9 10 12 13 14
|
||||||
|
--goal_type Grab
|
||||||
|
|
||||||
|
--char_ctrls ct_pd
|
||||||
|
--char_ctrl_files data/controllers/humanoid3d_ctrl.txt
|
||||||
|
--motion_file data/motions/humanoid_grasp_test.txt
|
||||||
|
--sync_char_root_pos true
|
||||||
|
--sync_char_root_rot false
|
||||||
|
|
||||||
|
--agent_files data/agents/ct_agent_humanoid_ppo.txt
|
||||||
|
#--train_agents false
|
||||||
|
|
||||||
|
--output_path output
|
||||||
|
#--int_output_path output/intermediate
|
||||||
|
#--model_files data/policies/humanoid3d/agent0_model.ckpt
|
||||||
3409
examples/pybullet/gym/pybullet_data/data/motions/blender_ik_test.txt
Normal file
3409
examples/pybullet/gym/pybullet_data/data/motions/blender_ik_test.txt
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"Loop": "wrap",
|
||||||
|
"Frames":
|
||||||
|
[
|
||||||
|
[0.062500, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000,0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000],
|
||||||
|
[0.062500, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000,0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000],
|
||||||
|
[0.062500, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000,0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000],
|
||||||
|
[0.062500, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000,0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000],
|
||||||
|
[0.062500, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000,0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000],
|
||||||
|
[0.062500, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000,0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000],
|
||||||
|
[0.062500, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000,0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000],
|
||||||
|
[0.062500, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000,0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000],
|
||||||
|
[0.062500, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000,0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000],
|
||||||
|
[0.062500, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000,0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000]
|
||||||
|
]
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -4,6 +4,16 @@ import random
|
|||||||
import math
|
import math
|
||||||
import pybullet as pb
|
import pybullet as pb
|
||||||
import numpy
|
import numpy
|
||||||
|
from pybullet_envs.deep_mimic.env.humanoid_link_ids import HumanoidLinks
|
||||||
|
|
||||||
|
class RandomBounds:
|
||||||
|
def __init__(self, lower_bound: float, upper_bound: float):
|
||||||
|
self.upper_bound = upper_bound
|
||||||
|
self.lower_bound = lower_bound
|
||||||
|
self.difference = upper_bound - lower_bound
|
||||||
|
|
||||||
|
def generate(self) -> float:
|
||||||
|
return self.lower_bound + random.random() * self.difference
|
||||||
|
|
||||||
def randomVal(lowerBound, upperbound):
|
def randomVal(lowerBound, upperbound):
|
||||||
difference = upperbound - lowerBound
|
difference = upperbound - lowerBound
|
||||||
@@ -15,6 +25,7 @@ class GoalType(Enum):
|
|||||||
TargetHeading = 2
|
TargetHeading = 2
|
||||||
Throw = 3
|
Throw = 3
|
||||||
TerrainTraversal = 4
|
TerrainTraversal = 4
|
||||||
|
Grab = 5
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def from_str(goal_type_str):
|
def from_str(goal_type_str):
|
||||||
@@ -49,23 +60,33 @@ class NoGoal(Goal):
|
|||||||
def getTFData(self):
|
def getTFData(self):
|
||||||
return self.goal_data
|
return self.goal_data
|
||||||
|
|
||||||
class StrikeGoal(Goal):
|
class Strike(Goal):
|
||||||
def __init__(self):
|
def __init__(self,
|
||||||
self.follow_rot = True
|
distance_RB: RandomBounds,
|
||||||
|
height_RB: RandomBounds,
|
||||||
|
rot_RB: RandomBounds,
|
||||||
|
hit_range = 0.2,
|
||||||
|
follow_rot = True,
|
||||||
|
target_link = HumanoidLinks.rightAnkle):
|
||||||
|
self.follow_rot = follow_rot
|
||||||
self.is_hit_prev = False
|
self.is_hit_prev = False
|
||||||
|
self.distance_RB = distance_RB
|
||||||
|
self.height_RB = height_RB
|
||||||
|
self.rot_RB = rot_RB
|
||||||
|
self.hit_range = hit_range
|
||||||
|
self.target_link = target_link
|
||||||
super().__init__(GoalType.Strike)
|
super().__init__(GoalType.Strike)
|
||||||
|
|
||||||
def generateGoalData(self, modelPos=[0,0,0], modelOrient=[0,0,0,1]):
|
def generateGoalData(self,
|
||||||
|
modelPos=[0,0,0],
|
||||||
|
modelOrient=[0,0,0,1]):
|
||||||
# distance, height, rot
|
# distance, height, rot
|
||||||
distance = randomVal(0.6, 0.8)
|
distance = self.distance_RB.generate()
|
||||||
height = randomVal(0.8, 1.25)
|
height = self.height_RB.generate()
|
||||||
rot = randomVal(-1, 1) # radians
|
rot = self.rot_RB.generate() # radians
|
||||||
|
|
||||||
self.is_hit = False
|
self.is_hit = False
|
||||||
|
|
||||||
# The max distance from the target counting as a hit
|
|
||||||
self.hit_range = 0.2
|
|
||||||
|
|
||||||
# Transform to xyz coordinates for placement in environment
|
# Transform to xyz coordinates for placement in environment
|
||||||
x = distance * math.cos(rot)
|
x = distance * math.cos(rot)
|
||||||
y = distance * math.sin(rot)
|
y = distance * math.sin(rot)
|
||||||
@@ -75,7 +96,7 @@ class StrikeGoal(Goal):
|
|||||||
self.goal_data = [-x, z, y]
|
self.goal_data = [-x, z, y]
|
||||||
|
|
||||||
if self.follow_rot:
|
if self.follow_rot:
|
||||||
# Take rotation of human model into account
|
# Take rotation of robot model into account
|
||||||
rotMatList = pb.getMatrixFromQuaternion(modelOrient)
|
rotMatList = pb.getMatrixFromQuaternion(modelOrient)
|
||||||
rotMat = numpy.array([rotMatList[0:3], rotMatList[3:6], rotMatList[6:9]])
|
rotMat = numpy.array([rotMatList[0:3], rotMatList[3:6], rotMatList[6:9]])
|
||||||
vec = numpy.array(self.goal_data)
|
vec = numpy.array(self.goal_data)
|
||||||
@@ -102,6 +123,22 @@ class StrikeGoal(Goal):
|
|||||||
x = 1.0
|
x = 1.0
|
||||||
return [x] + self.goal_data
|
return [x] + self.goal_data
|
||||||
|
|
||||||
|
class Kick(Strike):
|
||||||
|
def __init__(self):
|
||||||
|
distance_RB = RandomBounds(0.6, 0.8)
|
||||||
|
height_RB = RandomBounds(0.8, 1.25)
|
||||||
|
rot_RB = RandomBounds(-1, 1)
|
||||||
|
super().__init__(distance_RB, height_RB, rot_RB, hit_range=0.2)
|
||||||
|
|
||||||
|
class Grab(Strike):
|
||||||
|
def __init__(self):
|
||||||
|
distance_RB = RandomBounds(0.4, 0.6)
|
||||||
|
height_RB = RandomBounds(0.8, 1.1)
|
||||||
|
rot_RB = RandomBounds(3.14159 - 0.5, 3.14159 + 0.5)
|
||||||
|
hit_range = 0.1
|
||||||
|
target_link = HumanoidLinks.rightWrist
|
||||||
|
super().__init__(distance_RB, height_RB, rot_RB, hit_range=hit_range, follow_rot=False, target_link=target_link)
|
||||||
|
|
||||||
class TargetHeadingGoal(Goal):
|
class TargetHeadingGoal(Goal):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(GoalType.TargetHeading)
|
super().__init__(GoalType.TargetHeading)
|
||||||
@@ -122,8 +159,10 @@ def createGoal(goal_type: GoalType) -> Goal:
|
|||||||
if goal_type == GoalType.NoGoal:
|
if goal_type == GoalType.NoGoal:
|
||||||
return NoGoal()
|
return NoGoal()
|
||||||
elif goal_type == GoalType.Strike:
|
elif goal_type == GoalType.Strike:
|
||||||
return StrikeGoal()
|
return Kick()
|
||||||
elif goal_type == GoalType.TargetHeading:
|
elif goal_type == GoalType.TargetHeading:
|
||||||
return TargetHeadingGoal()
|
return TargetHeadingGoal()
|
||||||
|
elif goal_type == GoalType.Grab:
|
||||||
|
return Grab()
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ from pybullet_utils import bullet_client
|
|||||||
import time
|
import time
|
||||||
from pybullet_envs.deep_mimic.env import motion_capture_data
|
from pybullet_envs.deep_mimic.env import motion_capture_data
|
||||||
from pybullet_envs.deep_mimic.env import humanoid_stable_pd
|
from pybullet_envs.deep_mimic.env import humanoid_stable_pd
|
||||||
from pybullet_envs.deep_mimic.env.goals import GoalType, Goal, createGoal
|
from pybullet_envs.deep_mimic.env.goals import GoalType, Goal, createGoal, Kick, Grab
|
||||||
from pybullet_envs.deep_mimic.env.humanoid_link_ids import HumanoidLinks
|
from pybullet_envs.deep_mimic.env.humanoid_link_ids import HumanoidLinks
|
||||||
import pybullet_data
|
import pybullet_data
|
||||||
import pybullet as p1
|
import pybullet as p1
|
||||||
@@ -257,7 +257,7 @@ class PyBulletDeepMimicEnv(Env):
|
|||||||
goal_weight = 0.3
|
goal_weight = 0.3
|
||||||
|
|
||||||
if self.goal.goal_type == GoalType.Strike:
|
if self.goal.goal_type == GoalType.Strike:
|
||||||
linkPos, linkOrient = self._humanoid.getLinkPositionAndOrientation(HumanoidLinks.rightAnkle)
|
linkPos, linkOrient = self._humanoid.getLinkPositionAndOrientation(self.goal.target_link)
|
||||||
reward = mimic_weight * reward + goal_weight * self.calcStrikeGoalReward(linkPos)
|
reward = mimic_weight * reward + goal_weight * self.calcStrikeGoalReward(linkPos)
|
||||||
|
|
||||||
return reward
|
return reward
|
||||||
@@ -289,7 +289,7 @@ class PyBulletDeepMimicEnv(Env):
|
|||||||
#print("pybullet_deep_mimic_env:update timeStep=",timeStep," t=",self.t)
|
#print("pybullet_deep_mimic_env:update timeStep=",timeStep," t=",self.t)
|
||||||
self._pybullet_client.setTimeStep(timeStep)
|
self._pybullet_client.setTimeStep(timeStep)
|
||||||
self._humanoid._timeStep = timeStep
|
self._humanoid._timeStep = timeStep
|
||||||
self.updateGoal(self._humanoid.getLinkPositionAndOrientation(HumanoidLinks.rightAnkle)[0])
|
self.updateGoal()
|
||||||
if self.target_id is not None: # TODO: check goal type
|
if self.target_id is not None: # TODO: check goal type
|
||||||
self.updateDrawStrikeGoal()
|
self.updateDrawStrikeGoal()
|
||||||
|
|
||||||
@@ -413,8 +413,9 @@ class PyBulletDeepMimicEnv(Env):
|
|||||||
distanceSquared = sum([(x - y)**2 for (x, y) in zip(goalPos, linkPos)])
|
distanceSquared = sum([(x - y)**2 for (x, y) in zip(goalPos, linkPos)])
|
||||||
return math.exp(-4*distanceSquared)
|
return math.exp(-4*distanceSquared)
|
||||||
|
|
||||||
def updateGoal(self, linkPos):
|
def updateGoal(self):
|
||||||
if self.goal.goal_type == GoalType.Strike:
|
if self.goal.goal_type == GoalType.Strike:
|
||||||
|
linkPos = self._humanoid.getLinkPositionAndOrientation(self.goal.target_link)[0]
|
||||||
if self.prevCycleCount != self._humanoid.cycleCount:
|
if self.prevCycleCount != self._humanoid.cycleCount:
|
||||||
# generate new goal
|
# generate new goal
|
||||||
humanPos, humanOrient = self._humanoid.getLinkPositionAndOrientation(0)
|
humanPos, humanOrient = self._humanoid.getLinkPositionAndOrientation(0)
|
||||||
|
|||||||
@@ -26,7 +26,9 @@ pybullet_client.setPhysicsEngineParameter(numSolverIterations=10)
|
|||||||
|
|
||||||
mocapData = motion_capture_data.MotionCaptureData()
|
mocapData = motion_capture_data.MotionCaptureData()
|
||||||
#motionPath = pybullet_data.getDataPath()+"/data/motions/humanoid3d_walk.txt"
|
#motionPath = pybullet_data.getDataPath()+"/data/motions/humanoid3d_walk.txt"
|
||||||
motionPath = pybullet_data.getDataPath() + "/data/motions/humanoid3d_backflip.txt"
|
# motionPath = pybullet_data.getDataPath() + "/data/motions/humanoid3d_backflip.txt"
|
||||||
|
# motionPath = pybullet_data.getDataPath() + "/data/motions/blender_ik_test.txt"
|
||||||
|
motionPath = pybullet_data.getDataPath() + "/data/motions/humanoid_grasp_test.txt"
|
||||||
mocapData.Load(motionPath)
|
mocapData.Load(motionPath)
|
||||||
timeStep = 1. / 600
|
timeStep = 1. / 600
|
||||||
useFixedBase = False
|
useFixedBase = False
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ class RLAgent(ABC):
|
|||||||
|
|
||||||
self._output_dir = ""
|
self._output_dir = ""
|
||||||
self._int_output_dir = ""
|
self._int_output_dir = ""
|
||||||
self.output_iters = 100
|
self.output_iters = 50
|
||||||
self.int_output_iters = 100
|
self.int_output_iters = 100
|
||||||
|
|
||||||
self.train_return = 0.0
|
self.train_return = 0.0
|
||||||
@@ -556,7 +556,7 @@ class RLAgent(ABC):
|
|||||||
self.logger.log_tabular("Test_Return", self.avg_test_return)
|
self.logger.log_tabular("Test_Return", self.avg_test_return)
|
||||||
self.logger.log_tabular("State_Mean", s_mean)
|
self.logger.log_tabular("State_Mean", s_mean)
|
||||||
self.logger.log_tabular("State_Std", s_std)
|
self.logger.log_tabular("State_Std", s_std)
|
||||||
self.logger.log_tabular("Goal_Type", self.world.env.goal.goal_type)
|
self.logger.log_tabular("Goal_Type", self.world.env.goal.__class__.__name__)
|
||||||
self.logger.log_tabular("Goal_Mean", g_mean)
|
self.logger.log_tabular("Goal_Mean", g_mean)
|
||||||
self.logger.log_tabular("Goal_Std", g_std)
|
self.logger.log_tabular("Goal_Std", g_std)
|
||||||
self._log_exp_params()
|
self._log_exp_params()
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
python testrl.py --arg_file run_humanoid3d_backflip_args.txt
|
||||||
|
python testrl.py --arg_file run_humanoid3d_spinkick_args_semi_trained.txt
|
||||||
|
python testrl.py --arg_file run_humanoid_run_semi_trained.txt
|
||||||
|
python testrl.py --arg_file run_humanoid_grasp_semi_trained.txt
|
||||||
|
python testrl.py --arg_file run_humanoid_grasp_goal_semi_trained.txt
|
||||||
|
|
||||||
|
|
||||||
|
scp -r acro@10.11.98.170:Git/bullet3/examples/pybullet/gym/pybullet_envs/deep_mimic/output C:/UntrackedGit/bulletFork/bullet3/examples/pybullet/gym/pybullet_envs/deep_mimic/output
|
||||||
|
scp -r acro@10.11.98.170:Git/bullet3/examples/pybullet/gym/pybullet_envs/deep_mimic/output C:/UntrackedGit/bulletFork/bullet3/examples/pybullet/gym/pybullet_data/output
|
||||||
|
scp -r acro@10.11.98.170:Git/bullet3/examples/pybullet/gym/pybullet_envs/deep_mimic/output C:/UntrackedGit/bulletFork/bullet3/examples/pybullet/gym/pybullet_data/output/spinkick_partial_run
|
||||||
|
scp -r acro@10.11.98.170:Git/bullet3/examples/pybullet/gym/pybullet_envs/deep_mimic/output C:/UntrackedGit/bulletFork/bullet3/examples/pybullet/gym/pybullet_data/output/grasp_partial_run
|
||||||
|
scp -r acro@10.11.98.170:Git/bullet3/examples/pybullet/gym/pybullet_envs/deep_mimic/output C:/UntrackedGit/bulletFork/bullet3/examples/pybullet/gym/pybullet_data/output/grasp_goal_partial_run
|
||||||
|
scp -r acro@10.11.98.170:Git/bullet3/examples/pybullet/gym/pybullet_envs/deep_mimic/output C:/UntrackedGit/bulletFork/bullet3/examples/pybullet/gym/pybullet_data/data/policies/humanoid3d
|
||||||
|
|
||||||
|
scp -r -P 33001 acro@127.0.0.1:Git/bullet3/examples/pybullet/gym/pybullet_envs/deep_mimic/output C:/UntrackedGit/bulletFork/bullet3/examples/pybullet/gym/pybullet_data/output/grasp_partial_run
|
||||||
|
scp -r -P 33001 acro@127.0.0.1:Git/bullet3/examples/pybullet/gym/pybullet_envs/deep_mimic/output C:/UntrackedGit/bulletFork/bullet3/examples/pybullet/gym/pybullet_data/output/grasp_goal_partial_run
|
||||||
|
|
||||||
|
cd Git/bullet3/examples/pybullet/gym/pybullet_envs/deep_mimic
|
||||||
|
mpiexec -n 16 python3 DeepMimic_Optimizer.py --arg_file train_humanoid3d_kick_goals_args.txt --num_workers 16
|
||||||
|
mpiexec -n 16 python3 DeepMimic_Optimizer.py --arg_file train_humanoid3d_spinkick_args.txt --num_workers 16
|
||||||
|
mpiexec -n 16 python3 DeepMimic_Optimizer.py --arg_file train_humanoid3d_walk_args.txt --num_workers 16
|
||||||
|
mpiexec -n 16 python DeepMimic_Optimizer.py --arg_file train_humanoid3d_run_args.txt --num_workers 16
|
||||||
|
mpiexec -n 16 python DeepMimic_Optimizer.py --arg_file train_humanoid_grasp_args.txt --num_workers 16
|
||||||
|
mpiexec -n 16 python DeepMimic_Optimizer.py --arg_file train_humanoid_grasp_goal.txt --num_workers 16
|
||||||
|
|
||||||
|
// "python3" may have to be "python" instead in previous commands!
|
||||||
|
|
||||||
|
// To install pybullet from a local package editably:
|
||||||
|
pip install --editable .
|
||||||
|
|
||||||
|
// Remote server setup:
|
||||||
|
// setup virtual environment:
|
||||||
|
virtualenv env
|
||||||
|
pip install gym
|
||||||
|
pip install tensorflow==1.14.0
|
||||||
|
|
||||||
|
// build and install pybullet locally:
|
||||||
|
// In bullet3 root folder:
|
||||||
|
./build_cmake_pybullet_double.sh
|
||||||
|
pip install --editable .
|
||||||
|
|
||||||
|
// Install openMPI:
|
||||||
|
https://www.open-mpi.org/
|
||||||
|
sudo apt install libopenmpi-dev
|
||||||
|
pip install mpi4py
|
||||||
|
|
||||||
|
|
||||||
|
// To run training after closing terminal:
|
||||||
|
https://linuxize.com/post/how-to-use-linux-screen/
|
||||||
|
sudo apt install screen
|
||||||
|
screen -r // To return to screen
|
||||||
|
ctrl + a -> d // To detach from screen
|
||||||
|
ctrl + a -> K // To kill screen (Or type: exit)
|
||||||
|
|
||||||
|
ssh acro@10.11.98.170
|
||||||
|
|
||||||
|
|
||||||
|
// enable virtualenv:
|
||||||
|
source /home/acro/Git/bullet3/env/bin/activate
|
||||||
|
|
||||||
Reference in New Issue
Block a user