iot_agent_ros2

Installation

Run the following commands in terminal.

Source ROS2 setup files.

source /opt/ros/humble/setup.bash

Execute nodejs code.

node index.js

Usage

This agent uses the rclnodejs library combined with the Fiware iotagent-node-lib. The agent creates the following

  1. Subscriptions and Publishers for ROS Machines
  2. ROS2 Client
  3. GPIO Action Client for Legacy CNC Machines

Subscriptions and Publishers

The function "initROSDevice" was created to initialize or create new subscribers or publishers. When the agent starts, it locates the already registered/created devices and initializes the existing ROS2 publishers and subscribers for each device. Additionally the agent handles new registrations/creations of publishers and subscribers when a new device is created.

ROS2 Client

You can send your commands and be redirected to your ROS2 device with the rclnodejs Client/Server. The server runs on the actual hardware device and the agent handles in the function called "updateContextHandler" the creation of the ROS2 Client and sends the message to the device.

GPIO Action Client for Legacy CNC Machines

You can send your commands and be redirected to your ROS2 device with the rclnodejs Action Client/Server. The action server runs on the actual hardware device and the agent handles in the function called "updateContextHandler" the creation of the ROS2 Action Client (class called "GPIOActionClient") and sends the message to the device.