topic_based_ros2_control
is currently only released for ROS2 Humble and Rolling. For other ROS2 releases, you may need to build it from source.
sudo apt-get install ros-$ROS_DISTRO-topic-based-ros2-control
These instructions assume you are running on Ubuntu 22.04:
-
Install ROS2 humble. You can stop following along with the tutorial after you complete the section titled: Environment setup. Make sure you setup your environment with:
source /opt/ros/humble/setup.bash
NOTE: You may want to add that line to your
~/.bashrc
-
NOTE: If installing on a fresh OS, run
sudo rosdep init
androsdep update
before the install script -
Create a colcon workspace (Note: Feel free to change
~/ws_ros2
to whatever absolute path you want):export COLCON_WS=~/ws_ros2/ mkdir -p $COLCON_WS/src
-
Get the repo and install any dependencies:
cd $COLCON_WS/src git clone git@github.com:PickNikRobotics/topic_based_ros2_control.git rosdep install --ignore-src --from-paths . -y # Pick a ROS_DOMAIN_ID that doesn't clash with others # This one need to be the same value as TopicBased's domain id (0 by default) echo 'export ROS_DOMAIN_ID='<YOUR-NUMBER> >> ~/.bashrc
-
Configure and build the workspace:
cd $COLCON_WS colcon build --symlink-install --event-handlers log-
-
Source the workspace.
source $COLCON_WS/install/setup.bash
Note: Whenever you open a new terminal be sure to run
source /opt/ros/humble/setup.bash
,export COLCON_WS=~/ws_ros2
, andsource $COLCON_WS/install/setup.bash
. You may want to add those commands to your~/.bashrc