Giter Club home page Giter Club logo

rostful's Introduction

ROStful

ROStful is a lightweight web server for making ROS services, topics, and actions available as RESTful web services. It also provides a client proxy to expose a web service locally over ROS.

ROStful web services primarily use the rosbridge JSON mapping for ROS messages. However, binary serialized ROS messages can be used to increase performance.

The purpose of ROStful is different from rosbridge: rosbridge provides an API for ROS through JSON using web sockets. ROStful allows specific services, topics, and actions to be provided as web services (using plain get and post requests) without exposing underlying ROS concepts. The ROStful client, however, additionally provides a modicum of multi-master functionality. The client proxy is a node that connects to a ROStful web service and exposes the services, topics, and actions locally over ROS.

The ROStful server has no dependencies on 3rd party libraries, and is WSGI-compatible and can therefore be used with most web servers like Apache and IIS.

ROStful web services

A ROStful web service is a web service that uses ROS data structures for input and output. These include services, topics, and actions.

Service methods accept as input a ROS message over HTTP POST and return a ROS message in the response. The input and output cannot be defined directly with ROS messages; it must use a ROS service definition.

Methods denoted as topics may use any ROS message, but are limited to accepting that message via HTTP POST or returning it, taking no input, via HTTP GET. Topic methods do not need to allow both methods. A topic method allowing POST is described as a "subscribing" method, and one that allows GET is a "publishing" method.

Methods denoted as actions consist of a set of subsidiary topic methods, the subscribing-only goal and cancel methods, and the publishing-only status, result, and feedback methods. These methods are located at the url <action method url>/<suffix>, where the suffix is the subsidiary method name.

The ROStful server

The ROStful server can provide services, topics, and actions that are locally available over ROS as ROStful web services. Topics may be specified as publishing, subscribing, or both.

ROStful uses the rosbridge JSON mapping by default, but binary serialized ROS messages can be sent with the Content-Header set to application/vnd.ros.msg. Giving this MIME type in the Accept header for queries without input (i.e., publishing topic methods) will cause the server to return serialized messages. Images are also supported.

Supports JSON Web token jwt that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. This information can be verified and trusted because it is digitally signed. Install with pip install pyjwt

The ROStful client

The ROStful client is a node that connects to a ROStful web service and makes its services, topics, and actions locally available over ROS.

The client can be given the root URL of a ROStful web service, in which case it will connect to all services, topics, and actions for that web service, or it can be given the URL of an individual service, topic, or action to connect to. When connecting directly, the name of service, topic, or action is used as the service, topic, or action name. When connecting to the root URL, the name of the web service, if any, is used as a prefix (followed by a slash) to the service/topic/action names. This can be controlled using the --prefix and --no-prefix options.

For privacy, the client will not allow the web service to subscribe to local ROS topics unless the --allow-subscription option is given.

The client periodically queries the server for its published topics, and then publishes those messages locally. The default interval is 1 second, but this can be set with the --publish-interval option.

The --binary option directs the client to use binary serialized messages instead of JSON.

For debugging, the client can be used with the same ROS master as the server. Giving the --test option causes the client to append _ws to the names of the services/topics/actions it connects to, so they don't conflict with those being used by the server.

The --jwt option enables the use of JSON Web Token for secure transmission. Client and Server have to enable this option to work properly. The --jwt-key defines the the key to encrypt the transmission in order to verify it.

Web service/component description format

The ROStful server functions as a ROS component, providing services and actions, and publishing and subscribing to topics. Due to the lack of a standard format for describing ROS components, ROStful uses simple INI-file-based format. The file is broken up into sections, with each section starting with a header contained in square brackets. In addition to standard INI file formatted sections, "definition" sections are allowed for defining messages, services, and actions.

Manifest section

There is a single optional section titled Manifest. The section is in standard INI file format, a sequence of lines each containing a key-value pair separated by =. The special key Def-Type indicates the type of description being provided (e.g., Node, Service, Topic, Action).

For services, topics, and actions, the keys Type and Name are given, which give the ROS type of the service/topic/action, and the service/action name or topic as appropriate.

For topics, the keys Publishes and Subscribes are given with the values true or false.

Other sections

The Node description includes the optional sections Services, Actions, Publishes, and Subscribes. These sections also follow the INI file format, where the keys are the names of the services, actions, or topics, and the values are their ROS types.

Definitions

Definition sections have a title in the form <definition type>:<definition name>. The definition type, given before the colon, can be one of msg, srv, or action, corresponding to ROS message, service, and action definitions. The definition name, given after the colon, is the name of the data structure being defined. The content of the section is exactly the format used in the ROS files defining messages, services, and actions, respectively.

Purpose

This description format allows the full definition for a component to be given inline. The description for a node or method is located at <node or method url>/_rosdef. Setting the query parameter full=true will include all the definitions referenced in description (recursively). Setting the query parameter json=true will return a JSON representation of the definition.

rostful's People

Contributors

romanrobotnik avatar benkehoe avatar alvarovillena avatar jmerdich avatar asmodehn avatar jihoonl avatar alex-arnal avatar gitter-badger avatar asoriano1 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.