Welcome to arm-ros2
! This repository will host the ROS 2 (Jazzy) version of the RSX arm control software, migrated from the arm/
folder in the old ROS 1 rsx-rover
repo. Proceed with caution.
Make sure you have the following:
- Ubuntu 24.04
- ROS 2 Jazzy fully installed and sourced (https://docs.ros.org/en/jazzy/Installation.html)
Get the essential tools:
sudo apt install python3-colcon-common-extensions python3-rosdep python3-vcstool
Initialize rosdep (once per machine):
sudo rosdep init
rosdep update
- Create a new workspace
mkdir -p ~/arm_ros2_ws/src
cd ~/arm_ros2_ws
- Clone this repository
cd src
git clone https://github.com/rsx-utoronto/arm-ros2.git
- Install dependencies listed in package.xml
cd ~/arm_ros2_ws
rosdep install --from-paths src --ignore-src -r -y
- Set up a Python Virtual Environment We'll isolate all Python dependencies (outside ROS) in a virtual environment.
sudo apt install python3-venv
python3 -m venv arm_env
source arm_env/bin/activate
Then add this to your .bashrc
alias workon_arm="cd ~/arm_ros2_ws && source arm_env/bin/activate && source install/setup.bash"
Now whenever you run workon_arm
you will be able to get into the environment. To exit it just run:
deactivate
- Build the workspace
colcon build --symlink-install
- Source the setup files
source install/setup.bash
Create a requirements.txt in the repo root that looks like this:
numpy==[version]
scipy
geometry_msgs
rclpy
And then, add any dependencies you discover as you port the code. Install them inside the venv with:
pip install -r requirements.txt
arm-ros2/
├── arm_ros2/ # ROS 2 Python Package
│ ├── arm_controller.py # <- migrated version
│ ├── __init__.py
├── launch/
│ ├── arm.launch.py # <- migrated launch file
├── msg/
│ ├── ArmStatus.msg # <- if used
├── srv/
│ ├── ArmIK.srv # <- if used
├── setup.py
├── setup.cfg
├── package.xml
├── requirements.txt
- Analyze the Original
arm/
Folder
- Identify ROS 1 Python nodes using
rospy
. - Note topics, services, parameters, dependencies, and launch files.
- Document dependencies in
package.xml
.
- Set Up ROS 2 Package
- Rename package (e.g.,
arm_ros2
) and update metadata in package.xml and setup.py. - Add necessary ROS 2 dependencies:
rclpy
,std_msgs
, etc.
- Migrate Nodes Incrementally For each ROS 1 node:
- Create ROS 2 Python version using rclpy and ROS 2 APIs.
- Add entry point in setup.py:
entry_points={
'console_scripts': [
'arm_controller = arm_ros2.arm_controller:main',
],
},
- Build, source, and test with:
cd ~/arm_ros2_ws
colcon build
source install/setup.bash
ros2 run arm_ros2 arm_controller
- Migrate Launch Files Convert .launch to .launch.py, using ROS 2 conventions:
from launch import LaunchDescription
from launch_ros.actions import Node
def generate_launch_description():
return LaunchDescription([
Node(package='arm_ros2', executable='mynode', name='mynode'),
])
- Add Custom Messages/Services/Actions
If migrating custom
msg/
,srv/
, oraction/
files:
- Place definitions in the respective ROS 2 directories.
- Update
package.xml
andCMakeLists.txt
. - Rebuild and import accordingly in nodes.
- Work only in this repository (
arm-ros2
); keeprsx-rover
as a reference. - Use feature branches for each node migration.
- Submit PRs and conduct peer reviews before merging.
- After migrating each node:
- Build:
colcon build
- Source:
source install/setup.bash
- Run & test:
ros2 run arm_ros2 <node> ros2 topic echo /<topic>
- Build:
- Track progress with an issue board (e.g., "Migrate node X", "Convert launch file Y").
- Engineering Specification and Background Research (FOCs, Research into task)
- Candidate Designs
- Don’t need a final design, block diagrams with explanation are fine
- Final Design
- Can be one of the previous two designs or something all new based on learned
- Can be a block diagram with research and explanation
<<<<<<< HEAD Example: (https://docs.google.com/document/d/1crGv72SZPlyTfEEYrCo4EamMKkqWRGyadf1QlVXck3k/edit?tab=t.0)
=======
59f99f9969848484fd33e52f05aab95b684c6208
Feel free to add any resources here:
- Renard, E. (2024). ROS 2 from scratch : get started with ROS 2 and create robotics applications with Python and C++ (1st edition.). Packt Publishing Ltd. (Access through UofT library)
- How to make a
requirements.txt
: https://www.geeksforgeeks.org/python/how-to-create-requirements-txt-file-in-python/ - Python virtual environment stuff: https://medium.com/ros2-tips-and-tricks/running-ros2-nodes-in-a-python-virtual-environment-b31c1b863cdb