Skip to content

Commit

Permalink
🚀 [RofuncRL] Change folder of IsaacGym tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
Skylark committed Oct 31, 2023
1 parent 7d46be1 commit d1a707c
Show file tree
Hide file tree
Showing 39 changed files with 59 additions and 68 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""
FrankaCabinet (RofuncRL)
FrankaCubeStack (RofuncRL)
=======================
Open drawers with a Franka robot, trained by RofuncRL
FrankaCubeStack, trained by RofuncRL
"""

import isaacgym
Expand Down Expand Up @@ -94,7 +94,7 @@ def inference(custom_args):
parser.add_argument("--num_envs", type=int, default=4096)
parser.add_argument("--device_id", type=int, default=gpu_id)
parser.add_argument("--rl_device", type=str, default=f"cuda:{gpu_id}")
parser.add_argument("--headless", type=str, default="False")
parser.add_argument("--headless", type=str, default="True")
parser.add_argument("--inference", action="store_true", help="turn to inference mode while adding this argument")
parser.add_argument("--ckpt_path", type=str, default=None)
custom_args = parser.parse_args()
Expand Down
34 changes: 17 additions & 17 deletions rofunc/learning/RofuncRL/tasks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@ class Tasks:
def __init__(self, env_type="isaacgym"):
if env_type == "isaacgym":
# Isaac Gym tasks
from .ant import AntTask
from .cartpole import CartpoleTask
from .curi_cabinet import CURICabinetTask
from .curi_cabinet_image import CURICabinetImageTask
from .curi_cabinet_bimanual import CURICabinetBimanualTask
from .curi_coffee_stirring import CURICoffeeStirringTask
from .franka_cabinet import FrankaCabinetTask
from .franka_cube_stack import FrankaCubeStackTask
from .humanoid import HumanoidTask
from .humanoid_amp import HumanoidAMPTask
from .ase.humanoid_amp_getup import HumanoidAMPGetupTask
from .ase.humanoid_perturb import HumanoidPerturbTask
from .ase.humanoid_heading import HumanoidHeadingTask
from .ase.humanoid_location import HumanoidLocationTask
from .ase.humanoid_reach import HumanoidReachTask
from .ase.humanoid_strike import HumanoidStrikeTask
from .ase.humanoid_view_motion import HumanoidViewMotionTask
from .isaacgym.ant import AntTask
from .isaacgym.cartpole import CartpoleTask
from .isaacgym.curi_cabinet import CURICabinetTask
from .isaacgym.curi_cabinet_image import CURICabinetImageTask
from .isaacgym.curi_cabinet_bimanual import CURICabinetBimanualTask
from .isaacgym.curi_coffee_stirring import CURICoffeeStirringTask
from .isaacgym.franka_cabinet import FrankaCabinetTask
from .isaacgym.franka_cube_stack import FrankaCubeStackTask
from .isaacgym.humanoid import HumanoidTask
from .isaacgym.humanoid_amp import HumanoidAMPTask
from .isaacgym.ase.humanoid_amp_getup import HumanoidAMPGetupTask
from .isaacgym.ase.humanoid_perturb import HumanoidPerturbTask
from .isaacgym.ase.humanoid_heading import HumanoidHeadingTask
from .isaacgym.ase.humanoid_location import HumanoidLocationTask
from .isaacgym.ase.humanoid_reach import HumanoidReachTask
from .isaacgym.ase.humanoid_strike import HumanoidStrikeTask
from .isaacgym.ase.humanoid_view_motion import HumanoidViewMotionTask

self.task_map = {
"Ant": AntTask,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from isaacgym import gymtorch

from rofunc.utils.oslab.path import get_rofunc_path
from rofunc.learning.RofuncRL.tasks.base.vec_task import VecTask
from rofunc.learning.RofuncRL.tasks.isaacgym.base.vec_task import VecTask
from rofunc.learning.RofuncRL.tasks.utils.torch_jit_utils import *

DOF_BODY_IDS = [1, 2, 3, 4, 6, 7, 9, 10, 11, 12, 13, 14]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

from rofunc.utils.datalab.poselib.poselib.skeleton.skeleton3d import SkeletonMotion
from rofunc.utils.datalab.poselib.poselib.core import quat_mul_norm, quat_inverse, quat_angle_axis
from rofunc.learning.RofuncRL.tasks.amp.humanoid_amp_base import DOF_BODY_IDS, DOF_OFFSETS
from rofunc.learning.RofuncRL.tasks.isaacgym.amp.humanoid_amp_base import DOF_BODY_IDS, DOF_OFFSETS
from rofunc.learning.RofuncRL.tasks.utils.torch_jit_utils import *


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from isaacgym import gymapi
from isaacgym import gymtorch

from rofunc.learning.RofuncRL.tasks.base.vec_task import VecTask
from rofunc.learning.RofuncRL.tasks.isaacgym.base.vec_task import VecTask
from rofunc.learning.RofuncRL.tasks.utils.torch_jit_utils import *
from rofunc.utils.oslab.path import get_rofunc_path

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from isaacgym import gymtorch
from isaacgym.torch_utils import *

from rofunc.learning.RofuncRL.tasks.base.vec_task import VecTask
from rofunc.learning.RofuncRL.tasks.isaacgym.base.vec_task import VecTask


class Anymal(VecTask):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from isaacgym import gymtorch
from isaacgym.torch_utils import *

from rofunc.learning.RofuncRL.tasks.base.vec_task import VecTask
from rofunc.learning.RofuncRL.tasks.isaacgym.base.vec_task import VecTask


class AnymalTerrain(VecTask):
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from isaacgym.torch_utils import *

from rofunc.utils.oslab.path import get_rofunc_path
from rofunc.learning.RofuncRL.tasks.base.vec_task import VecTask
from rofunc.learning.RofuncRL.tasks.isaacgym.base.vec_task import VecTask
from rofunc.learning.RofuncRL.tasks.utils import torch_jit_utils as torch_utils


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
from isaacgym.torch_utils import *

import rofunc as rf
from rofunc.learning.RofuncRL.tasks.ase.motion_lib import MotionLib
from rofunc.learning.RofuncRL.tasks.ase.humanoid import Humanoid, dof_to_obs
from rofunc.learning.RofuncRL.tasks.isaacgym.ase.motion_lib import MotionLib
from rofunc.learning.RofuncRL.tasks.isaacgym.ase.humanoid import Humanoid, dof_to_obs
from rofunc.learning.RofuncRL.tasks.utils import torch_jit_utils as torch_utils


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from isaacgym import gymtorch
from isaacgym.torch_utils import *

from rofunc.learning.RofuncRL.tasks.ase.humanoid_amp import HumanoidAMP
from rofunc.learning.RofuncRL.tasks.isaacgym.ase.humanoid_amp import HumanoidAMP


class HumanoidAMPGetupTask(HumanoidAMP):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

import torch

from rofunc.learning.RofuncRL.tasks.ase.humanoid_amp import HumanoidAMP
from rofunc.learning.RofuncRL.tasks.isaacgym.ase.humanoid_amp import HumanoidAMP


class HumanoidAMPTask(HumanoidAMP):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from isaacgym.torch_utils import *

from rofunc.utils.oslab.path import get_rofunc_path
from rofunc.learning.RofuncRL.tasks.ase.humanoid_amp_task import HumanoidAMPTask
from rofunc.learning.RofuncRL.tasks.isaacgym.ase.humanoid_amp_task import HumanoidAMPTask
from rofunc.learning.RofuncRL.tasks.utils import torch_jit_utils as torch_utils

TAR_ACTOR_ID = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from isaacgym.torch_utils import *

from rofunc.utils.oslab.path import get_rofunc_path
from rofunc.learning.RofuncRL.tasks.ase.humanoid_amp_task import HumanoidAMPTask
from rofunc.learning.RofuncRL.tasks.isaacgym.ase.humanoid_amp_task import HumanoidAMPTask
from rofunc.learning.RofuncRL.tasks.utils import torch_jit_utils as torch_utils


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from isaacgym.torch_utils import *

from rofunc.utils.oslab.path import get_rofunc_path
from rofunc.learning.RofuncRL.tasks.ase.humanoid_amp import HumanoidAMP
from rofunc.learning.RofuncRL.tasks.isaacgym.ase.humanoid_amp import HumanoidAMP

# import env.tasks.humanoid_amp_getup as humanoid_amp_getup
# # import env.tasks.humanoid_strike as humanoid_strike
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from isaacgym.torch_utils import *

from rofunc.utils.oslab.path import get_rofunc_path
from rofunc.learning.RofuncRL.tasks.ase.humanoid_amp_task import HumanoidAMPTask
from rofunc.learning.RofuncRL.tasks.isaacgym.ase.humanoid_amp_task import HumanoidAMPTask
from rofunc.learning.RofuncRL.tasks.utils import torch_jit_utils as torch_utils


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from isaacgym.torch_utils import *

from rofunc.utils.oslab.path import get_rofunc_path
from rofunc.learning.RofuncRL.tasks.ase.humanoid_amp_task import HumanoidAMPTask
from rofunc.learning.RofuncRL.tasks.isaacgym.ase.humanoid_amp_task import HumanoidAMPTask
from rofunc.learning.RofuncRL.tasks.utils import torch_jit_utils as torch_utils


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@

import torch

from isaacgym import gymtorch, gymapi
from isaacgym import gymtorch

from rofunc.learning.RofuncRL.tasks.ase.humanoid_amp import HumanoidAMP
from rofunc.learning.RofuncRL.tasks.isaacgym.ase.humanoid_amp import HumanoidAMP


class HumanoidViewMotionTask(HumanoidAMP):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from isaacgym import gymtorch, gymapi
from isaacgym.torch_utils import *

from rofunc.learning.RofuncRL.tasks.base.vec_task import VecTask
from rofunc.learning.RofuncRL.tasks.isaacgym.base.vec_task import VecTask


class CURIBaseTask(VecTask):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
import gym
from gym import spaces

from isaacgym import gymtorch, gymapi
from rofunc.learning.RofuncRL.tasks.base.dr_utils import (
from isaacgym import gymapi
from rofunc.learning.RofuncRL.tasks.isaacgym.base.dr_utils import (
get_property_setter_map,
get_property_getter_map,
get_default_setter_args,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import torch
from isaacgym import gymtorch, gymapi

from rofunc.learning.RofuncRL.tasks.base.vec_task import VecTask
from rofunc.learning.RofuncRL.tasks.isaacgym.base.vec_task import VecTask
from rofunc.utils.oslab.path import get_rofunc_path


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from isaacgym import gymtorch, gymapi
from isaacgym.torch_utils import *

from rofunc.learning.RofuncRL.tasks.base.curi_base_task import CURIBaseTask
from rofunc.learning.RofuncRL.tasks.isaacgym.base.curi_base_task import CURIBaseTask
from rofunc.utils.oslab.path import get_rofunc_path


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from isaacgym import gymtorch, gymapi
from isaacgym.torch_utils import *

from rofunc.learning.RofuncRL.tasks.base.curi_base_task import CURIBaseTask
from rofunc.learning.RofuncRL.tasks.isaacgym.base.curi_base_task import CURIBaseTask
from rofunc.utils.oslab.path import get_rofunc_path


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
from isaacgym.torch_utils import *

import rofunc as rf
from rofunc.learning.RofuncRL.tasks.base.curi_base_task import CURIBaseTask
from rofunc.learning.RofuncRL.tasks.curi_cabinet import CURICabinetTask
from rofunc.learning.RofuncRL.tasks.isaacgym.base.curi_base_task import CURIBaseTask
from rofunc.learning.RofuncRL.tasks.isaacgym.curi_cabinet import CURICabinetTask
from rofunc.utils.oslab.path import get_rofunc_path


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from isaacgym import gymtorch, gymapi
from isaacgym.torch_utils import *

from rofunc.learning.RofuncRL.tasks.base.vec_task import VecTask
from rofunc.learning.RofuncRL.tasks.isaacgym.base.vec_task import VecTask
from rofunc.utils.oslab.path import get_rofunc_path


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from isaacgym import gymtorch, gymapi
from isaacgym.torch_utils import *

from rofunc.learning.RofuncRL.tasks.base.vec_task import VecTask
from rofunc.learning.RofuncRL.tasks.isaacgym.base.vec_task import VecTask
from rofunc.utils.oslab.path import get_rofunc_path


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,13 @@
from isaacgym import gymapi
from isaacgym import gymtorch

from rofunc.learning.RofuncRL.tasks.base.vec_task import VecTask
from rofunc.learning.RofuncRL.tasks.isaacgym.base.vec_task import VecTask
from rofunc.learning.RofuncRL.tasks.utils.torch_jit_utils import *
from rofunc.utils.oslab.path import get_rofunc_path


@torch.jit.script
def axisangle2quat(vec, eps=1e-6):
"""
Converts scaled axis-angle to quat.
Args:
vec (tensor): (..., 3) tensor where final dim is (ax,ay,az) axis-angle exponential coordinates
eps (float): Stability value below which small values will be mapped to 0
Returns:
tensor: (..., 4) tensor where final dim is (x,y,z,w) vec4 float quaternion
"""
# type: (Tensor, float) -> Tensor
# store input shape and reshape
input_shape = vec.shape[:-1]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
import yaml
import mujoco_py

from . import transform_utils as T
from .base import EnvMeta
from rofunc.learning.RofuncRL.tasks import transform_utils as T
from rofunc.learning.RofuncRL.tasks.isaacgym.base import EnvMeta
from .image_utils import color_segmentation
from .mjcf_utils import xml_path_completion
from .models import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import numpy as np
import gym.spaces

from . import transform_utils as T
from rofunc.learning.RofuncRL.tasks import transform_utils as T
from .furniture import FurnitureEnv
from ..util.logger import logger

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from isaacgym import gymapi
from isaacgym import gymtorch

from rofunc.learning.RofuncRL.tasks.base.vec_task import VecTask
from rofunc.learning.RofuncRL.tasks.isaacgym.base.vec_task import VecTask
from rofunc.learning.RofuncRL.tasks.utils.torch_jit_utils import *
from rofunc.utils.oslab.path import get_rofunc_path

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
from isaacgym import gymtorch

import rofunc as rf
from rofunc.learning.RofuncRL.tasks.amp.humanoid_amp_base import HumanoidAMPBase, dof_to_obs
from rofunc.learning.RofuncRL.tasks.amp.motion_lib import MotionLib
from rofunc.learning.RofuncRL.tasks.isaacgym.amp.humanoid_amp_base import HumanoidAMPBase, dof_to_obs
from rofunc.learning.RofuncRL.tasks.isaacgym.amp.motion_lib import MotionLib
from rofunc.learning.RofuncRL.tasks.utils.torch_jit_utils import *

NUM_AMP_OBS_PER_STEP = 13 + 52 + 28 + 12 # [root_h, root_rot, root_vel, root_ang_vel, dof_pos, dof_vel, key_body_pos]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from isaacgym import gymtorch, gymapi
from isaacgym.torch_utils import *

from rofunc.learning.RofuncRL.tasks.base.vec_task import VecTask
from rofunc.learning.RofuncRL.tasks.isaacgym.base.vec_task import VecTask
from rofunc.utils.oslab.path import get_rofunc_path


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from isaacgym import gymapi
from isaacgym import gymtorch

from rofunc.learning.RofuncRL.tasks.base.vec_task import VecTask
from rofunc.learning.RofuncRL.tasks.isaacgym.base.vec_task import VecTask
from rofunc.learning.RofuncRL.tasks.utils.torch_jit_utils import *


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
from isaacgym import gymapi
from isaacgym import gymtorch

project_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
project_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '../..'))

from rofunc.learning.RofuncRL.tasks.utils.torch_jit_utils import *
from rofunc.learning.RofuncRL.tasks.base.vec_task import VecTask
from rofunc.learning.RofuncRL.tasks.isaacgym.base.vec_task import VecTask

from types import SimpleNamespace
from collections import deque
Expand Down Expand Up @@ -175,7 +175,7 @@ def __compute(self):
class Trifinger(VecTask):
# constants
# directory where assets for the simulator are present
_trifinger_assets_dir = os.path.join(project_dir, "../", "assets", "trifinger")
_trifinger_assets_dir = os.path.join(project_dir, "../../", "assets", "trifinger")
# robot urdf (path relative to `_trifinger_assets_dir`)
_robot_urdf_file = "robot_properties_fingers/urdf/pro/trifingerpro.urdf"
# stage urdf (path relative to `_trifinger_assets_dir`)
Expand Down

0 comments on commit d1a707c

Please sign in to comment.