GithubHelp home page GithubHelp logo

isabella232 / rclswi Goto Github PK

View Code? Open in Web Editor NEW

This project forked from swi-prolog/rclswi

0.0 0.0 0.0 677 KB

ROS2 bridge for SWI-Prolog

License: Apache License 2.0

Shell 0.16% C++ 0.39% C 48.60% Prolog 48.76% CMake 2.09%

rclswi's Introduction

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

rclswi's People

Contributors

janwielemaker avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.