What is ROS
According to ros.org, “The Robot Operating System (ROS) is a set of software libraries and tools that help you build robot applications. From drivers to state-of-the-art algorithms, and with powerful developer tools, ROS has what you need for your next robotics project. And it’s all open source.” This is a pretty apt description because it doesn’t fall into the trap of describing what the core ROS code is. Because, at its core, ROS is a messaging framework for distributed applications. However, ROS’s libraries, tools, and open-source nature make it unique.
Note: When I say ROS, I am specifically referring to ROS2 (I am currently using ROS2 Jazzy)
Motivation
Seeing teams such as CyberKnights (195) and Zebracorns (900) successfully implement ROS on their competition robots inspired me to see what was possible with the open nature of the FRC control system. Teams continually struggle with the tight build, program, and test cycle in FRC. In an FRC season, you have barely six weeks to go from an idea of what the robot needs to accomplish to a fully functional, programmed, and tested robot. This is especially hard considering most teams don’t even have a built robot until near the end of these six weeks. I propose using ROS to lighten teams’ software load during the season.
Teams have continually tried to improve their simulation capabilities and implement newer and more advanced controls such as state space and linear quadratic regulators that Tyler Veness has added into WPILib and detailed in his awesome book (seriously it is amazing, if you are at all interested in control theory I highly recommend giving it a read here). But, over my time in FRC I have come to the opinion that teams dont need more advanced control algorithms or more complex simulations, they need tested and working control code. This means writing as little control code as possible which is slightly at odds with the current FRC paradigm where teams write their own robot code and sparingly use vendor dependencies for hardware interaction and path planning. This results in teams continually reimplementing the same exact code to control the realitvely few mechanisms that every team in FRC decides to deploy on their robot.
This is where I propose ROS comes into play, by leveraging the composable node architecture of ROS we can reuse code from previous robots simply by running an already written node, or we can use part of another teams code simply by pulling and running their nodes. Since all ROS nodes need to communicate through a distributed pub/sub architecture that automatically handles message serialization and message type code generation we can write generic interfaces between different parts of our robot control such that they can easily be swapped out for a different implementation or removed entirely.
Differences from previous implementations:
Looking at how teams have implemented ROS in the past there a few things that I would like to do differently in my approach:
-
Simulation: Utilizing Gazebo to do full physics based robot simulation will allow many teams to program and validate their full control system including vision and sensing without a physical robot or field.
-
Leveraging Open Soure: A major benefit of ROS is the massive breadth of open source nodes and packages such as ROS2_control, ROS2_controllers, MoveIt2, and Nav2. Utilizing these as much as possible will reduce the amount of reimplementation needed for every robot,
-
Use ROS2_Control: Many of the previous implementations do not use ROS2_Control. I think this is a downside to some of the previous implementations, ROS2_Control allows for hard realtime control loops in ROS while not requiring you to write new controllers or hardware interfaces for each mechanism. By creating a set of hardware interfaces working with ROS2 Control for all the major FRC motors we can allow controlling motors from the ROS network directly through a CAN connection for the coprocessor or over a network connection between the coprocessor and the RoboRIO,
-
Contributing to the Open Source Robotics Community: Many of the geometry and control algorithms integrated into WPILib that we all take for granted are much more advanced than what other robotics competitions and hobbyists have access to. By developing reusable ROS nodes that conform to the ROS standards, we would all be able to have a much greater impact on the community as a whole.
Current Implementation Plans:
Currently, I plan on implementing a set of hardware interfaces to communicate with the motor controllers that my team uses (Talon FX, Talon SRX, Spark Max) and the sensors we commonly use (CANCoder, Pigeon IMU, BeamBreaks). I also plan on implementing a Swerve Drive Controller, After that I plan on experimenting with using behavior trees as an alternative to command based architecture.
Current Progress:
I have started writing a Talon SRX hardware interface that talks to the RoboRIO over the network utilizing ZMQ and ProtoBuf (very heavily inspired by CyberKnights)
I have also started working on a simulated SwerveDrive to test the controller, kinematics, and odometry.
Goals and Timeline:
Goals for this project include:
-
Being able to write a full FRC robot in ROS before the 2025 season.
-
Running a ROS robot at Roboticon and Pirates Pillage offseason events
-
Creating a written and video tutorial series to bring the power of ROS to other teams in FRC and create better documentation for the open source robotics community in general
How to get involved:
This is a massive undertaking for one person so i would love some help. If you have a strong passion for robotics and programming I would love to talk to you. The best ways to contact me are this Chief Delphi thread for more general questions or comments, or my teams discord server. The link for the discord server is below and my name in the server is Henry. Please don’t hesitate to reach out or just join to hang with the awesome community we have in there.
My current plan is to make a post on CD about once a week detailing my current progress and starting to create tutorials for how you can get started on programming your own robots in ROS.
Note #2: Tyler Veness (@calcmogul) I would love to chat with you about the WPILib lie theory implementation of Swerve Drive Odometry.