Recently, I purchased a Romi to use as a learning experience to dive deep into FRC Path Following. It was probably the best money I’ve ever spent toward FIRST. Just gonna outline some of my experiences here.
This is sooooo incredibly critical! If you cannot write a basic java program that allows you to control the robot with joysticks, step back and focus on that for a bit. While the “Path Following” code itself looks copy/pastable, you need to understand what’s going on. Debugging is incredibly critical here.
I first programmed my Romi to use my controller, and then chased after my cat. A very amusing and fun experience.
I consider myself having a pretty moderate level of programming experience. There are many many things that can go wrong with path following. It’s incredibly easy to think one this is the issue, and break others in the process of fixing that.
This project by ZQ which allows for Romi trajectory tracking has been fantastic (soon available for frc-char replacement SysID). However, there were a couple of pain points.
- Be very very careful with your units. Meters everything, meters always. Do not convert later, you will step on a nail here.
- I initially forgot to enter my units per rotation (0.219915) and that took me several hours to debug later on. Do it right first.
For those interested, this is my Romi Characterization (2.8 MB).
Oh yeah, before I forget, as noted in ZQs characterization README, it’s quite important to put the velocity threshold quite low. I put (0.050) for mine.
Disclaimer: While Romis are “identical”, I got quite different characterization results than ZQs data did. As a test, I used his and mine. While his data tracked “okay”, I got much much better results using my own data, and tuning that.
- Send your robot Pose2D to Field2D, it’ll make debugging immensely easier
- Plot your trajectory onto the dashboard, this will eliminate any concerns that the trajectory itself is wrong.
- Plot current wheel speeds versus expected wheel speeds, this will help debugging it not following a smooth path (I did before and after Ramsete wheel speeds)
- Be very careful with inversions. Only ever invert in one place (I recommend your inputs), to keep things consistent. Inversions can very quickly lead you into a rabbit hole.
- Start off with a straight line trajectory, make sure it follows it reasonable well (you’re odometry is accurate)
- Move toward a curve, verify it follows the curve reasonable well (this is where the inversions can really get tricky).
Do not skip steps! This takes time to learn!
ZQ Characterization Project: romi-examples/romi-characterization at main · bb-frc-workshops/romi-examples · GitHub
- Used as a baseline to debug any characterization issues
- Used as a reference to determine any inversion issues or code issues.
Characterization Documentation: Robot Characterization — FIRST Robotics Competition documentation
- Used to understand the inputs and outputs, this is very important since you can’t compare data on an actual robot.
Path Planning Documentation: Trajectory Tutorial — FIRST Robotics Competition documentation
- Meat and bones of the tutorial
Troubleshooting Path Planning: Troubleshooting — FIRST Robotics Competition documentation
- This article was so useful for debugging why my Romi’s tracking was doodoo.
Non-Commandbased Ramsete Example: allwpilib/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/ramsetecontroller at main · wpilibsuite/allwpilib · GitHub
- I did non-commandbased for my romi project, and used this as another reference.
Romi Code: GitHub - Daltz333/Romi_Traj_Following
Then… the same day I got the above path nice and cleaned up, I went to try it on an actual robot…
In a session of two hours, I characterized and programmed my robot to follow the barrel racing path using the knowledge and debugging steps from the Romi. This wasn’t without flaws. I prepared the robot project by using previous robot code as a baseline (already had sensor logic for velocity/distance, gyro, and motor ids). Then, at home, I threw together it in simulation to verify my robot code logic was accurated.
Then, in only a two hour timespan, I characterized my robot and plugged those in to my already created robot code. I did have some motor inversion issues to work out due to simulation inversions differing from real life. Additionally, my math for inches to meters was wrong for some dumb reason I have yet to figure out (I copied CTREs native to meters example code).
Overall… just another Romi success story.