Skip to content

Commit 6f03dd4

Browse files
Added example for force option of RobotWebSession.take_control.
Co-authored-by: Albert Li <alberthli@caltech.edu>
1 parent 129c78d commit 6f03dd4

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -850,8 +850,18 @@ A typical automated workflow could look like this:
850850
import franky
851851

852852
with franky.RobotWebSession("172.16.0.2", "username", "password") as robot_web_session:
853-
# First take control, in case some other web session is currently running
854-
assert robot_web_session.take_control(), "Control not granted"
853+
# First take control
854+
try:
855+
# Try taking control. The session currently holding control has to release it in order for this session to gain
856+
# control. In the web interface, a notification will show prompting the user to release control. If the other
857+
# session is another franky.RobotWebSession, then the `release_control` method can be called on the other
858+
# session to release control.
859+
robot_web_session.take_control(wait_timeout=10.0)
860+
except franky.TakeControlTimeoutError:
861+
# If nothing happens for 10s, we try to take control forcefully. This is particularly useful if the session
862+
# holding control is dead. Taking control by force requires the user to manually push the blue button close to
863+
# the robot's wrist.
864+
robot_web_session.take_control(wait_timeout=30.0, force=True)
855865

856866
# Unlock the brakes
857867
robot_web_session.unlock_brakes()

0 commit comments

Comments
 (0)