Skip to content

Commit 2c8fa03

Browse files
committed
fix(pybullet): use live link frame for link-attached rigid bodies
Use PyBullet link frames for attached_to_link rigid body updates so runtime/world transforms are respected. Prevents attached rigid bodies from appearing offset or floating in GUI and collision checks.
1 parent 758974b commit 2c8fa03

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/compas_fab/backends/pybullet/backend_features/pybullet_set_robot_cell_state.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,12 @@ def set_robot_cell_state(self, robot_cell_state: RobotCellState):
136136
continue
137137
# If rigid body is attached to a link, update the rigid body's base frame using the link's FK frame
138138
link_name = rigid_body_state.attached_to_link
139-
robot_configuration = robot_cell_state.robot_configuration
140-
link_frame = client.robot_model.forward_kinematics(robot_configuration, link_name)
139+
# IMPORTANT: use the live planner/PyBullet link frame so mobile-base
140+
# world pose and all runtime transforms are included. Using only
141+
# robot_model.forward_kinematics can yield a frame in model coordinates
142+
# (base at origin), which makes attached rigid bodies appear offset/floating.
143+
pcf_link_id = client.robot_link_puids[link_name]
144+
link_frame = client._get_link_frame(pcf_link_id, client.robot_puid)
141145
attachment_frame = rigid_body_state.attachment_frame
142146

143147
# Compute the RB position with its attachment frame relative to the link frame

0 commit comments

Comments
 (0)