-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate to ROS 2 #350
Comments
Dependencies
Concernstftf isn't supported in ROS2, so we need to upgrade all references of tf to tf2. The main usage of tf in our code-base is for the pidROS2 doesn't have a dedicated pid package, but they provide rosserial and rosserial_arduinoThe general consensus is that MicroROS is the alternative to rosserial and rosserial_arduino. It does not support the Nano Every, so we would have to upgrade to the Nano RP2040 Connect, a more powerful Nano. I looked at its specs and I can't see an immediate issue with upgrading to this sku, but we need to investigate this more. smachSmach is not supported on ROS2, and I haven't seen any communication indicating that it will be in the future. Before upgrading, we would need to migrate to a different task framework. This is particularly painful because we've invested a lot of time into getting smach working and that seems to be a major area of interest this year. |
For smach, since it doesn't look like you're using smach_ros (the ros extensions for smach), you should just be able to copy it from the smach repo over to here (its just the smach folder at https://github.com/ros/executive_smach). Only porting you'll have to do is to update the build system stuff, which should be fairly simple, especially since they are already using a setup.py. If you do need the ROS extensions, it shouldn't be hard to port over if you choose to do so. I'd also be happy to do that and release it to the larger ROS community, just lmk. Also, just to note, I think I saw a few people port smach to ROS2, but not sure where that code is (it'll only be community supported). cc @Brokemia |
Thanks for looking into that! We have some contacts with this year's finalist teams (BumbleBee, etc.) so we'll reach out to them to see what kind of systems they use for task planning. After speaking with @Brokemia and @Will-Denton I think the consensus is to just use a python package (whether that be smach or whatever) to handle state machines because we aren't really leveraging the ROS portion of smach. Will keep you in the loop with whatever decisions we make on this. |
UpdatesOffboard commsInstead of using MicroROS, I think that we should implement our own serial bridge and get rid of all of the ROS code in the Arduino. MicroROS has some pretty serious limitations with low memory controllers (like the Nano) that seem to make it more hassle than its worth. Instead, we should create a python ROS node in offboard comms that subscribes to the servo and thruster topics and sends them to the arduino over serial. It will also receive pressure data over serial from the arduino and convert it to the expected ROS topic. This will also let us use ROS2 without having to upgrade our Arduino, even though that should be done regardless. ControlsThe migrated pid loops expose a similar ROS interface as before with services replacing the enable and reset topics. I have some concerns on the performance of the loops as they're now written in python instead of c++, but we'll monitor this and determine if we need to do anything about it. There are a couple of things we can do to speed things up:
Task PlanningWe're currently in the process of refactoring task planning on our main ROS branch (See #371). For now we can hold off on migrating this to ROS2 as there's plenty of stuff to test before we migrate task planning. Once offboard_comms is migrated, the ROS2 code-base should be ready for system-wide testing. |
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:
ament
andcolcon
for builds instead ofcatkin
. For our purposes, this involves replacing allCMakeLists.txt
with asetup.py
script.roscore
to 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.rclpy
instead 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:
ament
, replacingCMakeLists.txt
withsetup.py
and modifying file structure.rospy
torclpy
Tasks
setup_network.sh
to remove ROS master and replace with domain idpid
package in controls, rewriting PID logicmicro-ros
in place of rosserial, which involves swapping hardware (See Swap to Nano RP2040 Connect #375)gui
.build.sh
to usecolcon
instead ofcatkin
jetson-pytorch
image? Not sure if cv is using pytorch anymore.The text was updated successfully, but these errors were encountered: