Skip to content

Commit

Permalink
pybullet FK should not accept group
Browse files Browse the repository at this point in the history
  • Loading branch information
yck011522 committed Nov 8, 2024
1 parent 84cbf3e commit ccae36c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
# This is a simple robot cell with only the robot
planner.set_robot_cell(robot_cell)

configuration = Configuration.from_revolute_values([-2.238, -1.153, -2.174, 0.185, 0.667, 0.0])
robot_cell_state.robot_configuration = configuration
robot_cell_state.robot_configuration.joint_values = [-2.238, -1.153, -2.174, 0.185, 0.667, 0.0]

# In this demo, the default planning group is used for the forward kinematics
frame_WCF = planner.forward_kinematics(robot_cell_state, TargetMode.ROBOT)

Expand All @@ -36,4 +36,4 @@
# ---------------------------------
for link_name in robot_cell.get_link_names():
frame_WCF = planner.forward_kinematics_to_link(robot_cell_state, link_name)
print("Frame of link '{}' : {}".format((link_name, frame_WCF)))
print("Frame of link '{}' : {}".format(link_name, frame_WCF))
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ def forward_kinematics(self, robot_cell_state, target_mode, group=None, native_s

return target_frame

def forward_kinematics_to_link(self, robot_cell_state, link_name=None, group=None, native_scale=None, options=None):
# type: (RobotCellState, Optional[str], Optional[str], Optional[float], Optional[dict]) -> Frame
def forward_kinematics_to_link(self, robot_cell_state, link_name=None, native_scale=None, options=None):
# type: (RobotCellState, Optional[str], Optional[float], Optional[dict]) -> Frame
"""Calculate the frame of the specified robot link from the provided RobotCellState.
This function operates similar to :meth:`compas_fab.backends.PyBulletForwardKinematics.forward_kinematics`,
Expand All @@ -123,9 +123,6 @@ def forward_kinematics_to_link(self, robot_cell_state, link_name=None, group=Non
link_name : str, optional
The name of the link to calculate the forward kinematics for.
Defaults to the last link of the provided planning group.
group : str, optional
The planning group of the robot.
Defaults to the robot's main planning group.
native_scale : float, optional
The scaling factor to apply to the resulting frame.
It is defined as `user_object_value * native_scale = meter_object_value`.
Expand All @@ -139,11 +136,6 @@ def forward_kinematics_to_link(self, robot_cell_state, link_name=None, group=Non
planner = self # type: PyBulletPlanner
client = planner.client # type: PyBulletClient
robot_cell = client.robot_cell # type: RobotCell
group = group or robot_cell.main_group_name

# Check if the planning group is supported by the planner
if group not in robot_cell.group_names:
raise PlanningGroupNotExistsError("Planning group '{}' is not supported by PyBullet planner.".format(group))

# Setting the entire robot cell state, including the robot configuration
planner.set_robot_cell_state(robot_cell_state)
Expand Down

0 comments on commit ccae36c

Please sign in to comment.