Installing FRCSim Manually (Ubuntu)

FRCSim is best supported on Ubuntu 14.04, but you can run it on any platform supported by Gazebo. See http://gazebosim.org/tutorials For how to install. Gazebo does not yet run on windows.

Understanding Dependencies

FRCSim is nothing more than a collection of existing software plus a few small libraries. In order to use FRCSim, you will need the following:

  • Gazebo (5.0 or later)
  • Eclipse (Mars or later)
  • Gcc 4.9
  • Java 8
  • WPILib Eclipse Plugins
  • WPILib Gazebo Plugins
  • Google's Protobuf library

Even if you're team is only using C++, you still need java8.

Furthermore, even if you're team is only using Java, you still need g++-4.9

Open Terminal

Open Terminal

1. Click on the Ubuntu icon (just below the top-left corner)

2. Type “terminal”

3. Click on the terminal application

Adding repositories to Apt

On Ubuntu 14.04, You'll need to tell Apt where to find the package you want. If you are using 15.10 you can skip this step

Run the following in your terminal, but only the ones marked for you version of ubuntu

    sudo add-apt-repository ppa:openjdk-r/ppa -y #ONLY FOR 14.04 and 15.05
    sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y #ONLY FOR 14.04 
    sudo apt-get update

The first PPA is for java, and the second is for g++-4.9.

If you intend to also compile C++ programs for ARM as well as for Simulation, you'll need to install the C++ toolchain. See Installing Eclipse (C++/Java)

Install Dependencies From Apt

Install a bunch of our dependencies from apt. Run this in the terminal.

sudo apt-get install g++-4.9 openjdk-8-jdk

You can confirm that it worked by typing the following. The output should be similar to the image below.

g++ --version
java -version
Install Dependencies From Apt

Fixing Executable Locations and Names

For some versions of Ubuntu, you may run into issues where g++ --version gives you 4.8 instead of 4.9.

You can verify the issue by looking at the output of:

ls -l /usr/bin/g++

If it looks like this, then you've got a problem. Here it says the g++ actually points to g++-4.8, which is not what we want.

lrwxrwxrwx 1 root root 7 Jan  4 19:05 /usr/bin/g++ -> g++-4.8

To fix this, we simply run the following, which tells g++ we want 4.9, rather than 4.8.

sudo rm -f /usr/bin/g++
sudo ln -s /usr/bin/g++-4.9 /usr/bin/g++

Install Eclipse

Installing eclipse is a little more work, since we want the latest version. Use the following commands to download and install.

wget -O eclipse.tar.gz \
        http://eclipse.mirror.rafal.ca/technology/epp/downloads/release/mars/1/eclipse-cpp-mars-1-linux-gtk-x86_64.tar.gz 
tar -xf eclipse.tar.gz
sudo mv eclipse /opt
sudo ln -s /opt/eclipse/eclipse /usr/bin/eclipse

Install WPILib Eclipse Plugins

1. add a new software site http://first.wpi.edu/FRC/roborio/release/eclipse

2. Continue with install, and restart eclipse.

See Installing Eclipse (C++/Java) for more detailed instructions

Install Gazebo

See the gazebo website (https://gazebosim.org) for detailed instructions, or just run this in the terminal.

wget -O /tmp/gazebo6_install.sh http://osrf-distributions.s3.amazonaws.com/gazebo/gazebo6_install.sh; sudo sh /tmp/gazebo6_install.sh

Install WPILib Gazebo Plugins

Install WPILib Gazebo Plugins

The last dependency is the gazebo plugins and example models. These will be distributed in the following zip file: http://first.wpi.edu/FRC/roborio/maven/release/edu/wpi/first/wpilib/simulation/simulation/1.0.0/simulation-1.0.0.zip

1. Download the zip

2. make a directory called simulation in the wpilib directory

mkdir ~/wpilib/simulation

3. Extract it to that new simulation folder

unzip ~/Downloads/simulation-1.0.0.zip -d ~/wpilib/simulation

4. Make sure you have installed the development package for gazebo. This should already be installed if you used the gazebo script above.

sudo apt-get install libgazebo6-dev

Build Gz_Msgs

You will need to compile and install gz_msgs, which is provided in the simulation.zip you just downloaded. This is so that same zip can work with many versions of protobuf and ubuntu.

Enter the ~/wpilib/simulation/gz_msgs directory and run the following commands:

sudo apt-get install cmake libprotobuf-dev libprotoc-dev protobuf-compiler -y
mkdir build
cd build
cmake ..
make install

You should now have libgz_msgs.so in ~/wpilib/simulation/lib and a few new header files in ~/wpilib/simulation/include/simulation/gz_msgs

Install Sample Robot Models

The field and game piece models for 2016 will be available on January 12th

 

There are a few sample models and worlds that will be useful when you develop your own custom robots. Models can be downloaded here (https://usfirst.collab.net/sf/frs/do/downloadFile/projects.wpilib/frs.simulation.frcsim_gazebo_models/frs1160?dl=1) and unzip into the ~/wpilib/simulation directory.

wget -O models.zip \
 https://usfirst.collab.net/sf/frs/do/downloadFile/projects.wpilib/frs.simulation.frcsim_gazebo_models/frs1160?dl=1 
unzip models.zip
mv  frcsim-gazebo-models-4/models ~/wpilib/simulation/
mv  frcsim-gazebo-models-4/worlds ~/wpilib/simulation/

Configuring your Development Environment

Now that you have all the dependencies, there are a few things you can do to make life easier. These steps are optional but recommended for your sanity.

1. Allow the executables to be run anywhere by making symbolic links to your /usr/bin directory

sudo ln -s ~/wpilib/simulation/frcsim /usr/bin/frcsim
sudo ln -s ~/wpilib/simulation/sim_ds /usr/bin/sim_ds

2. Pin frcsim, sim_ds, and eclipse to your taskbar. Even better, you can move the .desktop files for frcsim, sim_ds, and eclipse into the proper folder.

sudo mv ~/wpilib/simulation/frcsim.desktop /usr/share/applications
sudo mv ~/wpilib/simulation/sim_ds.desktop /usr/share/applications
sudo mv ~/wpilib/simulation/eclipse.desktop /usr/share/applications

3. Setup the icon for sim_ds. Run the following

sudo mkdir /usr/share/icons/sim_ds
sudo cp ~/wpilib/simulation/sim_ds_logo.png /usr/share/icons/sim_ds/

 

Ok, now that you have everything setup, continue to see how to build robots models and run them in simulation!

 

Video Walkthrough

5 Report Errors

Dean Brettle

In the following 2 lines:

mv frcsim-gazebo-models/models ~/wpilib/simulation/
mv frcsim-gazebo-models/worlds ~/wpilib/simulation/

"frcsim-gazebo-models" should be "frcsim-gazebo-models-4"

Also, in the following 2 lines:

ls -s ~/wpilib/simulation/frcsim /usr/bin/frcsim
ls -s ~/wpilib/simulation/sim_ds /usr/bin/sim_ds

"ls" should be "ln"

Peter Mitrano

good catch. Updating now...

Dean Brettle

The GearsBot and PacGoat examples assume that the world files are in /usr/share/frcsim/worlds but this manual installation leaves them in ~/wpilib/simulation/worlds. Either the example projects, the examples docs, or this page should be updated to refer ensure that the worlds are found.

Peter Mitrano

The world file set in eclipse is no longer used.
World files should be open by invoking the 'frcsim' command with an argument.

Example:

frcsim ~/wpilib/simulation/worlds/GearsBotDemo.world

This information will be updated in the GearsBot and PacGoat tutorials, as well as in a few other spots. Thanks for all your feedback--We appreciate it!!

Joe Kinsella

I have followed the instructions on a Macbook, adjusting them as required. I have all the components running on my system for the GearsBot example - e.g. GearsBot world loaded in Gazebo, Eclipse setup with sample project, and the DriverStation with a joystick recognized. But for some reason I cannot get them to work together (e.g. running changes made in Eclipse do not take place in Gazebo, joystick does not control the sim robot). I suspect the root cause is the DriverStation but not sure without some help. Is there any documentation on the communication between these components and how one can diagnose?

Thanks. Great doc. Happy to repost Mac instructions if I can get past this final step.

Use this form to report any errors with the documentation. For help with WPILib, please use the FIRST Forums at http://forums.usfirst.org For reporting WPILib bugs, please submit an issue on GitHub at https://github.com/wpilibsuite/allwpilib/issues/new

Ignore