Sensors Challenges 2
Recommend complete ★ from Sensor Challenges 1 first, but do as you wish
Integrating IMU Data
Time to use your integrator!
- Some things to keep track of:
- May need to modify the angle based on the motor's momentum
- If the direction you're spinning is positive or negative
★ Compare Encoders vs IMU for 90 Degree Turns
- Keep one wheel still
- Goal: Rotate robot 90 degrees, then stop
- Compare the performance of using counts and integrating the IMU data
- In which applications is one better than the other?
Calculating Distances in Meters
You now have learned the math:P
- Until now, the challenges have required stopping or
changing the robot's movement based on encoder counts alone,
but now that we've learned the math, we can use actual distances in meters!
- This means we can travel specific distances or MEASURE distances based on encoder counts
★ Stop after 1 Meter
- Modify your stop after 200 counts code to stop after 1 Meter
- Use your function that converts distances to counts:)
★★ Measure a Distance
- Write a new function that converts counts to distance
- Modify your hit the brakes code to measure how far you traveled before you stopped
★★ Distance Along Arcs
- Write a function that estimates the length of an arc
- If we keep one wheel still, any arc traveled will be on a circle of known radius
- This radius is the same as the distance between the wheels
- The distance between the wheels is called the track width
- For our robot, use #define TRACK_WIDTH 0.131 //meters
- The function should input the amount of degrees you want to travel
- The function should return the distance in meters the one wheel will travel
- Use your countsToDistance() function
- Can test if your function works with a 90 degree turn