Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

Setting Up The Simulator

PJ Reiniger edited this page Jan 17, 2019 · 1 revision

There are many options for how you can set up the simulator. The following examples are listed in the recommended order, increasing in complexity. If you ares using C++ instead of java, check out the C++ Setup Guide

You can also check out some pre-made examples

GradleRIO updates

  1. Add the SnobotSimulatorPlugin to your script
plugins {
    id "java"
    id "jaci.openrio.gradle.GradleRIO" version "2019.1.1"// Should point to the at https://login.gradle.org/plugin/jaci.openrio.gradle.GradleRIO
    id "com.snobot.simulator.plugin.SnobotSimulatorPlugin" version "2019-0.2.0" apply false // Should point to the latest version at https://login.gradle.org/plugin/com.snobot.simulator.plugin.SnobotSimulatorPlugin
}


...............
// Somewhere after the deploy block, and before the dependencies block

apply plugin: com.snobot.simulator.plugin.SnobotSimulatorPlugin

configurations {
    snobotSimCompile
}

dependencies {
    // Comes with GradleRIO...
    compile wpi.deps.wpilib()
    compile wpi.deps.vendor.java()
    nativeZip wpi.deps.vendor.jni(wpi.platforms.roborio)
    nativeDesktopZip wpi.deps.vendor.jni(wpi.platforms.desktop)
    testCompile 'junit:junit:4.12'

    // SnobotSim
    snobotSimCompile snobotSimJava()
}

  1. (Optional) Override the simulator versions. If releases come out of sync with the plugin, or you want to stay back on an old CTRE version, etc, you can override things like so:

snobotSim {
    snobotSimVersion = "2019-0.0.1-RC"
    snobotSimCtreVersion = "5.12.0_V0_RC"
}
  1. (Optional) Setup the simulator for custom simulations, and ability to run unit tests with SnobotSim as a backend. Check out this example for how you can add extensions.

  2. Run the simulator by executing the task runJavaSnobotSim. IDE's like eclipse and intellij can do this, but you can always do it on the command line using gradlew runJavaSnobotSim

    1. You should be able to trick eclipse into running it as a standard project as well. If you use gradle to generate the .project and .classpath files by running gradlew eclipse, you should be able to run your project as a java application. The first time you do this, you might need to specify a "Main Class"; you can search for com.snobot.simulator to find the simulator launcher.
  3. Update the recently created file <project_dir>/simulator_config/simulator_config.properties, and change the robot_class to reflect the fully qualified class name of your robot.

NOTE: The simulator_config directory does not come as part of the plugin. It requires running the simulator once, at which point it gets auto-generated

NOTE++: This is hokey and will be updated to use the knowledge defined in your GradleRIO configuration to automagically set this up for you. Sorry for the inconvenience

Clone this wiki locally