You can from a daemon or thread monitor an input, and given this input toggles to a defined state, you can send a program to the controller that instructs the robot to stay in freedrive mode, such as:
def start_freedrive():
freedrive_mode()
while(True):
sync()
end
end
Since freedrive would be terminated, as soon as the program would stop, you cannot just send a single line, in which case the robot would only be in freedrive for a few milliseconds.
When the button is released, you need to terminate this program, e.g. by sending halt
or end_freedrive_mode()
1 Like