Skip to content

Commit

Permalink
Suggested use of MotorWithFeedback
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardalee committed Aug 23, 2023
1 parent ec7de2d commit d99c111
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Hill.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,17 @@ If you make the adjustment proportional to the roll, then adjustments will get s
You may want to review Section 2.4, Feedback Control, of [Lee and Seshia](https://leeseshia.org).
You will want to keep the wheel speeds within reasonable bounds.

**Hint:** The power needed by the motors to maintain a constant speed varies considerably as a function of the pitch.
A variant of the `Motors` reactor called `MotorsWithFeedback` is provided for you in the template repo in the `src/lib` directory.
The inputs to this reactor are desired speed and encoder readings.
Each time the reactor receives an encoder reading, it adjusts the power to the motors to attempt to get the measured speed to match the desired speed.
Hence, it can compensate (somewhat) for the pitch induced by the ramp.


**Checkoff:** Show your robot driving to the top, turning around, and going down the ramp.

## Postlab

1. Just as you used roll measurement and feedback to control the direction in which the robot travels, you could use the encoders to control the speed at which it travels. Describe how you would do this.
1. Encoders report the angle of the wheels in degrees relative to some starting point. Explain how the `MotorsWithFeedback` reactor uses this data to estimate the speed at which the robot is actually traveling.

2. What were your takeaways from the lab? What did you learn during the lab? Did any results in the lab surprise you?

0 comments on commit d99c111

Please sign in to comment.