Make gripper_open_degree a config param (#379)
This commit is contained in:
@@ -26,7 +26,6 @@ URL_TEMPLATE = (
|
|||||||
# In nominal degree range ]-180, +180[
|
# In nominal degree range ]-180, +180[
|
||||||
ZERO_POSITION_DEGREE = 0
|
ZERO_POSITION_DEGREE = 0
|
||||||
ROTATED_POSITION_DEGREE = 90
|
ROTATED_POSITION_DEGREE = 90
|
||||||
GRIPPER_OPEN_DEGREE = 35.156
|
|
||||||
|
|
||||||
|
|
||||||
def assert_drive_mode(drive_mode):
|
def assert_drive_mode(drive_mode):
|
||||||
@@ -165,6 +164,11 @@ class KochRobotConfig:
|
|||||||
follower_arms: dict[str, MotorsBus] = field(default_factory=lambda: {})
|
follower_arms: dict[str, MotorsBus] = field(default_factory=lambda: {})
|
||||||
cameras: dict[str, Camera] = field(default_factory=lambda: {})
|
cameras: dict[str, Camera] = field(default_factory=lambda: {})
|
||||||
|
|
||||||
|
# Optionally set the leader arm in torque mode with the gripper motor set to this angle. This makes it
|
||||||
|
# possible to squeeze the gripper and have it spring back to an open position on its own. If None, the
|
||||||
|
# gripper is not put in torque mode.
|
||||||
|
gripper_open_degree: float | None = None
|
||||||
|
|
||||||
|
|
||||||
class KochRobot:
|
class KochRobot:
|
||||||
# TODO(rcadene): Implement force feedback
|
# TODO(rcadene): Implement force feedback
|
||||||
@@ -339,11 +343,12 @@ class KochRobot:
|
|||||||
print(f"Activating torque on {name} follower arm.")
|
print(f"Activating torque on {name} follower arm.")
|
||||||
self.follower_arms[name].write("Torque_Enable", 1)
|
self.follower_arms[name].write("Torque_Enable", 1)
|
||||||
|
|
||||||
# Enable torque on the gripper of the leader arms, and move it to 45 degrees,
|
if self.config.gripper_open_degree is not None:
|
||||||
# so that we can use it as a trigger to close the gripper of the follower arms.
|
# Set the leader arm in torque mode with the gripper motor set to an angle. This makes it possible
|
||||||
for name in self.leader_arms:
|
# to squeeze the gripper and have it spring back to an open position on its own.
|
||||||
self.leader_arms[name].write("Torque_Enable", 1, "gripper")
|
for name in self.leader_arms:
|
||||||
self.leader_arms[name].write("Goal_Position", GRIPPER_OPEN_DEGREE, "gripper")
|
self.leader_arms[name].write("Torque_Enable", 1, "gripper")
|
||||||
|
self.leader_arms[name].write("Goal_Position", self.config.gripper_open_degree, "gripper")
|
||||||
|
|
||||||
# Connect the cameras
|
# Connect the cameras
|
||||||
for name in self.cameras:
|
for name in self.cameras:
|
||||||
|
|||||||
@@ -37,3 +37,6 @@ cameras:
|
|||||||
fps: 30
|
fps: 30
|
||||||
width: 640
|
width: 640
|
||||||
height: 480
|
height: 480
|
||||||
|
# Sets the leader arm in torque mode with the gripper motor set to this angle. This makes it possible
|
||||||
|
# to squeeze the gripper and have it spring back to an open position on its own.
|
||||||
|
gripper_open_degree: 35.156
|
||||||
|
|||||||
Reference in New Issue
Block a user