Lab 1 Duckiebot Setup, Calibration, and Demonstration

Lab 1 will give you instructions to build, calibrate, and run your Duckiebot. At the end of this lab, you should be able to run ROS code on your robot using your class container.

Please read all instructions in the Duckiebot documentation carefully. Some items are optional and NOT required.

Instructions

  1. Please ensure your Duckiebot battery is charged. You can plug it in now as it will not be needed until Step 6.
  2. You should already have Duckietown Shell set up correctly. If not, refer to HW1.
  3. If you are using a virtual machine, you probably need to check or change a few settings.
    1. First, change your networking settings such that you can connect to the Duckiebot. Your adapter should be set to “bridged.” Refer to this page and the lecture notes to set this correctly: https://www.virtualbox.org/manual/ch06.html
    2. Second, you likely need to install the Virtualbox Extension Pack: https://www.virtualbox.org/wiki/Downloads. Once you have installed this, go into the machine settings for your VM -> Ports tab -> USB tab and ensure the USB 3 controller is selected. This will help to flash your SD card in Step 5. This tutorial steps through the process https://www.tecmint.com/enable-usb-in-virtualbox/.
  4. Set up a duckietown account on their website. Choose the Massachusetts community. https://docs.duckietown.org/daffy/opmanual_duckiebot/out/dt_account.html
  5. Assemble your duckiebot using the link below and tips from the slides in class. Demonstrate your assembled Duckiebot to the instructor by posting a LINK TO a short video showing all sides of the bot on Slack in the #demonstrations channel. You can host the video on your student OneDrive account, Dropbox, Google Drive, or any other service. Please do NOT post the video itself on Slack as we have a limited amount of space for multimedia. Tag your instructor ( type @Paul Robinette and select the name) Also turn this video (or a link to it) in on Blackboard. Please do this even if you are borrowing a robot to verify there is no damage.
    DB18: https://docs.duckietown.org/daffy/opmanual_duckiebot/out/assembling_duckiebot_db18.html
    DB19: https://docs.duckietown.org/daffy/opmanual_duckiebot/out/assembling_duckiebot_db19.html
    You should demonstrate this step as soon as you complete it so that we can catch problems early!
  6. Now we need to initialize your duckiebot. This involves flashing data to your sd card, inserting it into the raspberry pi, and leaving it running, connected to internet, for some time. During this process, your duckiebot will download updates and new packages. Follow the instructions in this link through step 8.5 then STOP and move on to the next step in the lab
    WARNING: Be careful when you select which partition to flash to! You very likely want to select /dev/sdb, which should be exactly the size of your SD card. It is very unlikely that you want to select /dev/sda as that probably contains your root partition. This can be confusing in Linux so post on slack if you have any questions.
    https://docs.duckietown.org/daffy/opmanual_duckiebot/out/setup_duckiebot.html
    NOTE: if using a vm make sure adapter is bridged (Step 3). You will also need to share your USB SD card adapter with your VM.
    NOTE: Give your robot a unique name. (NOT “duckiebot”)
    NOTE: This step may take considerable time. It is best to start booting your robot with a FULL battery and in a location where it can be connected to the internet for several hours. It may only take 5 min, depending on internet speed. It could take a few hours.
    You will ultimately be running the commands below:

    dts init_sd_card --hostname <duckiebot_name> --wifi duckietown:quackquack,<myhomenetwork>:<myhomepassword>
    ping <duckiebot_name>.local

    (if running this from a VM and it fails, try from your host system as well).

    dts fleet discover
    ssh <duckiebot_name>

    If ssh doesn’t work, then you don’t have your ssh configured correctly. Refer to course slides to set it up properly.

  7. Your duckiebot has several tools to help you debug problems and setup configurations. The dashboard allows you to see basic information about your robot. Finish setting it up and learn about it here: https://docs.duckietown.org/daffy/opmanual_duckiebot/out/duckiebot_dashboard_setup.html
  8. The portainer interface let’s you see which Docker containers are running on your robot from a web browser. Learn about it here: https://docs.duckietown.org/daffy/opmanual_duckiebot/out/docker_setup.html
    NOTE: You have probably already done all of these steps in HW1.
  9. Now it’s time to make your robot move. NOTE: if your robot does not move forward when you press the up arrow, left when you press left, etc, then it is wired incorrectly! Review the assembly instructions again and fix it. Follow Option 1 on these instructions to make your robot move https://docs.duckietown.org/daffy/opmanual_duckiebot/out/rc_control.html
  10. At this point, it’s helpful to learn how to connect to the ROS master running on your Duckiebot. You can use dts start_gui_tools to get a terminal interface to your robot that lets you use command line ROS tools. You can also set it up so that you can connect to a GUI interface via a web browser (if in a VM, you can use a browser outside of the VM as long as you find the IP address of your VM first). Read about this interface here: https://docs.duckietown.org/daffy/opmanual_duckiebot/out/using_no_vnc.html
  11. Calibrate your camera so that your duckiebot can see the world around it. Ensure that it is in focus first by twisting the lens while looking at the initial calibration window in the instructions below until the image is sharp. https://docs.duckietown.org/daffy/opmanual_duckiebot/out/camera_calib.html
  12. Calibrate your wheels so your duckiebot can drive straight: https://docs.duckietown.org/daffy/opmanual_duckiebot/out/wheel_calibration.html
  13. Use the following instructions to create some Duckietown tiles. Pay attention to the lane sizes! You will need a ruler. For best results, you should make a loop, preferably 2 tiles by 3 tiles in size. This will be four corner tiles and two straight tiles. Post a picture of your tiles in the #demonstrations channel and tag your instructor. https://docs.duckietown.org/daffy/opmanual_duckietown/out/dt_ops_appearance_specifications.html
  14. Now let’s put it all together and start the lane following demo. We’re going to do this by manually starting a docker container on the robot and running each step by hand. At the end of these instructions, you can find a way to do it with dts tools that is simpler, but less instructive and with less feedback. To start, place your robot in a lane.
    1. Let’s see what is running on your robot first. In a terminal, run:
      $ dts start_gui_tools <duckiebot_name>

      When that starts you will have a connection to the ROS instance on the Duckiebot and can use debug tools. Run:

      $ rqt_graph

      And you should see a graph of all nodes and topics. Save an image of this graph (as legible as you can get it) to turn it in.

    2. Start keyboard control as in step 8.
    3. Open a terminal, change to your repo directory on your Linux system, and build your container on your Duckiebot using this command:
      $ dts devel build -H <duckiebot_name>.local

      This step may take some time to run the first time as it is pulling images and code onto the robot. Be patient and ask on Slack if you need any help.

    4. Start your container on your robot with:
      $ dts devel run -H <duckiebot_name>.local -s -M --cmd bash

      The -H flag tells dts to run the container on another system, in this case, the Raspberry Pi on your robot. The -s flag syncs your code to the robot. We’ll cover this in more detail in Lab 2.

    5. This should look just like your container on your computer used in HW1 and HW2. We’ll follow the same steps here. Source your environment:
      $ source /code/catkin_ws/devel/setup.bash
    6. Instead of running “catkin build” directly here, we are going to run a script created by Duckietown developers to keep the thread count low when building. This essentially runs catkin build in only two threads:
      $ dt-launcher-build
    7. Source your environment again
    8. Now start the lane following demo. This will not make your robot move until you tell it to using keyboard control (we’ll get to that in a few steps).
      $ roslaunch duckietown_demos lane_following.launch

      Wait for the messages to stop (You should see health status change to “STARTED” at the end)

    9. In your start_gui_tools terminal (Step 14a) run “rqt_graph” again. What has changed since the last time you ran it? Turn in an image of this graph as well.
    10. In keyboard control, while selecting the window, press ‘a’. The robot should now move around the track. Press ‘s’ to stop. Note that the robot does not handle intersections in this mode. Ensure that it follows lanes or recalibrate until it does.
    11. Note that you can also start the demo using the dts tools but you will not receive as much feedback: https://docs.duckietown.org/daffy/opmanual_duckiebot/out/demos.html
    12. Demonstrate lane following to your instructor by taking a video and posting a link to it in the #demonstrations channel on Slack. Tag your instructor in the post.

Submission

  1. The name of your duckiebot
  2. A video of your assembled robot showing all sides
  3. Picture(s) of your lane tiles
  4. A video of your best lane following demo run
  5. The output of rqt_graph in 14a and 14i
  6. Write a few sentences about what happens on the robot when you run lane following. Which nodes start and how are they connected to what was running on the robot before? What do you think each of these new nodes does?

NOTE: you must post links to videos and/or pictures from items 2-4 on Slack in the #demonstrations channel to receive full credit! Do this as soon as you finish each step so we can catch problems early.

Rubric

  • Demonstrations posted to Slack
    • Assembled Duckiebot: 10 points
    • Assembled tiles: 10 points
    • Video of lane following: 15 points
  • Demonstrations submitted to Blackboard:
      • Assembled Duckiebot: 10 points
      • Assembled tiles: 10 points
      • Video of lane following: 15 points
  • Graphs from steps 14a and 14i: 20 points
  • Answer to question 6 above: 10 points