Code Changes The Week Before Regionals
Tags: controlPersonhours: 26
Task: Assess Code Changes During The Week Before Regionals
Numerous code changes were made during the week before regionals, the most signicant of which were attempted two days before regionals, a costly mistake during competition. Firstly, three different paths were layed out for respective position of the skystone (South, middle, and North), which involved rotating to face the block, driving to the block, extending enough distance to capture the block, and driving towards the foundation afterwards.
Next, we proceeded to add small features to our codebase, the first of
which was integral windup prevention. We saw that when tuning gains for
our turret PID, we experienced a build up of steady state error which was
counteracted by increasing our integral gain, but resulted in adverse side
effects. We used the following code to declare a range which we refer to
as the integralCutIn
range, and when the error of the system
drops below that threshold, the integral term kicks in.
This code was put in to account for a phenomenon known as integral wind up; when the theoretical correction given by the system surpasses the maximum correction that the system can deliver. An accumulation of error results in more correction that can possibly be given in the real model, so to prevent this, the integral term is active only within a small range of error, so that the robot can deliver a reasonable amount of correction and avoid overshoot.
We continued to tune and tweak our autonomous routine Tuesday, making minor changes and deleting unecessary code. We also encountered errors with the turret which were fixed Wednesday, although the biggest changes to our algorithms occured in our skystone detection vision pipeline on Thursday.
On Thursday, code was added in order to select the largest area contour
detected by our vision pipeline, and avoid percieving any disturbances or
noise in the image as a potential skystone. We achieved this by first
iterating through the found contours, calculating area using
Imgproc.contourArea(MatOfPoint contour)
, keeping track of the
maximum area contour, and using moments to calculate the x and y
coordinates of the blob detected. The screen was then divided into three
areas, each of which corresponding to the three skystone positions, and
the final position of the skystone was determined using the x coordinate
of the blob. A snippet of the code can be seen here:
On the final stretch, we added localization using Acme Robotic's
roadrunner motion profiling library, which will be expanded on in the
future. We also tuned and tweaked PID gains and ticks per meter. Finally,
we added code to read distance sensors, which will be used in the future
to detect distance to the foundation and follow walls. In addition we
integrated the vision pipeline with the existing
addMineralState(MineralState mineralState)
method to be used
during the start of autonomous.
Next Steps:
In the future, we plan to use the features we added during this weekend to
expand on our robot's autonomous routine and semi-autonomous
articulations. These include incorporating odometry and localization to
reduce the error experienced during autonomous, and even drive to specific
points on the field during teleop to improve cycle times. In addition we
can now use distance sensors to follow walls, further improving our
accuracy, as well as determine the distance to the foundation, allowing
for autonomic placement of skystones using the
extendToTowerHeight
articulation.