Programming
Here at Singularity Technology, we strive to incorporate creative algorithms and a variety of sensors in order to make our robot’s movements as accurate and quick as possible, as well as to improve the ease of use for our drivers during the teleOp phase of the match. During the 2019-2020 season, we incorporated encoders, gyroscopes, and distance sensors into our driving algorithms in order to increase the precision of our movements; these sensors all operate in conjunction with one another and receive feedback from one another in order to create complex positioning systems. In addition, we used computer vision algorithms developed with the help of such libraries as Google’s TensorFlow, OpenCV, and Vuforia in order to aid in the sensing of objects such as the skystonses. Finally, we incorporated complex Java structures, such as making our programs multithreaded and using abstract classes, in order to increase the number of options we had for our programming architecture.
Our Autonomous

Using Threading to Stall the Mineral Gate While
Allowing Other Robot Parts to Move
If (a is pressed on the first gamepad) {
Create a new GateMovement object
Call the method specified in the thread class on the GateMovement object
}
//Threading is a process that allows a program to run two methods simultaneously; i.e. the
program does not have to run linearly or wait for one process to finish before starting
another
Class GateMovement extends Thread {
Public void run () {
Set the position of the gate to open
Sleep the gate for 5 seconds
Set the position of the gate to closed
}
}
Autonomously Hanging at the End of TeleOp:
Public void autoHang (Hardware myrobot) {
Turn to be parallel with the lander, as determined by the gyroscope
Make a timer object
Reset timer
While (timer is less than 2.1 seconds) {
Power the arm up
}
Power the arm off
Drive forward for 2 seconds
Drive to the right for 2 seconds
Reset timer
While(timer is less than 3.8 seconds) {
Power the arm downward
}
Latch the first latch into place
Latch the second latch into place
Power the arm off
}
If (the x button and the start button are pressed simultaneously on controller two) {
autoHang(myrobot);
}