-
Notifications
You must be signed in to change notification settings - Fork 29
Migrate to ROS 2 #350
Description
Background
ROS is no longer receiving updates and noetic will reach EOL by 2025. We need to migrate our stack to ROS 2 eventually to make sure we have access to the latest tools and versions of our dependencies. We should follow the migration guides as a baseline for updating our code-base.
There are a few ROS 2 features that complicate the migration process:
- Using
amentandcolconfor builds instead ofcatkin. For our purposes, this involves replacing allCMakeLists.txtwith asetup.pyscript. - ROS 2 does not use
roscoreto create a master node, instead it uses DDS to set up peer-to-peer communication. We need to scope out how this will work across multiple machines (onboard and landside). This tutorial is probably a good starting point. - The ROS API is now
rclpyinstead ofrospy. The framework for creating nodes changed a bit, so we'll have to modify every script in our code base.
Before we start making efforts to complete the migration, we should conduct a thorough analysis of our ROS dependencies to determine their equivalent packages in ROS 2. Once we've confirmed support or have viable alternatives for all packages, we can start efforts to migrate the rest of our code base. We'll surely run into more hiccups along the way, but for now the following tasks should be a good roadmap for the migration.
Testing
See #387
Important Notes
The general process for migrating a package to ROS2 is:
- Switch build system to
ament, replacingCMakeLists.txtwithsetup.pyand modifying file structure. - Switch client library from
rospytorclpy - Update pub/sub syntax
- Rewrite launch files in python
- Update README.md
Tasks
- Create current ROS dependency list with ROS 2 equivalents
- Build proof-of-concept to verify cross-machine functionality
- Update
setup_network.shto remove ROS master and replace with domain id - Test onboard/land-side connection on local machine
- Test onboard/land-side connection from robot to local machine
- Update
- Migrate all "easy" packages (landside first, then onboard)
- landside
- joystick
- camera_view
- simulation
- onboard
- acoustics
- avt_camera
- cv
- data_pub
- execute
- robosub_description
- sensor_fusion
- static_transforms
- system_utils
- landside
- Migrate all "hard" packages (controls, offboard_comms, task planning, gui?)
- Dereference
pidpackage in controls, rewriting PID logic - Rewrite current state of task planning to use executive-smach or some other tool
- Implement
micro-rosin place of rosserial, which involves swapping hardware (See Swap to Nano RP2040 Connect #375) - Once everything is updated, we can migrate
gui.
- Dereference
- Update
build.shto usecolconinstead ofcatkin - Update docker images with ROS 2 dependencies (base image and packages)
- Update pytorch installation version and
jetson-pytorchimage? Not sure if cv is using pytorch anymore.
- Update pytorch installation version and
- Update Github CI (particularly launch file testing and building)
- Test each package on Cthulhu. See Execute ROS2 migration testing plan #387
- Make a ROS2 knowledge transfer video documenting how the code-base changed how the new system works
- Update main README and tutorial documentation.