Most of the modules in the aforementioned software system use AimRT as the underlying framework. AimRT is a robot runtime framework that aligns with ROS2, open-sourced by Agibot Robotics in September 2024. AimRT provides two basic underlying communication methods: Channel and RPC (for more details, refer to the AimRT official documentation). These two communication methods can correspond to multiple different communication backends.
To reduce the cognitive burden of secondary development, we provide two forms of relatively simple and general interfaces for secondary development: HTTP JSON RPC and ROS2 Topic. HTTP JSON RPC is suitable for low-frequency, one-to-many interface calls, while ROS2 Topic is suitable for high-frequency, many-to-many interface calls. The following are diagrams of both:
For development languages, there are no restrictions on the language used for secondary development programs. As long as they can send and receive HTTP messages, they can call all HTTP JSON RPC interfaces. As long as they support ROS2 Humble and can send and receive ROS2 topic messages, they can call all the body’s ROS2 Topic interfaces.
Here are two specific interface call examples to provide a clearer understanding of the interfaces:
127.0.0.1 is the IP address of the robot’s X86 development board. Here, it is set to the localhost address, which can only be called locally on the X86. For remote calls, you can change this IP to the IP corresponding to the robot’s X86 development board WiFi card (which can be checked using the AimMaster software or by running ip a on the X86).
56421 is the HTTP port number for the corresponding service. This will generally be provided in detailed interface examples.
content-type:application/json is the request header, indicating that the request body is in JSON format. This request header must be included.
timeout: 1000 is the request header, indicating the request timeout time in milliseconds. Here, it is set to 1000 milliseconds, or 1 second. This field is optional.
aimdk.protocol.HalBmsService/GetBmsState is the name of the RPC interface for getting the battery state. The specific names of each interface can be found in the corresponding interface documentation and examples.
'{}' is the request body. Here, it is empty, representing that all fields are set to their default values. If you need to pass specific fields, you can pass a JSON string, for example, '{"bms_state": 1}' indicates passing the bms_state field with a value of 1 (this is just an example; the specific field names and values should be referenced from the corresponding interface documentation and examples).
The topic interface uses native ROS2 topics. The default on the machine is ROS2 Humble with Fastdds. Before calling any ROS2 Topic interface, you must set some environment variables as follows:
In ros_dds_configuration.xml, both shared memory communication and UDP communication are enabled, while in privileged_ros_dds_configuration.xml, only UDP communication is enabled to avoid permission issues with shared memory.
To ensure the stability of ROS2 communication on the machine, we have modified the DDS communication configuration file. For non-root processes, shared memory communication and UDP communication are enabled by default, as shown below (located at /agibot/software/v0/entry/bin/cfg/ros_dds_configuration.xml on the X86 development board):
The whitelist for network interfaces is configured with two IPs: 127.0.0.1 and 10.42.0.100, which are the local loopback IP and the IP for the remote control network interface, respectively. If you need to receive and send the corresponding ROS2 Topics on a third-party PC or an added industrial control computer, you need to add the IP of the local network interface (generally, you can choose 192.168.2.50, which is the fixed IP for the debugging network port on the back of the robot, or the reserved IP for the added computing board 192.168.100.100) to the whitelist (both privileged and non-privileged need to be added). After adding, restart the robot and connect via a wired connection to the corresponding network port to perform the communication.
Using asymmetric dds whitelists in ROS2 Humble can sometimes lead to unpredictable communication issues. Please ensure that the dds whitelist configurations are consistent.