Team 135 Code Release

Hey you all. This is probably the first time in a while Team 135’s done a code release, so I hope you guys enjoy! If you have any advice for us, that’d be nice too! Recently one of my friends (Evan) over on media made a robot "reveal video post.

Without further to do here you go: https://github.com/Team135BlackKnights/2018Code

Additionally we have transitioned from being a C++ team to a Java team, so we actually took the time to convert 2017’s code to Java for references between the two. The reason for the switch was because our FTC teams (Penn has classes for both FTC and FRC) started using Java last year (hey thanks for introducing it Evan!). I never officially posted links to either so here you go.

2017 C++: https://github.com/Team135BlackKnights/2017Code
2017 Java: https://github.com/Team135BlackKnights/2017Java

Some tips for reading code:
I midway through the season implemented a naming system for variables. It’s not fully solidified yet but it’s somewhere along the lines of:

All variables belonging to an object of the class start with “this” within the class. All private variables begin with underscore. All final variables are all caps with underscores for spaces.

A Summary of Advancements Made:

This was our first mecanum drive that was field oriented, so a lot of our work was put into there. The current system uses a NavX Micro and a PID controller using velocity control on the TalonSRX. We currently use 63R64 Grayhill Optical Encoders.

I leveraged the PIDController class of WPILib by using a couple class implementations of the PIDSource and PIDOutput classes. The PIDSource implementation class makes use of lambdasto be general purpose. The PIDOutput implementation class simply makes the output of the controller public so it can be used in a more general manner.

The drivetrain class is a redo of the WPILib MecanumDrive class with PID closed loop velocity control.

Note: A big problem I had was with the strafing side to side of the mechanism despite my attempts to lock the orientation. I am supposing we could use a cascaded PID controller with an accelerometer to control that.

We also did a bit of implementation of camera tracking this year using a Limelight. This is another first for us, as in the past, we relied on a Jetson and a camera with its IR filter taken out and replaced with a visible spectrum filter. It never really worked. It ended up being able to do mid in lab conditions (lighting at the competition was kinda screwy at times). We also ended up being able to track cubes based on their hue value in the lab.

Note: I’d have to say, as someone who worked on camera tracking much off-season I was a bit disappointed we couldn’t work with the Jetson. As a senior, I’m currently working on training next year’s students about the manual camera tracking algorithms and hopefully some machine learning.

One last one is we use Ether’s suggestion for an implementation of tank-like control scheme for the mecanum drive. I was a able to drive it quite well. We made use of overloaded drive functions in our drivetrain subsystem so go check it out. Was used in our attempt at motion profiling.

Summary of Things that Could’ve Went Better:

Consistently, there was a shortage of power to the machine during the latter half of the season after we added a Limelight to the robot. During the Indiana State Championship, a tech assistant suggested I add a ramp rate to the Talons to reduce power consumption. This hasn’t had a chance to be tried yet and I’m looking to see if any of you all had any other ideas I could try.

Motion profiling was tried but since I was the effectively the only programmer, i was unable to figure it out in time. You can see we had tried to implement it several times. The biggest problem was finding the kinematic constraints of the robot. Currently an idea i have is to use kinematics with the inclusion of jerk to solve for maximum jerk. displacement = (1/6)(jerk)t^3

Still working on machine learning. Currently thinking about installing DIGITS on some Ubuntu system and then using GoogleNet and training it. Looked into the Zebracorns method of generating images using random noise. I’ll probably have to look into overlaying images a bit after.

If you have any tips for improvement like better sensors, algorithms, or papers to look that, we’d be really appreciative! Either way, we had a fun season; it’s a shame this is my last year on FRC. I’ll see you all as an alumni (and maybe starting a Chicago team)?g a Chicago team)?

*and I thought why not make a companion code release right?