Skip to content

NIURoverTeam/CrashCourse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 

Repository files navigation

Crash Course

Learning how to program a Mars rover, one week at a time.

Lesson Planning

There are 15 weeks in a semester, so this crash course aims to complete the new member training in 10-ish weeks to give some leeway. These bullet points are meant to be in order of how we want to teach things. Feel free to make revisions as desired. :)

Week 1: Setting up communication

  • Get people on GitHub and the Teams programming channel. Decide on a programming meeting time
  • Explain which repos we have in our GitHub organization

Week 2: Getting Started (software installations)

Week 3: Basic Bash intro

  • Command structure ($ command [-options] [arguments]), basic filesystem, pwd, mkdir, ls, cd, nano, cp, mv, rmdir, rm, man. See our Bash & Linux Crash Course for more details.

Week 4-5: Basic Python tutorial

  • Using Python's turtle library
    • Drake got it to work with just Ubuntu WSL2, sudo apt-get install python3-tk, and an Xserver running
    • Start with this code:
      import turtle
      
      # setup 
      scrn = turtle.getscreen()
      turt = turtle.Turtle()
      
      # vvv YOUR CODE GOES BELOW HERE vvv
      
      
      
      # ^^^ YOUR CODE GOES ABOVE HERE ^^^
      
      # leave the screen open until clicked
      scrn.exitonclick()
    • Use these functions: forward(amount), backward(amount), right(angle), left(angle), fillcolor(color_name), begin_fill(), end_fill(), penup() (picks up the turtle's pen), and/or pendown() (puts down the turtle's pen). More info and a few more functions can be found here. Make sure to call these functions from the Turtle object we instantiated in the starter code.
    • Challenges - make these drawings:
      • Write the body for a function named def colored_square(my_size, my_color):, which draws a square of size my_size and color my_color. Then draw two squares using these lines:

        # call function several times with different arguments
        colored_square(100, "blue")
        colored_square(50, "red")

        image

        ^^ Click to reveal a possible solution (try it yourself first!) ^^
        import turtle
        
        # setup
        scrn = turtle.getscreen()
        turt = turtle.Turtle()
        
        # define function to draw colored square
        def colored_square(my_size, my_color):
            turt.fillcolor(my_color)
            
            turt.begin_fill()
            for i in range(4):
                turt.forward(my_size)
                turt.left(90)
            turt.end_fill()
        
        # call function several times with different arguments
        colored_square(100, "blue")
        colored_square(50, "red")
        
        # leave the screen open until clicked
        scrn.exitonclick()
      • In a separate python file, write the body for a function named def draw_polygon(num_sides):, which draws a regular polygon with the requested number of sides (Hint: the angle to turn for each shape is 360.0 / num_sides). The side lengths are all 100 in the example image. Then call the function in a for-loop to draw everything from a triangle to an octagon. image

        ^^ Click to reveal a possible solution (try it yourself first!) ^^
        import turtle
        
        # setup
        scrn = turtle.getscreen()
        turt = turtle.Turtle()
        
        # define function to draw polygon with some number of sides
        def draw_polygon(num_sides):
            turn_angle = 360.0 / num_sides
            for side in range(num_sides):
                turt.forward(100)
                turt.left(turn_angle)
        
        # draw polygons with the same starting point
        for num_sides in range(3, 9):
            draw_polygon(num_sides)
        
        # leave the screen open until clicked
        scrn.exitonclick()
        </details>

Week 6: GitHub and git intro

  • read What is Git?
  • Have each member clone this CrashCourse repo, create a new branch named <firstname>-hello-word, commit their Python code from previous weeks, push to their branch, and then make a pull request to merge into main (but don't actually merge)
    • Explain the workflow of git (git pull -> make changes -> git add <files> -> git commit -m "what I did" -> git push)
  • Explain useful commands, e.g. git status, git diff, git log

Weeks 7-10: ROS2 Beginner Tutorials: CLI Tools & Client Libraries (but slightly out of order). Drake tentatively proposes the following tutorials order:

Note, connect over xrdp for these steps. Shatterdome should have ROS2 installed for all profiles.

Note, to get ROS2 working on your computer, start your X-server, SSH into shatterdome with ssh -X <username>@<shatterdome_ip>, and then it should work. If off the campus's WiFi, first SSH into your Turing/Hopper account using ssh -Y <username>@turing.cs.niu.edu or ssh -Y <username>@hopper.cs.niu.edu, and then ssh -X to shatterdome as described above.

Note, since we're working on shatterdome which is a Linux machine, always use the Linux instructions, even if you're a MacOS or Windows user!!!

Some weeks: more ROS2 tutorials (do this after Webots intro?)

  • understanding services
  • writing a simple service and client (python)
    • challenge: comment out AddTwoInts code, and create a SubtractTwoInts service
    • challenge: uncomment AddTwoInts code, and make a way for client to request one service or the other (modify the challenge if this is bad use of services)

Some weeks: Webots intro (do this before more ROS2 tutorials?)

  • running a demo in Docker container (on shatterdome?) to verify integrity (and cuz it's cool) (crossed out since we're no longer using Webots through Docker)
  • quick intro to scene tree
  • writing code to communicate with robot controller
  • not in crash course, but further reading: https://cyberbotics.com/doc/guide/tutorials?tab-language=python

The Shadow Realm (AKA sections we decided not to pursue)

This area is for plans we decided to drop, but that we don't want to necessarily delete or bury in the commit history. Ideally, any sections added here should include a note for why they've been banished to The Shadow Realm™️.

Docker conceptual intro (just to get it running and understand why we use it)

  • (Banished because we discovered Docker was unnecessary for ROS2. Instead, we can just ssh -X into shatterdome with an X-server running locally, and it will work just fine.)
  • read What is Docker?
  • Install and test Docker in your terminal by following our Installing Docker guide
  • running one of our ROS2 containers: follow the README instructions for running our ros2_foxy Docker container (you'll need to clone that NIURoverTeam/Dockerfiles repo in your WSL)
    • check integrity with ros2 doctor

Week 2: Getting Started (software installations)

  • (Banished because we've decided to only use xrdp and not bother with WSL2 for speed and consistency reasons.)
  • TODO should we skip this and use xrdp instead? "Remote Desktop with xrdp" guide
  • If using Windows 10:
    • Install WSL2 using this guide.

      If instructed to download your Linux distribution of choice, choose Ubuntu from the Microsoft Store. As of September 2021 however, I don't think this is part of the linked guide.

    • If you don't see Ubuntu when you search for it in your Start Menu, go ahead and install it from the Microsoft Store as well. Choose the one named just Ubuntu, without any numbers after.
  • Regardless of your operating system:
    • To set up an X-server for yourself, follow our Installing an X-Server guide
      • You can test your X-server with xeyes (make sure the Xserver is running first) image
      • xclock is another good option

About

Learning how to program a Mars rover, one week at a time.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published