-
Notifications
You must be signed in to change notification settings - Fork 11
Setting Up The Simulator
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
- 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()
}
- (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"
}
-
(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.
-
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 usinggradlew runJavaSnobotSim
- 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 forcom.snobot.simulator
to find the simulator launcher.
- 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
-
Update the recently created file
<project_dir>/simulator_config/simulator_config.properties
, and change therobot_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