Skip to content

Commit

Permalink
Pre commit fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Dozgulbas committed Jan 24, 2025
1 parent 0a17055 commit 0bc12bc
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 40 deletions.
51 changes: 27 additions & 24 deletions src/pf400_driver/pf400_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -815,48 +815,50 @@ def move_all_joints_neutral(self, target_location=None):
self.move_rails_neutral(target_location[0], target_location[5])

def remove_lid(
self,
self,
source_loc: list,
target_loc: list,
lid_height: float = 7.0,
lid_height: float = 7.0,
source_approach: list = None,
target_approach: list = None,
source_plate_rotation: str = "",
target_plate_rotation: str = "",
):
):
"""Remove the lid from the plate"""
source_loc = copy.deepcopy(source_loc)
source_loc[0] += lid_height

self.transfer(source_loc=source_loc,
target_loc=target_loc,
source_approach=source_approach,
target_approach=target_approach,
source_plate_rotation=source_plate_rotation,
target_plate_rotation=target_plate_rotation
)
self.transfer(
source_loc=source_loc,
target_loc=target_loc,
source_approach=source_approach,
target_approach=target_approach,
source_plate_rotation=source_plate_rotation,
target_plate_rotation=target_plate_rotation,
)

def replace_lid(
self,
source_loc: list,
target_loc: list,
lid_height: float = 7.0,
lid_height: float = 7.0,
source_approach: list = None,
target_approach: list = None,
source_plate_rotation: str = "",
target_plate_rotation: str = "",
):
):
"""Replace the lid on the plate"""
target_loc = copy.deepcopy(target_loc)
target_loc[0] += lid_height

self.transfer(source_loc=source_loc,
target_loc=target_loc,
source_approach=source_approach,
target_approach=target_approach,
source_plate_rotation=source_plate_rotation,
target_plate_rotation=target_plate_rotation
)
self.transfer(
source_loc=source_loc,
target_loc=target_loc,
source_approach=source_approach,
target_approach=target_approach,
source_plate_rotation=source_plate_rotation,
target_plate_rotation=target_plate_rotation,
)

def rotate_plate_on_deck(self, rotation_degree: int):
"""
Expand Down Expand Up @@ -1046,7 +1048,7 @@ def transfer(
plate_source_rotation = 0
self.plate_width = self.gripper_open_narrow
self.set_gripper_open()

source = self.check_incorrect_plate_orientation(source, plate_source_rotation)

self.force_initialize_robot()
Expand All @@ -1060,19 +1062,19 @@ def transfer(
self.move_all_joints_neutral()
sleep(5)
raise Exception("Transfer failed: no plate detected after picking.")

if target_plate_rotation.lower() == "wide":
plate_target_rotation = 90
self.plate_width = self.gripper_open_wide
self.set_gripper_open()

elif target_plate_rotation.lower() == "narrow" or target_plate_rotation == "":
plate_target_rotation = 0
self.plate_width = self.gripper_open_narrow
self.set_gripper_open()

target = self.check_incorrect_plate_orientation(target, plate_target_rotation)

if plate_source_rotation == 90 and plate_target_rotation == 0:
# Need a transition from 90 degree to 0 degree
self.rotate_plate_on_deck(-plate_source_rotation)
Expand All @@ -1085,6 +1087,7 @@ def transfer(
target_location=target, target_approach_locations=target_approach
)


if __name__ == "__main__":
# from pf400_driver.pf400_driver import PF400
robot = PF400()
Expand Down
34 changes: 18 additions & 16 deletions src/pf400_rest_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,14 +307,15 @@ def remove_lid(
"""Remove a lid from a plate"""
sleep(0.3)
state.action_start = datetime.datetime.now()
state.pf400.remove_lid(source_loc = source,
target_loc= target,
lid_height = lid_height,
source_approach = source_approach,
target_approach = target_approach,
source_plate_rotation = source_plate_rotation,
target_plate_rotation= target_plate_rotation
)
state.pf400.remove_lid(
source_loc=source,
target_loc=target,
lid_height=lid_height,
source_approach=source_approach,
target_approach=target_approach,
source_plate_rotation=source_plate_rotation,
target_plate_rotation=target_plate_rotation,
)
state.action_start = None
return StepResponse.step_succeeded()

Expand Down Expand Up @@ -342,14 +343,15 @@ def replace_lid(
"""Replace a lid on a plate"""
sleep(0.3)
state.action_start = datetime.datetime.now()
state.pf400.replace_lid(source_loc = source,
target_loc= target,
lid_height = lid_height,
source_approach = source_approach,
target_approach = target_approach,
source_plate_rotation = source_plate_rotation,
target_plate_rotation= target_plate_rotation
)
state.pf400.replace_lid(
source_loc=source,
target_loc=target,
lid_height=lid_height,
source_approach=source_approach,
target_approach=target_approach,
source_plate_rotation=source_plate_rotation,
target_plate_rotation=target_plate_rotation,
)
state.action_start = None
return StepResponse.step_succeeded()

Expand Down

0 comments on commit 0bc12bc

Please sign in to comment.