- Ubuntu 22.04
- Visual Studio Code
- RTX Enabled NVIDIA GPU
- (Optional) An Xbox controller
Simply run sudo apt-get install nvidia-driver-525
in order to install the NVIDIA graphics driver for Ubuntu!
-
Install Docker and Nvidia Docker
Running./scripts/local-setup.sh
should install the requirements for this repository to run! At some point during running, it may prompt you for aROS_NAMESPACE
, which you can read more about here. Make sure to restart your machine once the script is done running! -
Install Remote Development VS Code Extension
This repository requires the Remote Development extension pack. Make sure to install it in the VSCode extensions window! -
Reopen in Devcontainer
Once installed, you can open the command pallate by pressing F1, and running the commandReopen in Container
in order to open the devcontainer. This might take a while, but once it's finished you should see a message appear in a console stating some helpful commands, along with a list of connected controllers and yourROS_NAMESPACE
which you set up earlier.
For the robot to run correctly, both in the simulation and in the real world, we use ROS2 in order to communicate between all of the parts of our project!
- Building the project
The entire project is built as a colcon task, so you can run it by pressing Ctrl+Shift+B in VSCode, or by runningcolcon build --symlink-install
in order to build all of the ROS2 packages.
To confirm that this worked, you can simply open a new terminal, and the warning message reminding you to build should be gone!
In the simulation
Omniverse is a NVIDIA product which allows for programs to cache their information quickly and reliably. It's not needed, but can save a lot on load times!
-
Download Omniverse Launcher
https://www.nvidia.com/en-us/omniverse/download/ -
Run Omniverse
chmod +x omniverse-launcher-linux.AppImage
./omniverse-launcher-linux.AppImage
-
Install Cache and Nucleus Server Click on the "Exchange" tab, and search for "Cache", which should return only one result. Nucleus Server should already be installing by default. Wait until both are downloaded and installed before continuing.
- Create Shaders
Isaac uses RTX heavily in order to accurately render graphics, which takes some powerful shaders. In order to get Isaac to build the shaders, runisaac-setup
inside the devcontainer in order to start compilation of shaders. - Launch Isaac
In order to actually start the simulation, just run the commandisaac
inside the devcontainer in order to start Isaac. It might take a while on first launch, but you should see the simulation window pop up eventually. - Load the robot
As you should be able to see, there's currently nothing in Isaac. It should be showing an empty scene with a popup window to the top left labeled "Import URDF" with a button that says "Load". If you press it, you should see the 2023 playing field appear, along with a brightly colored robot in the center!
- Start Isaac
Inside of Isaac, you should see a bar with a play button to the left. Click on it, or press Space in order to start the simulation. If everything works correctly, you should see the robot fall to the ground and be ready for movement! - Start the ROS2 Control Node
In order to get the robot to move around, you're going to need to plug in a controller and start the control node, something that you can do easily by runninglaunch isaac
inside the devcontainer.
If all goes well, you'll be able to move the robot around with the joystick! See Controls for more details on how to drive the robot.
Simulating the RoboRIO
The National Instruments RoboRIO is a required computer for the FRC competitions, and as such, all of our code to physically move robot parts has to be run through it.
In order to run this simulator, you'll have to navigate to the rio/
before running the following commands.
- Installing RobotPy
First, runpip install -r requirements.txt
in order to install robotpy and the other dependencies that the simulator needs. - Running the sim
Once you have the dependencies installed, all you'll have to do is runpython3 robot.py sim
to open the RoboRIO simulator.
To read more on the simulator, check out their docs here!
In real life
If you want to actually set up the robot, check out Setting up the Robot in order to get the onboard coprocessor running.
However, for debugging purposes, sometimes its easier to bypass this.
- Running the Robot
To run the robot code, make sure you're connected to your robots' network, and run the commandlaunch real
inside the devcontianer in order to start the robot code.
In order to debug and visualize the robot remotely, we use rviz in order to view joint poses and other ROS information published from the robot.
- Starting rviz
Luckily, we have another quick launch in order to start a preconfigured rviz, so you can simply open a new terminal (separate from the one runninglaunch real
), and runlaunch rviz
. This should open up a new rviz window with the robot inside. You may need to change some of the namespaces in the window, as when running the real robot, the namespace will switch to bereal
instead of whatever you entered in the setup script.
When it comes to driving the robot, you'll need a Driver Station, which we have two separate options to use.
- NI Driver Station
In order to run your robot during the competition, you'll need the official National Instruments Driver Station, with all alternatives being disallowed during competitions. For this, you're going to have to have a separate computer running Windows in order to install the FRC Game Tools, which installs the Driver Station as a part of it. - Conductor
Despite the National Instruments driver station being the only officially supported Driver, there are some community made alternatives that you can use! We recommend using Conductor, as it's one of the most feature complete community alternatives out there, and runs fully on linux, meaning that you don't need a separate computer, and you can run everything on just one computer!
Once you have a driver station setup, you should be able to enable teleop mode with an Xbox controller connected, and the robot should move when you move the joystick! See Controls for more details on how to drive the robot.
Debugging the robot
In order to debug the robot, we built our own debugger in Python and PyQT!
Simply run launch rio-debug
in order to open the debugger!
- Reading in published joint states
The joint states that are published from the robot to your computer are represented by the slider bars and buttons. Buttons are a togglable state where the output should be one of two values, whereas the sliders are joints where the output should be one of a range of values, usually used for wheels or other motors.
You can tell the current joint state from the robot by looking at the top slider bar, as it will reflect the actual position of the joint on the robot. For the buttons, the color of the button represents the stater of the joint, with green meaning that the state from the robot is the same as the current state from your computer, and yellow meaning that they are not the same.
You can also tell the states of the joints based on the boxes to the left of them, which should contain the exact numbers recieved from ROS. - Publishing out your own joint commands
To publish out your own joint commands, simply use the bottom slider, or click on the buttons in order to edit the joint state being broadcast out to the robot!
An incredibly difficult task which we've only done once or twice. This documentation is currently untested! Here be dragons!
- A National Instruments RoboRIO
- An NVIDIA Jetson Xavier
- A lot of patience
Because of how our repository is built on the RobotPy framework, you're going to need to install RobotPy.
Important Note: You'll have to follow these steps on your host machine, as there's currently a bug where RobotPy's deployment script does not work inside of the devcontainer.
Installing robotpy is as simple as navigating to the rio/
directory and running pip install -r requirements.txt
in order to install the dependencies of robotpy.
Unfortunately, this step is somewhat outside of the scope of this tutorial. We recommend you follow RobotPy's official setup guide for installing robotpy-installer
and getting python onto the RIO.
However, there is one thing not covered by the tutorial. You will have to run robotpy-installer download [package]
and robotpy-installer install [package]
for the wpilib
and rosbags
packages respectively.
To deploy to the RoboRIO, you'll need to connect your computer to the RIO, either over USB or over the network. Once you're connected you can run python3 robot.py deploy
in order to flash the script onto the RoboRIO.