div_id = "interactive-container"
graph_style = `
width: ${width}px;
height: ${width/2}px;
user-select: none;
overflow: hidden;
position: relative;
touch-action: none;
background-color: #f5f5f5;
border: solid #DDD 1px;
border-style: solid;
border-radius: 10px;
margin: 0;
`
viewof graph = html`<div id="${div_id}" style="${graph_style}"></div>`
Open-Loop Go To Goal
Exciting times! This chapter should leave you you thinking: “Yea, I made a robot!”
What you will learn
- How to program a robot to move using open-loop control
- The drawbacks of open-loop control
Terminology
- open-loop control
- a control system that does not use feedback to change its actions
Lecture
Before moving on to the exercise, try to answer the following questions:
How would you make your robot move forward 10m, rotate right by 90°, and then move forward another 10m?
Open-Loop Control (Dead Reckoning)
One way to make your robot perform the task above (10m, 90°, 10m) is to measure the speed of your robot over many trials with different speed commands and distances. You could then use this table to do the following:
- compute the amount of time needed to move the robot forward 10m at your preferred speed
- compute the amount of time needed to rotate the robot 90° at your preferred speed
- reuse the time from the first step to move the robot forward 10m
Interactive
Try running the following simulation several times.
What do you notice about the final position of the robot? (And what might justify this behavior?)
Your robot is pretty unlikely to go straight forward. It will likely veer off-course for a variety of reasons, including:
- wheel slippage (cardboard wheels don’t have much traction)
- differences in the motors (one motor might rotate faster than the other at the same voltage)
- differences in the wheels (one wheel might have a larger diameter than the other)
- sloppy construction (the wheels might not be perfectly aligned)
- uneven ground and/or debris
Many of these issues can be fixed with better control algorithms.
Exercise
It is time to make your robot move!
You will submit your responses on gradescope. Only one partner should submit. The submitter will add the other partner through the gradescope interface.
Additional details for using gradescope can be found here:
You should open the gradescope assignment now so that you know what to work complete.
Grading
I will grade all exercises using a scale of “Nailed It” / “Not Yet”. See the course grading policy for more information, and check gradescope for deadlines.
Overview
Every team will write a program for the following task:
Make your robot move forward 3 meters using open-loop control.
We will mark starting and target locations on the floor in the the lab (on tile) and in the hallway (on carpet). Everyone will record 5 trials for each surface and record their results in this spreadsheet.
Some things to consider:
- It is OK if your wheel diameter is the same for each trial
- You can vary the distance traveled by adjusting the speed value and/or the duration
- Your trials do not need to appear in sequential rows
You’ll want to start each coding section by pulling any changes I’ve made to the course code:
# If you cloned the repository
git pull origin main
# If you forked the repository
git pull upstream main
Wrap-Up
Now that we’ve seen the issues with open-loop control, next week we’ll look into using data from sensors to improve our robot’s performance.