Usage
This document assumes you have the ROS2 CLIPS-Executive installed and sourced in your environment.
ROS Node
The ROS2 CLIPS-Executive mainly provides a ROS lifecycle node (Package, Github) that manages a CLIPS instance and has the following responsibilities:
Dynamically create and destroy CLIPS environments.
Log the CLIPS output to ROS and to files.
Extend CLIPS environments by plugins (using pluginlib) that allow to externally customize CLIPS environments further via the CLIPS C++ API (e.g., to inject C++ functions to CLIPS environments).
It provides a clear execution flow guided through it’s lifecycle states:
On being configured, it parses all parameters to determine the environments and plugins to load. It initializes the environments and plugins.
On being activated, it first loads all requested plugins, before calling (reset) in the environments, refreshing all agendas and calling (run) to start rule execution.
On being deactivated, it first asserts a
(executive-finalize)
fact before refreshing all agendas and calling (run) one more time to allow cleanup routines to execute before shutdown.
Additionally, the node also supports the usage of bond for advanced system health monitoring (e.g., via the nav2_lifecycle_manager).
Starting the ROS2 CLIPS-Executive
To just launch a standalone node, just run the following command:
ros2 run cx_clips_env_manager cx_node
A more practical way to to start the node is to utilize the launch file of the cx_bringup, which supports convenient configuration, namespacing and composition:
ros2 launch cx_bringup cx_launch.py
Hint
Use the –show-args option to learn about all parameters that the launch file provides.
Example
The following example showcases simple interactions between CLIPS and ROS via a topic:
Run the ros_msgs demo:
ros2 launch cx_bringup cx_launch.py manager_config:=plugin_examples/ros_msgs.yaml
Publish a String on the /ros_cx_in topic:
ros2 topic pub /ros_cx_in std_msgs/msg/String "{data: 'Hello'}"
Listen on the /ros_cx_out topic for responses:
ros2 topic echo /ros_cx_out
You should receive a “Hello World!” message for each message received in the CLIPS environment.
Check out the Tutorials page to learn how to write your own CLIPS applications.