User Command Task¶
Summary¶
This task provides the USB serial command-line interface for the robot. It is used to start the full course, run individual course segments, manually jog the robot, inspect bumper state, and stop all motion.
Important class¶
task_user(auto_start, course_mode, stop_request, left_go, right_go, line_enable, line_mode, base_speed, kp_inner, ki_inner, kp_line, ki_line, bump_state, setpoint_L, setpoint_R)Generator-based user-interface task.
Important methods¶
run()Main command-processing loop.
_stop()Forces the robot into a stopped state by clearing auto mode, setting the stop request, disabling line following, zeroing both wheel setpoints, and stopping both motor tasks.
_start_course_mode(mode)Starts the selected automatic course mode.
_manual_drive(left_mps, right_mps)Disables automatic behavior and directly commands left and right wheel speeds.
_print_help()Sends the command summary to the USB serial terminal.
Important state constants¶
S0_INITInitialization state.
S1_CMDMain command-processing state.
Important variables¶
self._serUSB serial interface used for command input and status output.
self._auto_startShare that tells the course task to begin running.
self._course_modeShare selecting either full-course mode or one of the individual segment test modes.
self._stop_requestShare used to request an immediate stop.
self._left_go/self._right_goShares controlling whether the left and right motor tasks are active.
self._line_enable/self._line_modeShares controlling the line-following and line-sensor behavior.
self._base_speedShare holding the nominal forward speed used during line following.
self._kp_inner/self._ki_innerInner motor-loop PI gains.
self._kp_line/self._ki_lineLine-following PI gains.
self._bump_stateLatched bumper state share shown to the user.
self._spL/self._spRLeft and right wheel setpoint shares.
Default parameters¶
During initialization, this task sets:
kp_inner = 1.6ki_inner = 8.0kp_line = 0.02ki_line = 0.001base_speed = 0.10
Supported commands¶
gStart the full automatic course.
1through6Start individual segment-test modes.
xStop the robot.
lPrint the latched front bumper state.
cClear the bumper latch.
fManual forward jog.
bManual reverse jog.
nManual left spin.
mManual right spin.
hPrint the help text again.