Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/czli-dev2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Skylark0924 committed Nov 22, 2024
2 parents ea494ed + 43c4a29 commit 2e10051
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
7 changes: 6 additions & 1 deletion rofunc/config/simulator/Humanoid.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ graphics_device_id: 0
sim_device: 'cuda:0'

env:
numEnvs: 16
numEnvs: 1
envSpacing: 1
numEnvPerRow: 1

Expand All @@ -18,6 +18,11 @@ env:
# to anything > 0 will disable all self collisions.
collision_mode: -1

mani:
enable: True
export_link: ...
vis: True

asset:
robot_name: "Humanoid"
assetRoot:
Expand Down
12 changes: 7 additions & 5 deletions rofunc/config/view_motion/HOTUHumanoidWQbhandNew.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,19 @@ env:
# animation files to learn from
# motion_file: "examples/data/hotu2/20240509/all_hotu_motion.yaml"
# motion_file: "examples/data/hotu2/20240509/Ramdom (good)_Take 2024-05-09 04.49.16 PM_optitrack2hotu.npy"
motion_file: "examples/data/hotu2/20240509/Jumping_Take 2024-05-09 04.15.38 PM_optitrack2hotu.npy"
motion_file: "examples/data/hotu2/demo_2_test_chenzui_only_optitrack2hotu.npy"

use_extra_dof_states_motion: False

motion_file_asset: "mjcf/hotu/hotu_humanoid_w_qbhand_full_new.xml"
# motion_file_asset: "mjcf/hotu/hotu_humanoid_w_qbhand_full_new.xml"
motion_file_asset: "mjcf/hotu/hotu_humanoid.xml"

object_motion_file:

asset:
# assetFileName: "mjcf/hotu/hotu_humanoid_w_qbhand_full_new.xml"
assetFileName: "mjcf/hotu/hotu_humanoid_w_qbhand_full_new.xml"
# assetFileName: "mjcf/hotu/hotu_humanoid_w_qbhand_full_new.xml"
assetFileName: "mjcf/hotu/hotu_humanoid.xml"

use_object_motion: False
object_asset:
Expand All @@ -28,8 +30,8 @@ env:
assetSize: # List of object size, used for scaling the object and creating the box objects

task:
wb_decompose: True # if True, decompose the whole body into parts
wb_decompose: False # if True, decompose the whole body into parts
wb_decompose_parameter:
parts: ["body"]
# parts: [ "hands", "upper_body", "lower_body" ]
use_synergy: True # if True, use the synergy for the hand
use_synergy: False # if True, use the synergy for the hand
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import torch
import csv

from isaacgym import gymtorch

Expand All @@ -43,6 +44,7 @@ def __init__(
headless,
virtual_screen_capture,
force_render,
csv_path
):
self.cfg = cfg
control_freq_inv = cfg["env"]["controlFrequencyInv"]
Expand All @@ -68,6 +70,10 @@ def __init__(
)
self._motion_ids = torch.remainder(self._motion_ids, num_motions)

# Initialize CSV writing
self.csv_file = open(csv_path, 'w', newline='')
self.csv_writer = csv.writer(self.csv_file)

def pre_physics_step(self, actions):
self.actions = actions.to(self.device).clone()

Expand Down Expand Up @@ -101,6 +107,10 @@ def _motion_sync(self):
key_pos,
) = self._motion_lib.get_motion_state(motion_ids, motion_times)

# Convert torch tensor to a list and write to CSV
dof_pos_list = dof_pos.tolist()
self.csv_writer.writerows(dof_pos_list)

root_vel = torch.zeros_like(root_vel)
root_ang_vel = torch.zeros_like(root_ang_vel)
dof_vel = torch.zeros_like(dof_vel)
Expand Down

0 comments on commit 2e10051

Please sign in to comment.