Skip to content

Commit a2ec2a0

Browse files
committed
Updated motion profiles with approach return movements
1 parent 6ae98a2 commit a2ec2a0

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

src/pf400_interface/pf400.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -884,19 +884,24 @@ def _handle_approach_location(self, approach: LocationArgument) -> None:
884884
profile=self.fast_motion_profile,
885885
)
886886

887-
def _handle_approach_return(self, approach: LocationArgument) -> None:
887+
def _handle_approach_return(
888+
self, approach: LocationArgument, default_motion: Optional[str] = None
889+
) -> None:
888890
"""
889891
Handle returning from an approach location, whether single or multiple.
890892
Uses straight motion profile for the first approach location (closest to target),
891893
and fast motion profile for remaining approach locations.
892894
"""
893895
if isinstance(approach.representation[0], list):
894896
for index, location in enumerate(reversed(approach.representation)):
895-
motion_profile = (
896-
self.straight_motion_profile
897-
if index == 0
898-
else self.fast_motion_profile
899-
)
897+
if index == 0:
898+
motion_profile = self.straight_motion_profile
899+
else:
900+
motion_profile = (
901+
default_motion
902+
if default_motion is not None
903+
else self.fast_motion_profile
904+
)
900905
self.move_joint(
901906
target_joint_angles=location,
902907
profile=motion_profile,
@@ -1013,7 +1018,9 @@ def pick_plate(
10131018
)
10141019

10151020
if source_approach:
1016-
self._handle_approach_return(source_approach)
1021+
self._handle_approach_return(
1022+
approach=source_approach, default_motion=self.slow_motion_profile
1023+
)
10171024
else:
10181025
self.move_all_joints_neutral(source.representation)
10191026

@@ -1093,7 +1100,9 @@ def place_plate(
10931100
)
10941101

10951102
if target_approach:
1096-
self._handle_approach_return(target_approach)
1103+
self._handle_approach_return(
1104+
approach=target_approach, default_motion=self.fast_motion_profile
1105+
)
10971106
else:
10981107
self.move_all_joints_neutral(target.representation)
10991108

0 commit comments

Comments
 (0)