Skip to content

Commit

Permalink
add latest actions in composite controller
Browse files Browse the repository at this point in the history
  • Loading branch information
xieleo5 committed Nov 19, 2024
1 parent 471f0c5 commit e934bc5
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 0 deletions.
2 changes: 2 additions & 0 deletions robosuite/controllers/composite/composite_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ def __init__(self, sim: MjSim, robot_model: RobotModel, grippers: Dict[str, Grip
# task space actions (such as end effector poses) to joint actions (such as joint angles or joint torques)

self._whole_body_controller_action_split_indexes: OrderedDict = OrderedDict()
self._latest_all_joint_angle_action: Optional[np.ndarray] = None

def _init_controllers(self):
for part_name in self.part_controller_config.keys():
Expand Down Expand Up @@ -309,6 +310,7 @@ def set_goal(self, all_action):
target_qpos = self.joint_action_policy.solve(all_action[: self.joint_action_policy.control_dim])
# create new all_action vector with the IK solver's actions first
all_action = np.concatenate([target_qpos, all_action[self.joint_action_policy.control_dim :]])
self._latest_all_joint_angle_action = all_action
for part_name, controller in self.part_controllers.items():
start_idx, end_idx = self._action_split_indexes[part_name]
action = all_action[start_idx:end_idx]
Expand Down
87 changes: 87 additions & 0 deletions robosuite/controllers/config/default/composite/joint_position.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{
"type": "BASIC",
"body_parts": {
"arms": {
"right": {
"type": "JOINT_POSITION",
"input_max": 1,
"input_min": -1,
"output_max": 0.5,
"output_min": -0.5,
"kd": 200,
"kv": 200,
"kp": 1000,
"velocity_limits": [-1,1],
"kp_limits": [0, 1000],
"interpolation": null,
"ramp_ratio": 0.2,
"gripper": {
"type": "GRIP"
}
},
"left": {
"type": "JOINT_POSITION",
"input_max": 1,
"input_min": -1,
"output_max": 0.5,
"output_min": -0.5,
"kd": 200,
"kv": 200,
"kp": 1000,
"velocity_limits": [-1,1],
"kp_limits": [0, 1000],
"interpolation": null,
"ramp_ratio": 0.2,
"gripper": {
"type": "GRIP"
}
}
},
"torso": {
"type" : "JOINT_POSITION",
"input_max": 1,
"input_min": -1,
"output_max": 0.5,
"output_min": -0.5,
"kd": 200,
"kv": 200,
"kp": 1000,
"velocity_limits": [-1,1],
"kp_limits": [0, 1000],
"interpolation": null,
"ramp_ratio": 0.2
},
"head": {
"type" : "JOINT_POSITION",
"input_max": 1,
"input_min": -1,
"output_max": 0.5,
"output_min": -0.5,
"kd": 200,
"kv": 200,
"kp": 1000,
"velocity_limits": [-1,1],
"kp_limits": [0, 1000],
"interpolation": null,
"ramp_ratio": 0.2
},
"base": {
"type": "JOINT_VELOCITY",
"interpolation": "null"
},
"legs": {
"type": "JOINT_POSITION",
"input_max": 1,
"input_min": -1,
"output_max": 0.5,
"output_min": -0.5,
"kd": 200,
"kv": 200,
"kp": 1000,
"velocity_limits": [-1,1],
"kp_limits": [0, 1000],
"interpolation": null,
"ramp_ratio": 0.2
}
}
}

0 comments on commit e934bc5

Please sign in to comment.