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.

NOTE: Students enrolled in EECE.4560 only need to complete PART I. Students enrolled in EECE.5560 will need to complete PART I and PART II of the lab.

BEFORE STARTING BELOW: Complete the Qualtrics survey in the Lab 1 instructions. This is to get networking set up for your laptop to connect to the Duckiebot.

Instructions

PART I

  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.” If you use VirtualBox, refer to this page and the lecture notes to set this correctly: https://www.virtualbox.org/manual/ch06.html
    2. Second, if using Virtualbox, 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. If you haven’t already, set up a duckietown account on their website. Choose the Massachusetts community. https://docs.duckietown.com/daffy/opmanual-duckiebot/setup/setup_account/duckietown_accounts.html
  5. Assemble your duckiebot using the link below and tips from the slides in class.
    DB21M: https://docs.duckietown.com/daffy/opmanual-duckiebot/assembly/db21m/index.html
    DB21J: https://docs.duckietown.com/daffy/opmanual-duckiebot/assembly/db21j/index.html
  6. Now we need to initialize your duckiebot. This involves flashing data to your sd card.
    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 (except on the lab desktops) as that probably contains your root partition. This can be confusing in Linux so post on slack or ask in person if you have any questions. It may be best to start this step in the lab (just make sure you have enough time for it to run).
    https://docs.duckietown.com/daffy/opmanual-duckiebot/setup/setup_sd_card/index.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: See email for specific command to setup networking correctly.
  7. Install the SD card into your Duckiebot and boot it following these instructions:
    https://docs.duckietown.com/daffy/opmanual-duckiebot/setup/setup_boot/index.html
    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.
  8. 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.com/daffy/opmanual-duckiebot/setup/setup_dashboard/index.html
  9. Go through the Operations instructions starting at the link below and going through Wheel Calibration. You do NOT need to take a log (the last operation step), but it will not hurt if you do.
    https://docs.duckietown.com/daffy/opmanual-duckiebot/operations/handling/db21.html
  10. (Optional) 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 or bigger. This will be four corner tiles and two straight tiles.
    https://docs.duckietown.com/daffy/opmanual-duckietown/intro.html#book
  11. 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 --pull

      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. If this step hangs for too long (>15 min) or your Duckiebot crashes, try running this before the above command:

      !!!OPTIONAL COMMAND BELOW!!!

      $ docker pull duckietown/dt-core:daffy
    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 Nvidia Jetson 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. Build your workspace
      $ catkin 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 11a) 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.com/daffy/opmanual-duckiebot/demos/supported/lane_following.html
    12. Demonstrate lane following to your instructor or TA in class or office hours before the due date.

PART II (EECE.5560 ONLY)

  1. Start your robot but do not start the lane following demo.
  2. Look at the topics running on the robot. Pay special attention to the topics that move the wheels. Use rqt_graph and the rostopic tools to investigate.
  3. Find a topic and message type that make the wheels move. There are a few options here. Use the rostopic pub tool to move the wheels using the topic and message you found. Any topic that results in moving the wheels is acceptable.
    1. Which topic did you use?
    2. What message makes the wheels move straight?
    3. What message makes the wheels stop?
    4. What message makes the wheels turn right?
    5. What message makes the wheels turn left?
  4. Now start the lane following demo. Do NOT start the robot moving (do not press ‘a’). Does your topic above still make the wheels move?
  5. While the lane following demo is running, look at the topics carefully. There should be two “control” topics that a node called “car_cmd_switch_node” listens to. Experiment with your Duckiebot in both lane following and manual control. How do the two topics change? Which topic is used when? What do you think this node does?

Submission

Submit a PDF to Blackboard with BOTH your name and your lab partner’s name:

PART I

  1. The name of your duckiebot
  2. Demonstration of your assembled robot
  3. Demonstration of your robot lane following
  4. The output of rqt_graph in 11a and 11i
  5. 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? You do not need to write more than a paragraph for this question.

PART II

  1. Answers to Step 3 questions.
  2. Answers to Step 5 questions.

NOTE: you must demonstrate your robot in person to get full credit! If you are unable to schedule a time in person please contact the instructor ASAP.

Rubric

PART I

  • Demonstration of lane following: 50 points
  • Graphs from steps 14a and 14i: 25 points
  • Answer to question 5 above: 25 points

PART II

  • Answers to Step 3 questions: 25 points
  • Answers to Step 5 questions: 25 points