Simulator Tutorial Provided to you by BXD
Simulator Tutorial
Provided to you by BXD
The Synthesis FRC Robot Simulator allows you to test your robot designs, practice
driving, and test code in a simulation environment. This tutorial will teach you
how to:
- Navigate the user interface.
- Load your fields and robots.
- Configure inputs and graphics settings.
- Use the main simulator.
- Configure your robot for Driver Practice Mode.
- Use Driver Practice Mode.
Navigating the User Interface
Click on Synthesis from the launcher. The window above should be the first thing
that you see. To begin, click on the START button.
This is where you select your simulation mode. For the sake of this tutorial, we
will start with the main simulator. Click on the SELECT button on the main
simulator panel.
To start the simulator, we need to load in a field and robot first. Let’s start by
selecting a field. Click on the CHANGE button on the field panel.
Loading Your Fields and Robots
This is where you select your field from a set directory that should contain all your
fields. If there is no field found in the default directory, you need to change the
directory. Click on the CHANGE FIELD DIRECTORY button.
This is the directory browser. To select a directory, just click on it. Navigate
through your folders until you find your field folder. Click on it.
Once you’ve selected your field directory, you should see all your fields. Click on
the SELECT button on the bottom right to change the default directory to this one.
Note: Do not select an individual field folder, the file browser is looking for the
folder CONTAINING all your fields, not a specific field folder.
Once you’re done, the fields should show up in the selection list. Click on any field
to select it and click the SELECT FIELD button to confirm your selection.
Repeat the same process to select your robot.
Once you have the field and robot selected, you are ready to start the simulation.
However, let’s make sure that the input and graphics settings are configured to
your preferences. Click on the OPTIONS button on the top navigation bar.
Configuring Inputs and Graphics Settings
In the options menu, you can change your input and graphics settings. If you are
not using the code runner, you’ll be using the inputs here to drive your robot.
Click on any input to change it. While it is highlighted, you can press any key to
rebind that input. You can scroll down to see and change more inputs.
NOTE: The PWM inputs only sends a PWM signal value of 1 or -1 to the joint
motor.
Click on the GRAPHICS button once you are done with configuring inputs.
In the graphics menu, you can change the resolution and screen mode to be
tailored to your preferences. If you are running a low-end machine and/or are
concerned with performance, we recommend running on full screen and a lower
resolution.
Once you are done configuring your settings, click on the SELECT button on the
top navigation bar to return to the simulation start screen.
Click on the START button to begin the simulation. It might take a while to load
based on the complexity of the field.
Using the Simulator
You should now be in the simulator. Let’s go over the different things you can do
in it.
- You can control the robot with either the inputs you defined earlier or with
your robot code if you are using the code runner (default inputs are arrow
keys to move and 1,2,3,4,5, and 6 to control various PWM signals)
- You can change cameras by pressing the input key for camera toggle
(default: “C”)
- You can reset your robot’s position by pressing the input key for robot reset
(default: “R”)
- You can re-orient your robot by pressing the input key for robot orient
(default: “O”)
The stats window in the top right gives you data about various statistics of your
robot. You can hide and show it by pressing the input key for showing stats
window. (default: “S”)
You can move around the orbiting robot camera view with the following controls:
- Hold the left mouse button and move your mouse back and forth to zoom
in and out respectively.
- Hold the right mouse button and move your mouse around to rotate the
camera view.
You can move around the Freeroam camera view with the following controls:
- Hold the left mouse button and move your mouse around to both zoom in
and out and rotate the camera view left and right.
- Hold the right mouse button and move your mouse around to rotate the
camera view.
Press the ESC key or click on the MENU button to bring up the menu.
In here, you can also switch camera views, reset robot, and orient robot. You can
also switch to a different robot if you want.
This time, however, you can double click on a robot folder to select it and switch
robots.
That’s all you need to know to run the basic simulator!
NOTE: In this mode, you cannot actually pick-up/release game pieces due to the
limitations of our current physics engine. While we are working on implementing
a new physics engine that does allow for a much more realistic simulation (Bullet
Physics), you can still practice interaction with game pieces in an idealistic
environment in our Driver Practice Mode. The tutorial for setting that up is below.
Configuring Robots for Driver Practice Mode
Driver Practice Mode uses preconfigured fields and requires a robot to be
configured beforehand. In order to configure your robot for this mode, you will
need to select Driver Practice Mode from the Main Menu.
If you are still in the normal simulation, you can exit out by pressing ESC and the
QUIT TO MAIN MENU button.
Click the BACK button to go back to the mode selection menu.
Select Driver Practice Mode.
Select a field following the same steps showed before.
However, because Driver Practice Mode uses preconfigured fields, the field
selection list will only list fields that have been preconfigured. The Synthesis
installation comes with preconfigured fields, so just navigate the directory
browser to the Fields folder in the installation. Once you have done that, you
should see something like the above.
Once you’re done with that, load in any robot the same way you would in the
normal simulation mode.
Once you have selected a field and robot, click the “Next” button.
Click on the “Start Robot Configuration Environment” button.
This is the robot configuration environment. The same controls in the simulation
apply in here, including robot reset and camera toggle.
To configure your robot, you will need to:
- Specify two nodes, or joints as game piece interactors.
o The first is the mechanism that intakes a game piece (i.e. picking up a
ball or sucking in a tote)
o The second is the mechanism that releases a game piece (i.e.
shooting a ball or releasing a tote)
- Define two vectors
o The first is the velocity vector of the game piece as it is released. You
will have to fine tune this so that both the trajectory of the ball
matches what it would be in reality.
o The second is the offset of the game piece as your robot carries it.
The game piece is automatically clipped to the mechanism that you
specified earlier, but its position may be off. You will need to fine
tune this so that the game piece is clipped to the position that it
would be in reality.
To specify a node as a mechanism, click on a mechanism in the “Specify Nodes”
list. It should pop up a “Specifying Node” window in the bottom right. This
window will highlight the node selected so you know which one you are selecting.
Once you have the desired node selected, click the “Save” button. Do this for all
mechanisms.
NOTE: If you do not have a shooter/pickup configured as a joint, you can just
select node_0.bxda to have the main frame of the robot act as a game piece
interactor.
Let’s test if the right nodes have been specified. Click on the “Spawn Game Piece”
button in the top right menu bar. This will spawn a game piece of the field that
was selected earlier.
Hold the input key for intake (default: “Space”) and drive to the game piece to
pick it up. If you have specified the nodes properly, it should clip on to desired
node.
Notice how the ball is offset to the corner of the frame. This robot should be
holding the ball in the center of its frame (It has a catapult shooter). In order to fix
this, we have to define the ball offset vector.
Click on the offset vector item in the “Define Vectors” list to change it. A window
will pop up in the bottom right where you can change a position vector to have
the ball be clipped to the right spot on your robot. Clicking save will automatically
update the game piece’s position according to the values that you typed in the
input boxes. This will require a bit of trial and error, but just tweak it until you get
it to your desired position.
After that, we need to define the release vector. This is a velocity vector that will
determine the trajectory of the game piece as you release it, so you might want it
to mimic how the robot shoots in reality. Press the input key for releasing
(default: “Right Shift”) to release the game piece and test if this vector is accurate.
Once you have tweaked this value, you should be good to go! Hit save and test it
out.
Continue to tweak the vectors until you are content with the robot’s
configuration. Then, click the “Save and Exit” button on the top right menu bar to
go back to the main menu.
You should now be returned to this screen and the Robot Status text should say
that your robot has been configured. To finally start Driver Practice Mode, press
the “Start” button.
You are now in Driver Practice Mode! This mode has all the same features of the
normal mode, except you can now:
- Spawn game pieces. (default: “Q”)
- Intake game pieces. (default: “Space”)
- Release game pieces. (default: “Right Shift”)
Enjoy practicing with your robot!