Skip to content

Commit 82e6a42

Browse files
committed
uncomment unused methods of mujoco_robot
1 parent a65c3e9 commit 82e6a42

File tree

1 file changed

+67
-67
lines changed

1 file changed

+67
-67
lines changed

src/physics_simulator/robot/mujoco_robot.py

Lines changed: 67 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -463,95 +463,95 @@ def apply_action(self, action):
463463
# Apply velocities if specified
464464
if joint_velocities is not None and joint_names is not None:
465465
self.set_joint_velocities(joint_velocities, joint_names, immediate=False)
466-
467-
# Forward kinematics methods
468-
469-
def fk_link(self, q: np.ndarray, link: str) -> Tuple[np.ndarray, np.ndarray]:
470-
"""Compute forward kinematics for a specific link.
466+
467+
# NOTE@Chenyu Cao: uncomment unused methods
468+
# # Forward kinematics methods
469+
# def fk_link(self, q: np.ndarray, link: str) -> Tuple[np.ndarray, np.ndarray]:
470+
# """Compute forward kinematics for a specific link.
471471

472-
Calculates the position and orientation of a link given a set of joint angles.
472+
# Calculates the position and orientation of a link given a set of joint angles.
473473

474-
Args:
475-
q: Joint angle configuration array
476-
link: Name of the target link
474+
# Args:
475+
# q: Joint angle configuration array
476+
# link: Name of the target link
477477

478-
Returns:
479-
tuple: (position, rotation_matrix) where:
480-
- position: 3D position vector of the link
481-
- rotation_matrix: 3x3 rotation matrix of the link
482-
"""
483-
return self.robot_model.fk_link(q, link)
478+
# Returns:
479+
# tuple: (position, rotation_matrix) where:
480+
# - position: 3D position vector of the link
481+
# - rotation_matrix: 3x3 rotation matrix of the link
482+
# """
483+
# return self.robot_model.fk_link(q, link)
484484

485-
def fk_all_link(self, q: np.ndarray) -> Tuple[Dict[str, np.ndarray], Dict[str, np.ndarray]]:
486-
"""Compute forward kinematics for all links in the robot.
485+
# def fk_all_link(self, q: np.ndarray) -> Tuple[Dict[str, np.ndarray], Dict[str, np.ndarray]]:
486+
# """Compute forward kinematics for all links in the robot.
487487

488-
Calculates the position and orientation of all links given a set of joint angles.
488+
# Calculates the position and orientation of all links given a set of joint angles.
489489

490-
Args:
491-
q: Joint angle configuration array
490+
# Args:
491+
# q: Joint angle configuration array
492492

493-
Returns:
494-
tuple: (positions, rotation_matrices) where:
495-
- positions: Dictionary mapping link names to 3D position vectors
496-
- rotation_matrices: Dictionary mapping link names to 3x3 rotation matrices
497-
"""
498-
return self.robot_model.fk_all_link(q)
493+
# Returns:
494+
# tuple: (positions, rotation_matrices) where:
495+
# - positions: Dictionary mapping link names to 3D position vectors
496+
# - rotation_matrices: Dictionary mapping link names to 3x3 rotation matrices
497+
# """
498+
# return self.robot_model.fk_all_link(q)
499499

500-
def fk_jacobian(self, q: np.ndarray, link: str) -> np.ndarray:
501-
"""Compute the Jacobian matrix for a specific link.
500+
# def fk_jacobian(self, q: np.ndarray, link: str) -> np.ndarray:
501+
# """Compute the Jacobian matrix for a specific link.
502502

503-
The Jacobian maps joint velocities to end-effector velocities (linear and angular).
503+
# The Jacobian maps joint velocities to end-effector velocities (linear and angular).
504504

505-
Args:
506-
q: Joint angle configuration array
507-
link: Name of the target link
505+
# Args:
506+
# q: Joint angle configuration array
507+
# link: Name of the target link
508508

509-
Returns:
510-
np.ndarray: 6xN Jacobian matrix where N is the number of joints
511-
(first 3 rows for linear velocity, last 3 for angular velocity)
512-
"""
513-
return self.robot_model.fk_jacobian(q, link)
509+
# Returns:
510+
# np.ndarray: 6xN Jacobian matrix where N is the number of joints
511+
# (first 3 rows for linear velocity, last 3 for angular velocity)
512+
# """
513+
# return self.robot_model.fk_jacobian(q, link)
514514

515-
def generate_random_qpos(self) -> np.ndarray:
516-
"""Generate a random joint configuration within joint limits.
515+
# def generate_random_qpos(self) -> np.ndarray:
516+
# """Generate a random joint configuration within joint limits.
517517

518-
Returns:
519-
np.ndarray: Random joint configuration array
520-
"""
521-
return self.robot_model.generate_random_qpos()
518+
# Returns:
519+
# np.ndarray: Random joint configuration array
520+
# """
521+
# return self.robot_model.generate_random_qpos()
522522

523-
def clip_qpos(self, q: np.ndarray) -> np.ndarray:
524-
"""Clip a joint configuration to respect joint limits.
523+
# def clip_qpos(self, q: np.ndarray) -> np.ndarray:
524+
# """Clip a joint configuration to respect joint limits.
525525

526-
Args:
527-
q: Joint configuration to clip
526+
# Args:
527+
# q: Joint configuration to clip
528528

529-
Returns:
530-
np.ndarray: Clipped joint configuration that respects joint limits
531-
"""
532-
return self.robot_model.clip_qpos(q)
529+
# Returns:
530+
# np.ndarray: Clipped joint configuration that respects joint limits
531+
# """
532+
# return self.robot_model.clip_qpos(q)
533533

534-
def get_linear_velocities(self):
535-
"""Get the linear velocities of the robot bodies.
534+
# def get_linear_velocities(self):
535+
# """Get the linear velocities of the robot bodies.
536536

537-
Returns:
538-
numpy.ndarray: Array of linear velocity vectors for each body
539-
"""
540-
body_id = self.root_body_id
537+
# Returns:
538+
# numpy.ndarray: Array of linear velocity vectors for each body
539+
# """
540+
# body_id = self.root_body_id
541541

542-
self.linear_velocity = self.data.cvel[body_id][3:].copy()
543-
return [self.linear_velocity]
542+
# self.linear_velocity = self.data.cvel[body_id][3:].copy()
543+
# return [self.linear_velocity]
544544

545-
def get_angular_velocities(self):
546-
"""Get the angular velocities of the robot bodies.
545+
# def get_angular_velocities(self):
546+
# """Get the angular velocities of the robot bodies.
547547

548-
Returns:
549-
numpy.ndarray: Array of angular velocity vectors for each body
550-
"""
551-
body_id = self.root_body_id
548+
# Returns:
549+
# numpy.ndarray: Array of angular velocity vectors for each body
550+
# """
551+
# body_id = self.root_body_id
552552

553-
self.angular_velocity = self.data.cvel[body_id][:3].copy()
554-
return [self.angular_velocity]
553+
# self.angular_velocity = self.data.cvel[body_id][:3].copy()
554+
# return [self.angular_velocity]
555555

556556
# TODO@Chenyu: Add articulation controller
557557
def get_articulation_controller(self):

0 commit comments

Comments
 (0)