Skip to content

Commit c34b269

Browse files
authored
Merge pull request #1027 from StanfordVL/feat/curobo-primitives
Integrate cuRobo into action primitives & primitives refactoring
2 parents 8b263bf + d5a8c54 commit c34b269

38 files changed

+1862
-1097
lines changed

.github/workflows/tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
continue-on-error: true
6161

6262
- name: Deploy artifact
63-
uses: actions/upload-artifact@v3
63+
uses: actions/upload-artifact@v4
6464
with:
6565
name: ${{ github.run_id }}-tests-${{ matrix.test_file }}
6666
path: ${{ matrix.test_file }}.xml

docker/prod.Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ RUN wget --no-verbose -O /cuda-keyring.deb https://developer.download.nvidia.com
4444
DEBIAN_FRONTEND=noninteractive apt-get install -y cuda-toolkit-11-8 && \
4545
TORCH_CUDA_ARCH_LIST='7.5;8.0;8.6+PTX' PATH=/usr/local/cuda-11.8/bin:$PATH LD_LIBRARY_PATH=/usr/local/cuda-11.8/lib64:$LD_LIBRARY_PATH \
4646
micromamba run -n omnigibson pip install \
47-
git+https://github.com/StanfordVL/curobo@6a4eb2ca8677829b0f57451ad107e0a3186525e9#egg=nvidia_curobo \
47+
git+https://github.com/StanfordVL/curobo@cbaf7d32436160956dad190a9465360fad6aba73#egg=nvidia_curobo \
4848
--no-build-isolation > /dev/null && \
4949
apt-get remove -y cuda-toolkit-11-8 && apt-get autoremove -y && apt-get autoclean -y && rm -rf /var/lib/apt/lists/*
5050

omnigibson/action_primitives/action_primitive_set_base.py

+3-8
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,9 @@ def __init_subclass__(cls, **kwargs):
5858
if not inspect.isabstract(cls):
5959
REGISTERED_PRIMITIVE_SETS[cls.__name__] = cls
6060

61-
def __init__(self, env):
61+
def __init__(self, env, robot):
6262
self.env = env
63-
64-
@property
65-
def robot(self):
66-
# Currently returns the first robot in the environment, but can be scaled to multiple robots
67-
# by creating multiple action generators and passing in a robot index etc.
68-
return self.env.robots[0]
63+
self.robot = robot
6964

7065
@abstractmethod
7166
def get_action_space(self):
@@ -84,7 +79,7 @@ def apply(self, action):
8479
pass
8580

8681
@abstractmethod
87-
def apply_ref(self, action, *args):
82+
def apply_ref(self, primitive, *args):
8883
"""
8984
Apply a primitive action by reference.
9085

omnigibson/action_primitives/curobo.py

+298-75
Large diffs are not rendered by default.

omnigibson/action_primitives/starter_semantic_action_primitives.py

+752-698
Large diffs are not rendered by default.

omnigibson/action_primitives/symbolic_semantic_action_primitives.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ class SymbolicSemanticActionPrimitiveSet(IntEnum):
4040

4141

4242
class SymbolicSemanticActionPrimitives(StarterSemanticActionPrimitives):
43-
def __init__(self, env):
44-
super().__init__(env)
43+
def __init__(self, env, robot):
44+
super().__init__(env, robot, skip_curobo_initilization=True)
4545
self.controller_functions = {
4646
SymbolicSemanticActionPrimitiveSet.GRASP: self._grasp,
4747
SymbolicSemanticActionPrimitiveSet.PLACE_ON_TOP: self._place_on_top,
@@ -59,12 +59,12 @@ def __init__(self, env):
5959
SymbolicSemanticActionPrimitiveSet.RELEASE: self._release,
6060
}
6161

62-
def apply_ref(self, prim, *args, attempts=3):
62+
def apply_ref(self, primitive, *args, attempts=3):
6363
"""
6464
Yields action for robot to execute the primitive with the given arguments.
6565
6666
Args:
67-
prim (SymbolicSemanticActionPrimitiveSet): Primitive to execute
67+
primitive (SymbolicSemanticActionPrimitiveSet): Primitive to execute
6868
args: Arguments for the primitive
6969
attempts (int): Number of attempts to make before raising an error
7070
@@ -75,7 +75,7 @@ def apply_ref(self, prim, *args, attempts=3):
7575
ActionPrimitiveError: If primitive fails to execute
7676
"""
7777
assert attempts > 0, "Must make at least one attempt"
78-
ctrl = self.controller_functions[prim]
78+
ctrl = self.controller_functions[primitive]
7979

8080
if any(isinstance(arg, BaseRobot) for arg in args):
8181
raise ActionPrimitiveErrorGroup(

omnigibson/configs/fetch_primitives.yaml renamed to omnigibson/configs/r1_primitives.yaml

+58-12
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ env:
66
flatten_action_space: false # (bool): whether to flatten the action space as a sinle 1D-array
77
flatten_obs_space: false # (bool): whether the observation space should be flattened when generated
88
use_external_obs: false # (bool): Whether to use external observations or not
9-
initial_pos_z_offset: 0.1
109
external_sensors: null # (None or list): If specified, list of sensor configurations for external sensors to add. Should specify sensor "type" and any additional kwargs to instantiate the sensor. Each entry should be the kwargs passed to @create_sensor, in addition to position, orientation
1110

1211
render:
@@ -31,36 +30,83 @@ scene:
3130
include_robots: false
3231

3332
robots:
34-
- type: Fetch
33+
- type: R1
3534
obs_modalities: [rgb]
3635
scale: 1.0
3736
self_collisions: true
3837
action_normalize: false
3938
action_type: continuous
4039
grasping_mode: sticky
41-
default_arm_pose: diagonal30
40+
reset_joint_pos: [
41+
0.0000,
42+
-0.0000,
43+
0.0247,
44+
0.0009,
45+
0.0004,
46+
-0.0000,
47+
0.0000,
48+
0.0000,
49+
0.0000,
50+
0.0000,
51+
-0.0464,
52+
0.0464,
53+
2.6172,
54+
2.6168,
55+
-1.4584,
56+
-1.4570,
57+
-0.0433,
58+
0.0418,
59+
1.5899,
60+
-1.5896,
61+
-1.1587,
62+
1.1593,
63+
0.0300,
64+
0.0300,
65+
0.0300,
66+
0.0300,
67+
]
68+
sensor_config:
69+
VisionSensor:
70+
sensor_kwargs:
71+
image_height: 128
72+
image_width: 128
4273
controller_config:
4374
base:
44-
name: DifferentialDriveController
75+
name: HolonomicBaseJointController
76+
motor_type: position
77+
command_input_limits: null
78+
use_impedances: false
4579
trunk:
4680
name: JointController
47-
arm_0:
81+
motor_type: position
82+
command_input_limits: null
83+
use_delta_commands: false
84+
use_impedances: false
85+
arm_left:
86+
name: JointController
87+
motor_type: position
88+
command_input_limits: null
89+
use_delta_commands: false
90+
use_impedances: false
91+
arm_right:
4892
name: JointController
49-
subsume_controllers: [trunk]
5093
motor_type: position
5194
command_input_limits: null
5295
use_delta_commands: false
53-
gripper_0:
96+
use_impedances: false
97+
gripper_left:
5498
name: JointController
5599
motor_type: position
56-
command_input_limits: [-1, 1]
57-
command_output_limits: null
100+
command_input_limits: null
58101
use_delta_commands: false
59-
camera:
102+
use_impedances: false
103+
gripper_right:
60104
name: JointController
61-
use_delta_commands: False
105+
motor_type: position
106+
command_input_limits: null
107+
use_delta_commands: false
108+
use_impedances: false
62109

63110
objects: []
64-
65111
task:
66112
type: DummyTask

omnigibson/configs/tiago_primitives.yaml

+48-11
Original file line numberDiff line numberDiff line change
@@ -32,51 +32,88 @@ scene:
3232

3333
robots:
3434
- type: Tiago
35-
obs_modalities: [rgb, depth, seg_semantic, normal, seg_instance, seg_instance_id]
35+
obs_modalities: [rgb]
3636
scale: 1.0
3737
self_collisions: true
3838
action_normalize: false
3939
action_type: continuous
4040
grasping_mode: sticky
41-
default_arm_pose: vertical
41+
reset_joint_pos: [
42+
0.0000,
43+
0.0000,
44+
-0.0000,
45+
-0.0000,
46+
-0.0000,
47+
-0.0000,
48+
0.3500,
49+
0.9052,
50+
0.9052,
51+
0.0000,
52+
-0.4281,
53+
-0.4281,
54+
-0.4500,
55+
2.2350,
56+
2.2350,
57+
1.6463,
58+
1.6463,
59+
0.7687,
60+
0.7687,
61+
-0.7946,
62+
-0.7946,
63+
-1.0891,
64+
-1.0891,
65+
0.0450,
66+
0.0450,
67+
0.0450,
68+
0.0450,
69+
]
4270
sensor_config:
4371
VisionSensor:
4472
sensor_kwargs:
4573
image_height: 128
4674
image_width: 128
4775
controller_config:
4876
base:
49-
name: JointController
77+
name: HolonomicBaseJointController
78+
motor_type: position
79+
command_input_limits: null
80+
use_impedances: false
5081
trunk:
5182
name: JointController
83+
motor_type: position
84+
command_input_limits: null
85+
use_delta_commands: false
86+
use_impedances: false
5287
arm_left:
5388
name: JointController
54-
subsume_controllers: [trunk]
5589
motor_type: position
5690
command_input_limits: null
57-
command_output_limits: null
5891
use_delta_commands: false
92+
use_impedances: False
5993
arm_right:
6094
name: JointController
6195
motor_type: position
6296
command_input_limits: null
63-
command_output_limits: null
6497
use_delta_commands: false
98+
use_impedances: false
6599
gripper_left:
66100
name: JointController
67101
motor_type: position
68-
command_input_limits: [-1, 1]
69-
command_output_limits: null
102+
command_input_limits: null
70103
use_delta_commands: false
104+
use_impedances: false
71105
gripper_right:
72106
name: JointController
73107
motor_type: position
74-
command_input_limits: [-1, 1]
75-
command_output_limits: null
108+
command_input_limits: null
76109
use_delta_commands: false
110+
use_impedances: false
77111
camera:
78112
name: JointController
79-
113+
motor_type: position
114+
command_input_limits: null
115+
use_delta_commands: false
116+
use_impedances: false
80117
objects: []
81118

82119
task:

omnigibson/controllers/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
ManipulationController,
1010
)
1111
from omnigibson.controllers.dd_controller import DifferentialDriveController
12+
from omnigibson.controllers.holonomic_base_joint_controller import HolonomicBaseJointController
1213
from omnigibson.controllers.ik_controller import InverseKinematicsController
1314
from omnigibson.controllers.joint_controller import JointController
1415
from omnigibson.controllers.multi_finger_gripper_controller import MultiFingerGripperController
@@ -39,6 +40,7 @@ def create_controller(name, **kwargs):
3940
"create_controller",
4041
"DifferentialDriveController",
4142
"GripperController",
43+
"HolonomicBaseJointController",
4244
"InverseKinematicsController",
4345
"IsGraspingState",
4446
"JointController",

0 commit comments

Comments
 (0)