Autonomous
The robot starts at the parking zone based on its alliance. The arm and gripper are facing toward the cone. Therefore, the sleeve on the cone is visible, with an AprilTag indicating which zone was chosen. The vision code picks up which AprilTag is displayed, and prepares to drive to that zone.
When the start button is pressed, the robot starts to drive straight to the B2 square. If it is zone 2, the robot stops, however, if it is zone 1, it will turn left and go to the A2 square, or if it is zone 3, it will turn right and go to the C2 square.
Tele-op Control
- Holding down the right trigger makes the robot move slower the more it is held down.
Snap to 90 degrees
- The left and right d-pad buttons snap the robot to predetermined angles based on the gyro.
- Moves the robot based on the direction the robot started in (the direction the drivers are facing) rather than based on the direction the robot is pointing.
- Can be toggled for ease of use for multiple people or in different situations.
- Was intended to make driving more stable and easier.
- Gradually increased the robot's speed instead of moving it at its top speed immediately.
- We removed acceleration due to difficulties in precision.
Tele-op
We worked on making the robot snap to 90-degree angles. Originally, this function used a bunch of if-statements, but we created a function and were able to get it working using a single line of code.
When the tele-op file was getting crowded, we remembered that in FLL, we created a 'library' to make the code more compact and allowed it to be used everywhere, so we did that for this year. They also contain JavaDocs, which are an easy way to create documentation inside the code.
Originally, the robot tilted when it started moving. We noticed that this was due to the robot moving at its top speed as soon as it started moving. To fix this, we wrote an acceleration algorithm to increase the robot's speed gradually. We found that this made it difficult to drive the robot in some scenarios, so we added a toggle for the robot's acceleration. This made it so that the robot could be easier to drive for anyone, whatever their preferences. The team decided acceleration caused issues with controlling the robot (and it was nearing competition), so it was removed.
We used global positioning to be able to drive easier. Global positioning uses an IMU to track how far the robot's current rotation is from its starting position. It then calculates this as we power the wheels to make sure that when we go forward, it'll always go forwards relative to the starting position - the position of the driver. We also made it so that the y button will toggle global positioning, so if we press it once, forward will be relative to the robot, and if we press it again, forward will be relative to the robot when the IMU first calibrated the rotation (when we press go). We coded the gripper using a Servo, so we told it to turn to a certain position when a certain button was pressed. The servo rotating would then pull a 3D-printed part up to close the gripper. When the servo turned again, it would release the part, opening the gripper. The team ran into a similar issue with our global positioning code as we did with our acceleration; it was helpful for some drivers but added difficulty for others. We added a toggle for global positioning so that our robot is customizable to anyone's driving style.
We also added a precision mode, which allows the robot to slow down and make more precise movements without having to be precise with the joystick.
Zach and Jacob also attempted to use PIDF coefficients and exponential curves to make the robot do precision mode. These were both abandoned, as PIDF coefficients don't pertain to precision mode, and the exponential curves were cool, but it wasn't really necessary.