Skip to content

Commit

Permalink
Added height offset to remove&replace lids
Browse files Browse the repository at this point in the history
  • Loading branch information
Dozgulbas committed May 3, 2024
1 parent f27c217 commit cedee65
Showing 1 changed file with 32 additions and 6 deletions.
38 changes: 32 additions & 6 deletions src/platecrane_rest_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ def do_action(action_handle: str, action_vars):
print("Target location: " + str(target))
plate_type = action_args.get("plate_type", "96_well")
print("Plate type: " + str(target))
height_offset = action_args.get("height_offset", 0)
print("Height Offset: " + str(height_offset))

if action_handle == "transfer":
print("Starting the transfer request")
Expand All @@ -229,9 +231,6 @@ def do_action(action_handle: str, action_vars):
print("Please provide source and target transfer types!")
state = ModuleStatus.ERROR

height_offset = action_args.get("height_offset", 0)
print("Height Offset: " + str(height_offset))

try:
platecrane.transfer(
source,
Expand All @@ -252,9 +251,15 @@ def do_action(action_handle: str, action_vars):
state = ModuleStatus.IDLE
print("Finished Action: " + action_handle.upper())
return response

elif action_handle == "remove_lid":
try:
platecrane.remove_lid(source=source, target=target, plate_type=plate_type)
platecrane.remove_lid(
source=source,
target=target,
plate_type=plate_type,
height_offset=height_offset,
)
except Exception as err:
response.action_response = StepStatus.FAILED
response.action_log = "Remove lid failed. Error:" + str(err)
Expand All @@ -266,17 +271,38 @@ def do_action(action_handle: str, action_vars):
state = ModuleStatus.IDLE
print("Finished Action: " + action_handle.upper())
return response

elif action_handle == "replace_lid":
try:
platecrane.replace_lid(source=source, target=target, plate_type=plate_type)
platecrane.replace_lid(
source=source,
target=target,
plate_type=plate_type,
height_offset=height_offset,
)
except Exception as err:
response.action_response = StepStatus.FAILED
response.action_log = "Replace lid failed. Error:" + str(err)
print(str(err))
state = ModuleStatus.ERROR
else:
response.action_response = StepStatus.SUCCEEDED
response.action_msg = "Replace lid successfully completed"
response.action_msg = "Replace lid successfully completed"
state = ModuleStatus.IDLE
print("Finished Action: " + action_handle.upper())
return response

elif action_handle == "move_safe":
try:
platecrane.move_location("Safe")
except Exception as err:
response.action_response = StepStatus.FAILED
response.action_log = "Move Safe Failed. Error:" + str(err)
print(str(err))
state = ModuleStatus.ERROR
else:
response.action_response = StepStatus.SUCCEEDED
response.action_msg = "Move Safe successfully completed"
state = ModuleStatus.IDLE
print("Finished Action: " + action_handle.upper())
return response
Expand Down

0 comments on commit cedee65

Please sign in to comment.