robosuite.controllers.parts package#
Subpackages#
- robosuite.controllers.parts.arm package
- Submodules
- robosuite.controllers.parts.arm.ik module
InverseKinematicsController
InverseKinematicsController.compute_joint_positions()
InverseKinematicsController.control_limits
InverseKinematicsController.get_control()
InverseKinematicsController.name
InverseKinematicsController.reset_goal()
InverseKinematicsController.run_controller()
InverseKinematicsController.set_goal()
InverseKinematicsController.update_initial_joints()
- robosuite.controllers.parts.arm.osc module
OperationalSpaceController
OperationalSpaceController.compute_goal_ori()
OperationalSpaceController.compute_goal_pos()
OperationalSpaceController.control_limits
OperationalSpaceController.delta_to_abs_action()
OperationalSpaceController.goal_origin_to_eef_pose()
OperationalSpaceController.name
OperationalSpaceController.reset_goal()
OperationalSpaceController.run_controller()
OperationalSpaceController.set_goal()
OperationalSpaceController.set_goal_update_mode()
OperationalSpaceController.update_initial_joints()
OperationalSpaceController.update_origin()
OperationalSpaceController.world_to_origin_frame()
- Module contents
- robosuite.controllers.parts.generic package
- robosuite.controllers.parts.gripper package
- Submodules
- robosuite.controllers.parts.gripper.gripper_controller module
GripperController
GripperController.actuator_limits
GripperController.clip_torques()
GripperController.control_limits
GripperController.name
GripperController.nums2array()
GripperController.reset_goal()
GripperController.run_controller()
GripperController.scale_action()
GripperController.torque_compensation
GripperController.update()
GripperController.update_initial_joints()
- robosuite.controllers.parts.gripper.simple_grip module
- Module contents
- robosuite.controllers.parts.mobile_base package
- Submodules
- robosuite.controllers.parts.mobile_base.joint_vel module
- robosuite.controllers.parts.mobile_base.mobile_base_controller module
MobileBaseController
MobileBaseController.actuator_limits
MobileBaseController.clip_torques()
MobileBaseController.control_limits
MobileBaseController.get_base_pose()
MobileBaseController.name
MobileBaseController.nums2array()
MobileBaseController.reset()
MobileBaseController.reset_goal()
MobileBaseController.run_controller()
MobileBaseController.scale_action()
MobileBaseController.torque_compensation
MobileBaseController.update()
MobileBaseController.update_initial_joints()
- Module contents
Submodules#
robosuite.controllers.parts.controller module#
- class robosuite.controllers.parts.controller.Controller(sim, joint_indexes, actuator_range, ref_name=None, part_name=None, naming_prefix=None, lite_physics=True)#
Bases:
object
General controller interface.
Requires reference to mujoco sim object, ref_name of specific robot, relevant joint_indexes to that robot, and whether an initial_joint is used for nullspace torques or not
- Parameters:
sim (MjSim) – Simulator instance this controller will pull robot state updates from
ref_name (str) – Name of controlled robot arm’s end effector (from robot XML)
joint_indexes (dict) –
Each key contains sim reference indexes to relevant robot joint information, namely:
- ’joints’:
list of indexes to relevant robot joints
- ’qpos’:
list of indexes to relevant robot joint positions
- ’qvel’:
list of indexes to relevant robot joint velocities
actuator_range (2-tuple of array of float) – 2-Tuple (low, high) representing the robot joint actuator range
lite_physics (bool) – Whether to optimize for mujoco forward and step calls to reduce total simulation overhead. Ignores all self.update() calls, unless set to force=True Set to False to preserve backward compatibility with datasets collected in robosuite <= 1.4.1.
- property actuator_limits#
Torque limits for this controller
- Returns:
(np.array) minimum actuator torques
(np.array) maximum actuator torques
- Return type:
2-tuple
- clip_torques(torques)#
Clips the torques to be within the actuator limits
- Parameters:
torques (Iterable) – Torques to clip
- Returns:
Clipped torques
- Return type:
np.array
- property control_limits#
Limits over this controller’s action space, which defaults to input min/max
- Returns:
(np.array) minimum action values
(np.array) maximum action values
- Return type:
2-tuple
- property name#
Name of this controller
- Returns:
controller name
- Return type:
str
- static nums2array(nums, dim)#
Convert input @nums into numpy array of length @dim. If @nums is a single number, broadcasts it to the corresponding dimension size @dim before converting into a numpy array
- Parameters:
nums (numeric or Iterable) – Either single value or array of numbers
dim (int) – Size of array to broadcast input to env.sim.data.actuator_force
- Returns:
Array filled with values specified in @nums
- Return type:
np.array
- reset_goal()#
Resets the goal – usually by setting to the goal to all zeros, but in some cases may be different (e.g.: OSC)
- abstract run_controller()#
Abstract method that should be implemented in all subclass controllers, and should convert a given action into torques (pre gravity compensation) to be executed on the robot. Additionally, resets the self.new_update flag so that the next self.update call will occur
- scale_action(action)#
Clips @action to be within self.input_min and self.input_max, and then re-scale the values to be within the range self.output_min and self.output_max
- Parameters:
action (Iterable) – Actions to scale
- Returns:
Re-scaled action
- Return type:
np.array
- property torque_compensation#
Gravity compensation for this robot arm
- Returns:
torques
- Return type:
np.array
- update(force=False)#
Updates the state of the robot arm, including end effector pose / orientation / velocity, joint pos/vel, jacobian, and mass matrix. By default, since this is a non-negligible computation, multiple redundant calls will be ignored via the self.new_update attribute flag. However, if the @force flag is set, the update will occur regardless of that state of self.new_update. This base class method of @run_controller resets the self.new_update flag
- Parameters:
force (bool) – Whether to force an update to occur or not
- update_initial_joints(initial_joints)#
Updates the internal attribute self.initial_joints. This is useful for updating changes in controller-specific behavior, such as with OSC where self.initial_joints is used for determine nullspace actions
This function can also be extended by subclassed controllers for additional controller-specific updates
- Parameters:
initial_joints (Iterable) – Array of joint position values to update the initial joints
- update_origin(origin_pos, origin_ori)#
Optional function to implement in subclass controllers that will take in @origin_pos and @origin_ori and update internal configuration to account for changes in the respective states. Useful for controllers in which the origin is a frame of reference that is dynamically changing, e.g., adapting the arm to move along with a moving base.
- Parameters:
origin_pos (3-tuple) – x,y,z position of controller reference in mujoco world coordinates
origin_ori (np.array) – 3x3 rotation matrix orientation of controller reference in mujoco world coordinates
- update_reference_data()#
robosuite.controllers.parts.controller_factory module#
Set of functions that streamline controller initialization process
- robosuite.controllers.parts.controller_factory.arm_controller_factory(name, params)#
Generator for controllers
Creates a Controller instance with the provided @name and relevant @params.
- Parameters:
name (str) – the name of the controller. Must be one of: {JOINT_POSITION, JOINT_TORQUE, JOINT_VELOCITY, OSC_POSITION, OSC_POSE, IK_POSE}
params (dict) – dict containing the relevant params to pass to the controller
sim (MjSim) – Mujoco sim reference to pass to the controller
- Returns:
Controller instance
- Return type:
- Raises:
ValueError – [unknown controller]
- robosuite.controllers.parts.controller_factory.controller_factory(part_name, controller_type, controller_params)#
- robosuite.controllers.parts.controller_factory.gripper_controller_factory(name, params)#
- robosuite.controllers.parts.controller_factory.head_controller_factory(name, params)#
- robosuite.controllers.parts.controller_factory.legs_controller_factory(name, params)#
- robosuite.controllers.parts.controller_factory.load_part_controller_config(custom_fpath=None, default_controller=None)#
Utility function that loads the desired controller and returns the loaded configuration as a dict
If @default_controller is specified, any value inputted to @custom_fpath is overridden and the default controller configuration is automatically loaded. See specific arg description below for available default controllers.
- Parameters:
custom_fpath (str) – Absolute filepath to the custom controller configuration .json file to be loaded
default_controller (str) – If specified, overrides @custom_fpath and loads a default configuration file for the specified controller. Choices are: {“JOINT_POSITION”, “JOINT_TORQUE”, “JOINT_VELOCITY”, “OSC_POSITION”, “OSC_POSE”, “IK_POSE”}
- Returns:
Controller configuration
- Return type:
dict
- Raises:
AssertionError – [Unknown default controller name]
AssertionError – [No controller specified]
- robosuite.controllers.parts.controller_factory.mobile_base_controller_factory(name, params)#
- robosuite.controllers.parts.controller_factory.torso_controller_factory(name, params)#