Python uses packages to organize the functionality our code provides. Let's take a look at the ovearll structure of our project.
$ tree . ├── arm_01 │ ├── __init__.py │ └── basic_trajectory_action_service.py ├── config │ └── simple_controller.yaml ├── description │ ├── arm.urdf.xacro │ ├── meshes │ │ └── armA │ │ ├── armA_0.stl │ │ ├── armA_1.stl │ │ ├── armA_2.stl │ │ ├── armA_3.stl │ │ ├── armA_4.stl │ │ ├── armA_5.stl │ │ └── armA_6.stl │ └── xacro │ ├── armA.bumper_config.xacro │ ├── armA_core.xacro │ ├── armA.gazebo_config_control.xacro │ ├── armA.internal_config.xacro │ └── armA.transmission.xacro ├── launch │ └── arm_sim.launch.py ├── package.xml ├── resource │ └── arm_01 ├── rviz │ └── arm_01.rviz ├── setup.cfg └── setup.py
First of all, our project is located in [ros2 workspace]/src/arm_01. This is what "." symbol in the tree above represents.
arm_01/arm_01. In Python project, you will see such subfolders a lot. It contains scripts that I want to be able to use as part of a package, and also an empty __init__.py file, that lets Python know that it is part of a package.
The basic_trajectory_action_service.py script sends target points (angles for joints) to the robotic arm, making it move by a predefined directory.
config/simple_controller.yaml is used to configure Gazebo controller (see below). It tells Gazebo controller what joints we have and some of their parameters.
description/arm.urdf.xacro. This is the "main" URDF file for our robotic arm, and also a dummy one. Same as we used robot.urdf.xacro in our earlier projects: it has some definitions (like the gripper) to be used in future and a link to a armA_core.xacro, that contains the actual code.
description/meshes/armA. "armA" is the name of a manipulator we are going to create. I expect to (maybe) have armB, armC... As for the "meshes" folder, it contains STL files, the "meshes" describing the looks of our robot. In this context, "mesh" is simply a 3D model of a segment of a robotic arm.
description/xacro. This folder contains the "main" xacro file, armA_core.xacro, and four files that are used to configure the robot (see below).
launch/arm_sim.launch.py. The launch file we use to bring up Gazebo and RViz with our model.
package.xml, resource/arm_01, setup.cfg and setup.py are files that you see in almost any Python project. I will go over them later.
Finally, rviz/arm_01.rviz is the config. file for RViz, again, same as we used in earlier projects