Note

This section is optional, the ROS2 tutorial starts at ROS2 Installation.

Editing Python source (with PyCharm)

There are near-infinite ways to manage your Python code and, for this tutorial, we will use PyCharm. Namely, the free community version.

Installing PyCharm

PyCharm is a great program for managing one’s Python sources that is frequently updated and has a free edition. However, precisely because it is frequently updated, there is no way for this tutorial to keep up with future changes.

What we will do, instead, is to download a specific version of PyCharm for these tutorials, so that its behavior/looks/menus are predictable. If you’d prefer using the shiniest new version, be sure to wear sunglasses and not stare directly into the light.

Run

cd ~
mkdir ros2_workspace_pycharm
cd ros2_workspace_pycharm
wget https://download.jetbrains.com/python/pycharm-community-2023.1.1.tar.gz
tar -xzvf pycharm-community-2023.1.1.tar.gz

Create an alias for pycharm_ros2

To simplify the use of this version of PyCharm, let us create a bash alias for it.

echo "# Alias for PyCharm, as instructed in https://ros2-tutorial.readthedocs.io" >> ~/.bashrc
echo "alias pycharm_ros2=~/ros2_workspace_pycharm/pycharm-community-2023.1.1/bin/pycharm.sh" >> ~/.bashrc
source ~/.bashrc

Then, you can run PyCharm with

pycharm_ros2