Tip:
Highlight text to annotate it
X
Hey guys, This is Ari Lead Programmer of Team 865
Today I am going to teach you how to program your robots in IntelliJIDEA
With the 2014 FRC SDK
So to start us off I've made a little sdk package
That you guys can download from the link in the description
I've already got that downloaded so lets go ahead and get started
So this right here (FRC2014java.zip) is everything you will be needing
Open the .zip up and
Go to your user folder
In your user folder I need you guys to drop these two files
Not the robot template just the sdk and the .properties file
Drop those in your user folder
And what these are
(sunspotfrcsdk) comes every year and this year
It was embedded in a NetBeans module
So I had to do a little trickery to get the liabary files your going to need out of it
But this is all just standard frc stuff and nothing else
So while this is extracting
I am going to go ahead and open up IDEA
This is a really cool IDE and it is my IDE of choice
We got site liscense for free for the whole team and
If you are a educational insutition you can probably get a free liscense
Check on there site I will probably drop a link in the description
If not there is a community edition which has a couple less features
But it is still a great IDE
I prefer this over NetBeans and Eclipse because Netbeans is a little too clunky
and Eclipse doesn't work very well with theming and I prefer a dark theme in my IDE
So since this is extracted I am going to go ahead and get you guys to right click this
.properties file and edit this with whatever text editor you are going to use
Say Notepad or Notepad++ so what we are going to do here
You are going to change your sunsport.home variable to reference to YOUR username
In my case it is "Demo" and this will be your team number
So if your team number is say 2056 "10.20.56.2" and for my team which is 865
I will be doing "10.8.65.2"
So you can go ahead and close these up
Here we are in IDEA
So what we are going to do
We are going to create a new project
So File -> New Project
Lets call it something random
Lets call it "DemoRobot" Make sure you have yoru project SDK selected
If you don't you can always go "New..." and browse to your location of your JDK
Which is probably going to be in C:\ProgramFiles and if you are on a 32-bit machine
So make sure you got the JDK instead of a JRE because
JREs Don't work for compiling what we need
So once you got that go ahead and hit "ok"
With all the default settings
So open in this window or a new window doesn't really matter
And here we are "DemoRobot"
So I am going to go ahead and make a new class
Lets just call this "RobotMain"
You can call this whatever
You can call it "Awesomebot"
Lets call it "Awesomebot"
So you Awesomebot class is going to be your main robot class
You can make it to extend command base or Simnple robot
So the problem is a error because you don't have the liabaries referenced yet
So you have to right click here (Right click your project)
Choose open module settings
Now under liabaries hit the plus button
And browse where you installed the "sunspotfrcsdk" in your user folder
Open that up and hit lib and holding the control key hit everyone one of these Except project
These are the liabaries you are going to need to interface with the robot
So go ahead and hit ok it might even automatically add java docs for you
Which is always great So hit a "OK" a bunch of times
Rename this to something useful like "RobotLibs"
Go ahead and hit ok
Now you notice if you mouse over this you will get the import first liabary prompt
So go ahead and us alt-enter to do that and you have a robot
And you have a robot it does absolutely nothing
But you can use ctrl+click class names to get to source
So you can figure out what to do
For now I am just going to do init method
Just to make sure this is working
So we are just going to go "public.void.robotInit()"
[ System.out.println("Robot is working Yay");]
So what we are going to do now is building the robot
The thing about FRCjava is you can't just run a ol'java file
You actually have to have a couple special build files included
So I have included this in the RobotTemplate zip
You can just drag those in somewhere in your computer
(I drop it into my desktop)
So then copy paste those into your project files
Which is probably going to be in IdeaProjects--> YourRobot (Demobot for us)
Not in SRC
So go ahead and paste those and if we go ahead and tap back into idea
You will see they would have probably loaded
If they didn't just go ahead and hit synchronize demorobot
So what we have here is build.xml
This files I had to write myself because the 2014 SDK does not work well with IDEA
And it wouldn't run two [inaudible] build tasks without manually selecting them
So the name really doesn't matter you can call it "AwesomeBot" if you want
Let's call it awesome bot.
And make sure the baserdir is "." it means base directory
So now thats done
"build.properties" You can just leave that alone
"resources" on the other hand
This file is very important this tells your crio what to program what class to run
So we are going ahead and call this "AwesomeBot"
And it is the same thing as it was before you NEED that comma in bewteen
Then here we We need a packagename don't put everything in FRC
Make a package So lets call our pacakage
"com.myawesometeam.frc2014"
So here you go "com.myawesometeam.frc2014"
So now thats there all we need to do is to actually get the "Ant" build working
Thankfully that is really easy
Because all you gotta go is View>ToolWindows>Ant Build
Hit the + button (You will only have to do this once) and choose build.xml
So we can minimize that
All that matters is that build deploys the default task
And all it runs is deploy and run.
And so we can go back to here just select this
and I am going to power on the robot
Be back in a second
So while my robot is booting up I am going to go ahead and open driver station.
So ofcourse you need driver station to drive you robot
So we are going to hit setup make sure your team number is the right team number
It could be 2056 1114 1111
So you probably want to automatically configure your Local area connection
If you are connecting to router in bridge mode or
If you are connecting to your robot directly over wifi you probably want to
automatically configure your wireless adapter
For me I got a little complicated networking setup but it should be working.
So to check I'm going to go properties in my internet settings
And check my IPv4 settings
See sometimes it doesn't work so you got to set this manually
Its really easy 10. (heres your team number again)
10.8.65.11 or any number that isn't 2 or 4
Subnet mask is the same and you can leave all that stuff the same
Just hit "close"
And everything works and this should actually show "you don't have internet"
Oh there we go "teleoperated-disabled"
Let's go ahead and deploy our code
So all we have to do is hit the run button and now we wait
So what it does here is run all the first stuff
Pre-verify, Build , Deploy
I actually had to make a modifcation to the ant build file
Because it they were trying to use a file that didn't exist
For some reason, because they were trying to link to the global platform
Preverify where I had to statically link to the windows preverify executable
This means that this won't work on OSX or linux but you should be able to figure it
out
By going into the pre-verify and changing your location to your executable on your operating
system
So our robot is working!
That println from earlier is working
This is actually running on a physical robot right now
I don't know if you can hear the humm of the robot in the background
So its actually working
So there you have it guys this is how you get the FRC2014 SDK
In intelliJIdea (my preferred IDE)
You can always do more things like VCS intergration
You can do git you can do subversion it is great for team's gitHubs
I would highly recommend this ide to any team
It is abit tricky so you probably want to have someone with abit of Java Experience
Instead of just try dive into it
But its a great IDE
I hope you guys enjoyed and
Good luck this season