Skip to content

guillaumeautran/rclswi

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

92 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rclswi: a SWI-Prolog client for ROS2

This repo provides an RCL (ROS Client Library) that allows for a Prolog process to create one or more nodes in a ROS network. The aim of this library is to support demanding applications. The client exploits SWI-Prolog's scalable multi-threading capabilities that lets you use all cores. The file EVAL.md is a very crude evaluation that indicates that the performance is significantly better than rclpy, the standard Python client library for ROS.

WARNING

This repo provides a first version of the SWI-Prolog ROS2 bridge. Not all functionality is provided and most of the interface is not well tested. Still, the current version should be enough for evaluation and prototyping.

Building

  • Make sure to have SWI-Prolog installed (8.3.22 or later) and accessible in $PATH as swipl.
  • clone into src below your ROS2 workspace
  • Build using colcon build

Platforms

  • Currently the library has only been tested using the ROS2 foxy distribution on Linux (Ubuntu 20.04, AMD64).
  • Most likely it will run on any Linux platform, both 32 and 64 bits.
  • It may work on most other POSIX like systems. It will not (yet) work on Windows.
  • Some of the RCL/RMW ROS2 core library functions have changed since foxy, so running on the latest ROS2 will require a few (minor) changes.

Examples

The directory rclswi/examples contains several small test programs and examples. To run any of these, from your ROS2 workspace, assuming default directory structure

swipl -p library=install/rclswi/prolog src/rclswi/examples/demo.pl

See examples/README.md for an overview and the content of the various files for details.

Documentation

The library is documented using PlDoc. To view the documentation in a browser run the command below to create an HTTP server at http://localhost:8080.

swipl -p library=install/rclswi/prolog src/rclswi/examples/doc.pl [option ...]

Options processed are --port=Port to select an alternative port (default 8080) and --no-doc to just load the code without starting a web server.

Use the directory menu on the top-left to select the rclswi/prolog directory and select ros.pl.

Feedback

For comments and questions, please use either the SWI-Prolog Discourse forum or ROS questions and answers. Bug fixes and feature requests can use the issue tracker of the GitHub repository.

All contributions are welcome: example code, fixes, better interfaces, ports, tests, etc. Please provide as Git pull requests if possible.

Status

The listb below is lists parts of the RCL functionality and what is supported by the current version of rclswi.

  • Type handling
    • Convert message from C to Prolog
      • Deal with arrays
        • Fixed arrays
    • Dynamic arrays
      • Deal with wide strings (are these UTF-16?)
    • Convert message from Prolog to C See https://github.com/osrf/dynamic_message_introspection
    • At the moment dict key names are created on the fly from the type introspection data. This is needlessly slow.
    • Should we allow the user to tweak the conversion by providing dict tags and keys and choices for text conversion (atom/string)?
  • Object live-time handling, i.e., make nodes depend on objects associated with the node handle.
  • Parameter handling
    • Declare node parameters
    • Populate declared parameters from arguments and launch data
    • Change parameters
    • Publish changes on /parameter_events
    • Provide a callback on parameter changes
    • Enumerate, get and set parameters on named nodes
  • Graph tracking
    • Query the ROS node graph
      • Enumerate nodes
      • Enumerate topics and types
      • Enumerate services and types
      • Enumerate actions and types
  • Deal with logging
    • configure and generate ROS log messages
    • Bridge from SWI-Prolog print_message/2 and debug/3
    • print_message/2 is only forwarded for non-interactive sessions.
    • Defaults should depend on whether a session is interactive
  • Deal with services
    • Low level interface: read/write request/response, wait for client and service.
    • High level interface.
      • Client
        • Synchronous calls
        • ASynchronous calls
      • Service
        • Read/compute/reply loop
        • Callback based
  • Deal with actions
    • Action type introspection
    • Low level interface for creating an action client or server
    • Receiving feedback and status
    • Access to the goals, results and cancel services
    • QoS support
    • High level action API
      • DCG based action client
      • Callback based client
      • action server
  • Deal with clocks
    • Basics for creating a clock and asking its time
  • Deal with timers
  • Deal with guard conditions
  • Advanced configuration
    • Provide access to the QoS policies
  • ROS2 Lifecycle support?
  • Integration into ROS deployment
    • Build, portability
      • Find the right SWI-Prolog
      • Use rclutils to get some portable alternatives
    • Allow running a ROS node interactively from Prolog
      • Make installation follow the SWI-Prolog pack structure so we can attach the ROS API as a pack.
    • Allow deploying a ROS node using ros2 run
      • How to do that?
      • Pass command line options into rcl_init() and rcl_node_init()
      • Provide a skeleton project
    • Query the share directory of a package
  • Process cleanup
    • Properly handle signals asynchronously (Control-C)
    • Finish and reclaim resources in the right order.
  • Documentation
    • In code documentation
    • Local HTTP server for documentation (see above)
    • Generate a stand-alone document
  • Testing
  • Performance evaluation

About

ROS2 bridge for SWI-Prolog

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Prolog 48.7%
  • C 48.6%
  • CMake 2.1%
  • Other 0.6%