FRCSim Installation Tutorial with Markdown formatting
Written & Provided by FRC 1923: The MidKnight Inventors
Formatted text (like this line) represents shell commands; run them in a terminal.
Once you have downloaded the .iso file, burn the file to a USB flash drive (> 2GB)
Download WPILib (somewhat different on ubuntu) by adding the repository first.
sudo apt-add-repository ppa:wpilib/toolchain
Then you need to add java (warning: you will get a deprecation notice):
sudo add-apt-repository ppa:webupd8team/java
Run the following command - you should see all of the packages that you just installed:
sudo apt-get update
Now, paste the following command as is:
sudo apt-get install \ git \ libc6-i386 \ curl \ jstest-gtk gradle oracle-java8-installer \ frc-toolchain meshlab cmake libprotobuf-dev \ libprotoc-dev protobuf-compiler
Now we will edit the file /etc/environment.
sudo nano /etc/environment
Append a line with the following. This will define a system-wide variable named JAVA_HOME that references the install location of Java on your machine:
JAVA_HOME="/usr/lib/jvm/java-8-oracle"
Immediately load the /etc/environment configuration file you just created.
source /etc/environment
List the contents of your Java installation directory using your new $JAVA_HOME variable.
ls $JAVA_HOME
You should see contents like this, which means that your system is properly referencing the Java installation directory we set above.
bin | LICENSE |
COPYRIGHT | man |
db | README.html |
include | release |
javafx-src.zip | src.zip |
jre | THIRDPARTYLICENSEREADME-JAVAFX.txt |
lib | THIRDPARTYLICENSEREADME.txt |
Install eclipse: https://www.eclipse.org/downloads/download.php?file=/oomph/epp/oxygen/R2/eclipse-inst-linux64.tar.gz
When prompted to choose a workspace, use the default value and click OK. The workspace is the directory where Eclipse will save your programming projects, and defaults to $HOME/workspace.
On the menu bar, go to: Window -> Preferences -> Java -> Installed JREs
Go to: Window -> Preferences -> General -> Workspace
Note that, if you used all the default settings, Eclipse should now be installed at $HOME/eclipse/java-oxygen/eclipse.
Name: FRC Plugins
Location: http://first.wpi.edu/FRC/roborio/release/eclipse/
Click Ok
Gazebo (the simulator software) allows you to test your robot code in a (modeled) 3D space.
curl -ssL http://get.gazebosim.org | sh
“With FRCSim, you should be able to finish 90% Of your programming without ever touching a RoboRIO. We want you to be able to test your code BEFORE you put in on your robot, and before the robot is even built. FRCSim allows robot code written in C++ or Java that normally runs on your RoboRIO to be run on your laptop or desktop. It connects to custom robot models in the Gazebo robot simulator.“ [3]
curl -o \ $HOME/Downloads/simulation-2017.2.1.zip http://first.wpi.edu/FRC/roborio/maven/release/edu/wpi/first/wpilib/simulation/simulation/2017.2.1/simulation-2017.2.1.zip
mkdir $HOME/wpilib/simulation
Unzip our simulation files to the directory we just created.
unzip \ $HOME/Downloads/simulation-2017.2.1.zip \ -d $HOME/wpilib/simulation
Create a system-wide symlink to the frcsim (FRC simulator) program.
sudo ln -s $HOME/wpilib/simulation/frcsim /usr/bin/frcsim
Create a system-wide symlink to the sim_ds (simulated driver station) program.
sudo ln -s $HOME/wpilib/simulation/sim_ds /usr/bin/sim_ds
We must manually compile the wpilib simulation plugins for FRCsim in order for the simulator to work properly on Linux.
Navigate to the $HOME/Downloads directory in your terminal.
cd $HOME/Downloads
Use git to download some wpilib code that we must compile on our machine.
git clone https://github.com/wpilibsuite/allwpilib
Navigate to the allwpilib code that we just downloaded.
cd $HOME/Downloads/allwpilib
Check out a specific version of the code we just downloaded.
git checkout v2017.3.1
Run the gradlew script. That script will use gradle, a software build tool, to compile the software we just downloaded. This script takes a while to run. Though, occasionally, I see this script freeze and hang. If that happens, it is safe to kill this and re-run it.
./gradlew build -PmakeSim
Copy the plugins we just compiled into our simulation plugins directory.
cp ./build/install/simulation/plugins/* \ $HOME/wpilib/simulation/plugins/
Install model and world files 2018 simulation files have not yet been released (and the 2017 files were never shared either) but we can install the 2016 simulation worlds and models to give us something to work off. Download some 3D models for our simulation.
curl -o \ $HOME/Downloads/models.zip \ https://usfirst.collab.net/sf/frs/do/downloadFile/projects.wpilib/frs.simulation.frcsim_gazebo_models/frs1160?dl=1
Unzip the model files into our $HOME/Downloads directory.
unzip $HOME/Downloads/models.zip -d $HOME/Downloads/
Copy the downloaded gazebo simulation models into our simulation directory.
cp -r $HOME/Downloads/frcsim-gazebo-models-4/models \ $HOME/wpilib/simulation/
Copy the downloaded gazebo simulation worlds into our simulation directory.
cp -r $HOME/Downloads/frcsim-gazebo-models-4/worlds \ $HOME/wpilib/simulation/
Download the official 2016 game arena world file to our simulation directory.
curl -o $HOME/wpilib/simulation/worlds/frc2016.world \ "http://first.wpi.edu/FRC/roborio/release/simulation/downloads/frc2016.world"
Create a sample application In eclipse: Eclipse -> New -> Other -> Example Robot Java Project -> GearsBot -> Finish. Run
frcsim
Wait until Gazebo has finished loading. Once Gazebo loads, insert the sample GearsBot robot provided by FRC. Gazebo -> Insert -> Models -> GearsBot Click somewhere in the world to place your model. Close everything open right now
Running Auton You only need to do this step once: install the 2016 field
curl -o $HOME/wpilib/simulation/worlds/frc2016.world \ "http://first.wpi.edu/FRC/roborio/release/simulation/downloads/frc2016.world"
First open eclipse and run a eclipse 2016 prgm as a simulated robot deployment then type:
frcsim $HOME/wpilib/simulation/worlds/frc2016.world
then place the robot in the field then type in:
sim_ds
then click auton Then click enable You auton code should be simulated
Troubleshooting:
$HOME/downloads
and the simulation folder in $HOME/wpilib/simulation
Download links:
allwpilib
Simulation[Err] [Master.cc:96] EXCEPTION: Unable to start server[bind: Address already in use]
There is probably another Gazebo process running (even if you cannot see it open in a window), so you just need to restart your computer
cd /directory/of/repository ant jar
Sources: