Simulating GearsBot with FRCSim

This tutorial walks you through running the GearsBot example, assuming you already have FRCSim installed.

 

A demo video of the end result can be found on the official WPILib channel here:

https://www.youtube.com/watch?v=LEJaTjNZxQI

Open Eclipse

Open Eclipse

1. If you correctly followed the last optional steps in the article Installing FRCSim The Fun Way (Manually), then you can simply type "eclipse" in the launcher. Otherwise, you will have to open a terminal and run eclipse.

2. Type “eclipse”

3. Click on the eclipse icon

Open the workspace

Open the workspace

Click OK

Welcome to Eclipse

Exit the welcome menu

Start a new project

1. Click New Project

2. If using Java

   (a) Expand WPILib Robot Java Development

   (b) Select Example Robot Java Project

3. If using C++

   (a) Expand WPILib Robot C++ Development

   (b) Select Example Robot C++ Project

4. Click Next

Set your team number

Set your team number

1. Enter your team number

2. Click Next

Choose the GearsBot example

Choose the GearsBot example

1. Select the GearsBot example

2. Click Next

Naming the project

Naming the project

1. Type in a project name such as “GearsBot”

2. Click Finish

Switching to the C++ Perspective (for C++ programs only)

Switching to the C++ Perspective (for C++ programs only)

The C++ perspective sets up the eclipse environment with toolbars and menus specifically for developing C++ applications. To switch to the C++ perspective:

  1. In the upper right corner click on the arrow.
  2. Select C/C++

Switching to simulation compilation (for C++ programs only)

Switching to simulation compilation (for C++ programs only)

Selecting the drop-down menu (down-arrow) next to the "hammer" icon in the toolbar, you can select the default compilation target. Choose Linux Simulate to set the default for your robot simulation project.

Launching The Simulator

Running frcsim from the terminal is the better option because you can see error messages, and other information printed.

Open up a terminal and run the following.

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

Launching the DriverStation

Launching the DriverStation

If you created a sim_ds.desktop file as shown in Installing FRCSim The Fun Way (Manually) simply open the launcher and type sim_ds.

Or, open a terminal and run:

sim_ds

Running Your Code

Running Your Code

1. Right click on the project

2. Select Run As

3. Click WPILib Simulation

Running Autonomous

Running Autonomous

1. Make sure the simulator is running

2. Select Autonomous

3. Click Enable

4. You should observe something like this video.

Using a PS3 joystick to drive

Using a PS3 joystick to drive
  1. Plugin a joystick (preferably a PS3 SIX AXIS/DUALSHOCK) Start the simulator
  2. Select Teleop
  3. Click Enable
  4. Drive around and pickup soda cans (button mapping available in appendix)

2 Report Errors

Steven Chin

The tutorial shows a window entitled "FRC Simulation Driverstation" popping up over Gazebo, but this does not happen so I'm unable to control the simulated robot. Where is "FRC Simulation Driverstation" supposed to come from?

Peter Mitrano

There's a step dedicated to launching the Driverstation. Does it work for you?

http://wpilib.screenstepslive.com/s/4485/m/23353/l/228980-simulating-gearsbot-with-frcsim#LaunchingTheDriverstation

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