Keyboard Control (Make it Move!)
Contents
What you will need
A correctly assembled, powered on, Duckiebot: Testing the Hardware Components
(for most methods) A functional
dtsinstallation: Duckietown Shell (dts)You can ping the Duckiebot with
ping DUCKIEBOT_NAME.local. If not: Network Configuration in Duckietown
What you will get
Keyboard control of a Duckiebot
Keyboard Control (Make it Move!)#
An easy way to make your Duckiebot move is by using the Keyboard Controller.
Fig. 54 The Keyboard Controller enables manual control of the Duckiebot.#
Attention
Before proceeding, make sure that you can ping your Duckiebot using the following command, where DUCKIEBOT_NAME is the name of your Duckiebot:
ping DUCKIEBOT_NAME.local
To open the Keyboard Controller, run the following command, where the --browser flag opens the WebGL (browser) version:
dts duckiebot keyboard_control DUCKIEBOT_NAME [--browser]
To open the Keyboard Controller, if dts is installed on the host machine, run the following command from a terminal inside the Duckietown Workspace or on the host machine:
dts duckiebot keyboard_control DUCKIEBOT_NAME
Note
This command will be delegated to the host machine if it is run inside the Duckietown Workspace.
Note
The first time a Duckietown Viewer app is run, a pop-up window may appear and request permission. Enter your password and select “(Always) Allow” to continue.
Alternatively, to open the WebGL (browser) version of the Keyboard Controller, open a terminal inside the Duckietown Workspace or on the host machine (if dts is installed on the host machine) and run:
dts duckiebot keyboard_control DUCKIEBOT_NAME --browser
Note the keys in the table below.
Key |
Function |
|---|---|
W |
Drive forwards |
S |
Drive backwards |
A |
Turn left |
D |
Turn right |
E |
Toggle the |
F |
Toggle the |
X |
Increase the |
Z |
Decrease the |
V |
Increase the |
C |
Decrease the |
Space |
Save the |
R |
Refresh the window |
T |
Open the |
Note
The F key’s function (Autopilot) requires software, such as for Lane Following, to be running.
Troubleshooting#
Troubleshooting
SYMPTOM
My Duckiebot does not move.
RESOLUTION
Before trying to use the Keyboard Controller, make sure that it is active by selecting its window.
Troubleshooting
SYMPTOM
The Keyboard Controller window is active, but my Duckiebot still does not move. After following Duckietown Postal Service (DTPS), I can see messages being sent to my Duckiebot on the DUCKIEBOT_NAME/actuator/wheels/base/pwm DTPS topic. The Components page of the Dashboard (opened by running dts duckiebot dashboard DUCKIEBOT_NAME --page robot/components) shows a red alert for the HUT.
RESOLUTION
If you have a HUT v3.1, follow Re-flashing the “HUT”.
Troubleshooting
SYMPTOM
I have re-flashed the HUT, but my Duckiebot still does not move or moves in a jerky manner. Additionally, the ToF sensor and front bumper are not detected on the Components page of the Dashboard (opened by running dts duckiebot dashboard DUCKIEBOT_NAME --page robot/components). I may also be having issues with the screen.
RESOLUTION
Disconnect the ToF sensor from the front bumper, then use the long I2C cable that originally connected the front bumper to the HUT to connect the ToF sensor directly to the same HUT port. Finally, reboot your Duckiebot. This procedure bypasses a known multiplexer issue on some front bumpers that can cause other issues with the HUT.
Troubleshooting
SYMPTOM
I have connected the ToF sensor directly to the same HUT port that the front bumper was originally connected to and rebooted my Duckiebot but it still does not move.
RESOLUTION
Make sure that the duckiebot-interface container is running by checking the Portainer page of the Dashboard (opened by running dts duckiebot dashboard DUCKIEBOT_NAME --page portainer) or by running:
docker -H DUCKIEBOT_NAME.local ps
The exact name of the container will depend on your Duckiebot’s version. If you do not see the duckiebot-interface container, update your Duckiebot by running:
dts duckiebot update DUCKIEBOT_NAME
Troubleshooting
SYMPTOM
My Duckiebot drives backwards when I command it to drive forward.
RESOLUTION
Swap the motor cable connections on the HUT.
Troubleshooting
SYMPTOM
My Duckiebot doesn’t go really straight when I command it to. At least not for long.
RESOLUTION
Perform the wheel calibration procedure: Wheel Calibration.