Skip to content

Creating pk.Robot with only specific joints (reduced_model) from full urdf. #68

Open
chaitanya1chawla wants to merge 1 commit intochungmin99:mainfrom
chaitanya1chawla:main
Open

Creating pk.Robot with only specific joints (reduced_model) from full urdf. #68
chaitanya1chawla wants to merge 1 commit intochungmin99:mainfrom
chaitanya1chawla:main

Conversation

@chaitanya1chawla
Copy link
Copy Markdown

Add a static method to create a robot with only specific joints.
First creates a reduced URDF with preserved_joint_names, and then creates a pk.Robot object using from_urdf().

Usage:

preserved_joint_names = [
# Left arm
'left_shoulder_pitch_joint',
'left_shoulder_roll_joint',
'left_shoulder_yaw_joint',
'left_elbow_joint',
'left_wrist_roll_joint',
'left_wrist_pitch_joint',
'left_wrist_yaw_joint',
# Right arm
'right_shoulder_pitch_joint',
'right_shoulder_roll_joint',
'right_shoulder_yaw_joint',
'right_elbow_joint',
'right_wrist_roll_joint',
'right_wrist_pitch_joint',
'right_wrist_yaw_joint',
# ... etc
]

original_urdf = "dexmachina/assets/g1/g1_body29_frozen_hand_mod_waist_new_arms_waist_yaw_lower_frozen.urdf" reduced_urdf_path = "dexmachina/assets/g1/robot_reduced.urdf"
reduced_robot = from_reduced_urdf(
original_urdf,
preserved_joint_names,
reduced_urdf_path
)

Add a static method to create a reduced URDF file with preserved joint names and validate the structure.

Usage:

preserved_joint_names = [
    # Left arm
    'left_shoulder_pitch_joint',
    'left_shoulder_roll_joint', 
    'left_shoulder_yaw_joint',
    'left_elbow_joint',
    'left_wrist_roll_joint',
    'left_wrist_pitch_joint',
    'left_wrist_yaw_joint',
    # Right arm
    'right_shoulder_pitch_joint',
    'right_shoulder_roll_joint',
    'right_shoulder_yaw_joint', 
    'right_elbow_joint',
    'right_wrist_roll_joint',
    'right_wrist_pitch_joint',
    'right_wrist_yaw_joint',
    # ... etc
]

original_urdf = "dexmachina/assets/g1/g1_body29_frozen_hand_mod_waist_new_arms_waist_yaw_lower_frozen.urdf"
reduced_urdf_path = "dexmachina/assets/g1/robot_reduced.urdf"
reduced_robot = create_reduced_urdf(
    original_urdf,
    preserved_joint_names,
    reduced_urdf_path
)
@chaitanya1chawla chaitanya1chawla changed the title Implement from_reduced_urdf method in _robot.py Creating pk.Robot with only specific joints (reduced_model) from full urdf. Dec 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant