1. Introduction
fairino_hardware is an API interface developed based on ROS2 for FaAO collaborative robot, aiming at making it more convenient for entry-level users to use FaAO SDK. Through the parameter configuration file to configure the default parameters, it can adapt to different customer requirements.
2. fairino_hardware
This section explains how to configure the APP environment.
2.1. Basic Environment Installation
It is recommended to use Ubuntu22.04LTS(Jammy). Once the system is installed, you can install ROS2. Ros2-humble is recommended:https://docs.ros.org/en/humble/index.html。Before compiling fairino_hardware, you need to install the official ros2_control package. For ros2_control installation, see the tutorial:https://control.ros.org/humble/index.html。There are two official ros2_control installation modes, namely command installation mode and source code compilation installation mode. Because command installation mode may lead to incomplete installation of function package, it is recommended to use source code compilation installation mode.
The detail progress of installation of ROS2(humble):
1.Open a shell window,set locale information
locale # check for UTF-8
sudo apt update && sudo apt install locales
sudo locale-gen en_US en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
export LANG=en_US.UTF-8
locale # verify settings
2.Set source
sudo apt install software-properties-common
sudo add-apt-repository universe
sudo apt update && sudo apt install curl -y
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
3.Install ROS2
sudo apt update
sudo apt upgrade
sudo apt install ros-humble-desktop
4.Then install dev-tool
sudo apt install ros-dev-tools
The detail installation process of ros2_control:
1.First the ROS2 source must be added
source /opt/ros/humble/setup.bash
2.Create ros2_control workspace, download the source code
mkdir -p ~/ros2_control_ws/src
cd ~/ros2_control_ws/
wget https://raw.githubusercontent.com/ros-controls/ros2_control_ci/master/ros_controls.$ROS_DISTRO.repos
vcs import src < ros_controls.$ROS_DISTRO.repos
3.Install dependences
rosdep update --rosdistro=$ROS_DISTRO
sudo apt-get update
rosdep install --from-paths src --ignore-src -r -y
4.Build ros2_control
. /opt/ros/${ROS_DISTRO}/setup.sh
colcon build --symlink-install
2.2. Compile and build fairino_hardware
1. Create the colcon workspace fairino_hardware consists of two packages: fairino_msgs for custom data structures and fairino_hardware for the program body. Once you have the base environment installed, create a colcon workspace, like this:
Rmenber source ROS2&ros2_control first
source /opt/ros/humble/setup.bash
source ~/ros2_control_ws/install/setup.bash
cd ~/
mkdir -p ros2_ws/src
2. Compile feature packs Copy the package code to ros2_ws/src and run the following command inside ros2_ws:
colcon build --packages-select fairino_msgs
Wait for the previous command to finish compiling, then start to build fairino_hardware package:
colcon build --packages-select fairino_hardware
3. Quick start
3.1. Starting the process
On Ubuntu, open the command line and type:
cd ros2_ws
source install/setup.bash
ros2 run fairino_hardware ros2_cmd_server

3.2. View the manipulator state feedback process
The state feedback of the manipulator is published through the topic. Users can observe the state data refresh through the commands that come with ros2, or write programs to obtain the data.
On ubuntu, open the command line and type:
cd ros2_ws
source install/setup.bash
ros2 topic echo /nonrt_state_data
Can see the status data being refreshed in the command-line window, as shown in the following screenshot:

3.3. Process for issuing instructions
On ubuntu, open the command line and type:
cd ros2_ws
source install/setup.bash
rqt
After executing the above command, an rqt GUI will be brought up, as shown in the following figure.

In the GUI, select plugins->serivce->serivce caller, bring up the following screen, select /fairino_remote_command_service, Enter the instruction string in the interface expression and click call to see the reply message pop up in the dialog box below.

Important
Input string rule description:
The program internally filters the input strings to be of the form [function name](), and the parenthesis argument string must consist of letters, numbers, commas, and minus signs; any other characters or Spaces will throw an error.
Instruction feedback value description:
Except for the GET command, which returns a string, the rest of the function feedback values are int values, typically 0 for error, 1 for correct execution, and any other values refer to the error code defined in the xmlrpc SDK.
3.4. Modifying the parameter flow
Since the simplified SDK is to improve the native SDK interface, it can be simplified because some parameters are given default values. However, in the actual use process, the default parameters can not meet the requirements, in this case, you can modify the value of the corresponding default parameters and then load them into the node.
There is a fairino_remotecmdinterface_para.yaml parameter file in the source code file. The parameters in the file are preset default parameters, which are used to simplify the instruction input parameters. You can modify the parameters according to your specific needs, and then use the command to modify the parameters dynamically: ros2 param load fr_command_server ~/ros2_ws/src/fairino_hardware/fairino_remotecmdinterface_para.yaml。