![]() |
Team 254 Presents: 2015 FRC Code
Hi everyone,
Team 254 is happy to share the code base for our 2015 robot, Deadlift. This year’s software includes new features such as a test harness and simulator code to run the program on a computer, web-based graphing tools, constants editor, and autonomous selection, blocking autonomous routines, and a controller that calculates and follows a trapezoidal motion profile, on the fly. Please take a look at the following repositories: Robot Code: https://github.com/Team254/FRC-2015 Simulated Robot Hardware: https://github.com/Team254/Sim-FRC-2015 Simulator: https://github.com/tombot/FakeWPILib |
Re: Team 254 - 2015 FRC Code
I am really excited to look through this! Thanks for posting this.
|
Re: Team 254 - 2015 FRC Code
Quote:
Implied slander from an anonymous account. |
Re: Team 254 - 2015 FRC Code
Quote:
|
Re: Team 254 - 2015 FRC Code
So would it be possible to use the simulator and run our own code on it at any point, or are there any steps to make it work?
|
Re: Team 254 - 2015 FRC Code
Quote:
Code:
#define true ((rand()&15)!=15)If a team of 254s caliber is seemingly forgoing this utility I would personally like to know why. (Different internal system for tracking bugs? Mentors reviewing code before it goes on github? All just speculation of course.) |
Re: Team 254 - 2015 FRC Code
Quote:
On a side note... what does that #define line of code do? Is that some fuzzy logic? |
Re: Team 254 - 2015 FRC Code
It was a prank a friend of mine played on me a few years ago (not while programming robots). Basically, true is true... Most of the time... It's not as easy to detect as #define true false. We had a whole slew of these we did back and forth.
|
Re: Team 254 - 2015 FRC Code
Quote:
Quote:
|
Re: Team 254 - 2015 FRC Code
I followed the directions here to run the robot code in the simulator. I got the following error.
Code:
run_sim.rb:6:in `exists?': no implicit conversion of nil into String (TypeError) |
Re: Team 254 - 2015 FRC Code
Some questions (not a very advanced programmer, yet)
1. How do you run autonomous mode despite the looper? If you tried your approach on a normal iterative robot template, the loop would run on the wait commands, preventing it from advancing. 2. You need to generate splines to create paths for motion profiling, right? 3. What is the peacock motor? Some more questions, but I'll wait for answers to to these first. |
Re: Team 254 - 2015 FRC Code
Quote:
|
Re: Team 254 - 2015 FRC Code
Will we be seeing a build blog anytime soon? Thanks!
|
Re: Team 254 - 2015 FRC Code
Quote:
|
Re: Team 254 - 2015 FRC Code
Quote:
|
Re: Team 254 Presents: 2015 FRC Code
Whats the license like for the code, specifically the stuff in the Simulated Robot Hardware repository. I would like to put some of that in the simulator side of the C# project if possible.
|
Re: Team 254 Presents: 2015 FRC Code
Quote:
|
Re: Team 254 - 2015 FRC Code
Quote:
2. We didn't use any spline paths this year. All of the control loops were 1d (elevator carriages, drive forward, turn in place). All of the moving subsystems shared a generic base controller which could be tuned for the properties of that system. The motion profiling was done on the fly (this is a much easier calc than generating spline-y paths). 3. The original concept for our can grabber was a system that had 4 individual telescoping arms (feathers) that would go out and grab each can in auto, all starting from the robot centered on the field. This made the robot look like a peacock, and the name for that subsystem stuck through iterations. A motor peacock is just the motorized can grabber assembly. |
Re: Team 254 Presents: 2015 FRC Code
Thanks for the replies.
Few more questions. 1. How much smaller/larger than your shafts/stock is the tubing you get from mcmaster to ensure a super snug fit? (NOT a code question, I know :p) 2. Any reason you chose not to use CAN control for your motors? 3. Did you ever figure out the timing issues java had? |
Re: Team 254 Presents: 2015 FRC Code
Quote:
#2, the CAN-enabled Talon SRX was new to FRC this season, so we decided to stick with tried-and-true PWM in case there were teething problems. As it turned out, the CAN Talon works great, and I'd say there's a good chance we use them next year. #3, yeah. The WPIlib JAR we used was tweaked to enable interrupts and the hardware timer to work correctly in Java (basically we just finished some incomplete JNI work). The source of the modified JAR is in the lib directory. Garbage collection and the JVM still mean that we aren't quite as reliable as a RT C++ thread would be, but it is pretty stable with our changes. |
Re: Team 254 - 2015 FRC Code
Quote:
|
Re: Team 254 - 2015 FRC Code
Quote:
|
Re: Team 254 Presents: 2015 FRC Code
Last year, you guys squared turn inputs when you were quickturning (in teleopPeriodic). I don't see it this year - what happened to that?
|
Re: Team 254 Presents: 2015 FRC Code
Quote:
|
Re: Team 254 Presents: 2015 FRC Code
I'm a little confused with the simulator. FakeWPILib replaces classes that won't run on a computer, but it doesn't have a replacement class for NotifierJNI, which won't run on a computer. NotifierLooper uses NotifierJNI, which creates an unsatisfiedlinkerror exception.
|
Re: Team 254 Presents: 2015 FRC Code
Another question: what, conceptually, is a Tappable?
|
Re: Team 254 Presents: 2015 FRC Code
I think there's a bug in the solenoid.java file of FakeWPILib
Code:
public Solenoid(final int moduleNumber, final int channel) {Something is a little weird - the robot code can't work in the simulator with this version of FakeWPILib, which is also missing a NotifierJNI class. Perhaps there was another revision of FakeWPILib? |
Re: Team 254 Presents: 2015 FRC Code
Quote:
|
Re: Team 254 Presents: 2015 FRC Code
Quote:
|
Re: Team 254 Presents: 2015 FRC Code
Quote:
The fake wpi lib is by no means complete. We just implemented hardware abstractions as we went along and needed them. |
Re: Team 254 Presents: 2015 FRC Code
It appears that this build was done on a linux box (the ruby script is VERY linux specific). I have been trying to build the files (following the build method in the buy script) on my Windows machine using Java 8 JDK and ant loaded from the apache site. I have issues when I launch the sim with incompatibilities between 64 and 32 bit images and then with incompatible libraries in the wpilibj. I am doing this outside of eclipse to make sure I can control the build environment.
Has anyone been successful in compiling this under a windows box? If so could you provide any hints on how you did it? Edit - Here is the transcript to the failure Code:
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\me\AppData\Local\Temp\libwpilibJavaJNI4190642768369947334.so: Can't load this .dll (machine code=0xb0b0) on a AMD 64-bit platform |
Re: Team 254 Presents: 2015 FRC Code
Quote:
|
Re: Team 254 Presents: 2015 FRC Code
Quote:
Make sure you have the 32 bit jvm and jdk on your machine. Also, make sure your PATH variable points to the a 32 bit java 8 jdk/jre. To check run "java -d64 -version" and you should see an error that 64 bit is unsupported. Also run "javac -d64 -version" and you should get the same error message. Download the three repositories (FakeWPILib, FRC-2015, Sim-FRC-2015) using the download zip option from the github page. Unzip them all to the same folder. In FakeWPILib/src/edu/..../Solenoid.java, edit the constructor so it looks like the code below Code:
public Solenoid(final int moduleNumber, final int channel) {Code:
public MultiLooper(String name, double period, boolean use_notifier) {Run 'ant jar' Make sure you see BUILD SUCCEEDED Go to the FakeWPILib directory, and run ant jar Make sure you see BUILD SUCCEEDED Copy FakeWPILib/dist/FakeWPILib.jar to Sim-FRC-2015/lib/ Copy FRC-2015/dist/FRCUserProgram.jar to Sim-FRC-2015/lib/ Go to the Sim-FRC-2015 run ant compile Delete Sim-FRC-2015/tmp if it exists Copy FRC-2015/dist/FRCUserProgram.jar to Sim-FRC-2015/tmp (create tmp folder) Create folder classes in tmp Open command prompt window in classes, run 'jar -xf ../FRCUserProgram.jar copy contents of FakeWPILib/bin/ to Sim-FRC-2015/tmp/classes, don't use command prompt for this, and be sure to merge folders and overwrite without rename when there are conflicts copy contents of Sim-FRC-2015/bin/ to Sim-FRC-2015/tmp/classes, same way as before open a command prompt window in Sim-FRC-2015/tmp run 'jar -cmvf classes/META-INF/MANIFEST.MF to_sim.jar -C classes .' to run simulation, run 'java -jar to_sim.jar' To see the robot graphs, go to localhost:5800 in your browser. If you get an error, post it here, and I can probably help. |
Re: Team 254 Presents: 2015 FRC Code
In DCMotor, is getPosition() in radians and getVelocity() in radians/second?
|
Re: Team 254 Presents: 2015 FRC Code
Quote:
The sim is super rudimentary, incomplete, and there are some bugs - but we found it enormously useful for designing the controllers for our elevator and motorized can grabber. The first time we ran our elevator trajectory controller on the actual robot, it just worked. For the can grabber, we used our model to choose an appropriate gear reduction for the gearbox and evaluate different types of stored energy assist. No promises, but we will probably continue to work on refining the sim interface and the underlying physics models for next year (for example, in all of our experiments we observe a delay in motor movement that we cannot model, even if we consider inductance). Maybe we'll do a Championship Conference presentation on simulation...? |
Re: Team 254 Presents: 2015 FRC Code
Quote:
|
Re: Team 254 Presents: 2015 FRC Code
Quote:
The delay... is it around 100-400ms... and is there a load applied to the motor? |
Re: Team 254 Presents: 2015 FRC Code
Quote:
We tried modeling things like motor inductance, gear train/motor drag, multiple sources of inertial load, and battery/wire voltage drop, but haven't been able to isolate the culprit. Like Austin said, it is probably worth running some experiments. |
Re: Team 254 Presents: 2015 FRC Code
Quote:
Our model matched the shape and time of the response very well, but was time shifted over. An interesting test would be wiring a motor + LED to run directly off a main breaker, and see how much the delay is reduced there. |
Re: Team 254 Presents: 2015 FRC Code
Quote:
|
Re: Team 254 Presents: 2015 FRC Code
Quote:
|
Re: Team 254 Presents: 2015 FRC Code
Quote:
|
Re: Team 254 Presents: 2015 FRC Code
On a slightly different note, I found this LIDAR class in your code, but it doesn't appear that you use it anywhere else.
What did you plan on using the LIDAR for and why did you end up not using it (or am I just too blind to find it :))? Or was this just something you looked into during build season? |
Re: Team 254 Presents: 2015 FRC Code
Quote:
|
Re: Team 254 Presents: 2015 FRC Code
In FRC-2015/src/com/team254/frc2015/CheesyDriveHelper.java
Code:
if (isHighGear) {Also, in the same code file, could you explain what you do with "negative inertia" better? |
Re: Team 254 Presents: 2015 FRC Code
Quote:
Negative inertia is an idea which I stole from the Thinkpad trackpoint. https://en.wikipedia.org/wiki/Pointing_stick It adds extra turn power in to compensate for the inertia of the robot. The end result is that the robot feels more responsive. |
Re: Team 254 Presents: 2015 FRC Code
Just out of curiosity, how much of this code do you guys re-use each year?
|
Re: Team 254 Presents: 2015 FRC Code
Quote:
|
Re: Team 254 Presents: 2015 FRC Code
Quote:
That state machine code is something really amazing... I haven't looked at it lately to see if it is still there, but perhaps someday I may have another look at how it has evolved. |
Re: Team 254 Presents: 2015 FRC Code
Quote:
Examine the code and you should be able to tell what gets carried over and what doesn't. |
| All times are GMT -5. The time now is 15:34. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi