Creating the interface to the arm
As previously noted, we are using ROS 2 as our interface service, which creates a Modular Open System Architecture (MOSA). This turns our components into plug-and-play devices that can be added, removed, or modified, much like the apps on a smartphone. The secret to making that happen is to create a useful, generic interface, which we will do now.
Note
I’m creating my own interface to ROS 2 that is just for this book. We won’t be using any other ROS packages with this arm – just what we create, so I wanted the very minimum interface to get the job done.
We’ll be creating this interface in Python. Follow these steps:
- First, create a package for the robot arm in ROS 2. A package is a portable organization unit for functionality in ROS 2. Since we have multiple programs and multiple functions for the robot arm, we can bundle them together:
cd ~/ros2_ws/src ros2 pkg create –build-type ament-cmake ros_xarm...