Git Product home page Git Product logo

rostful_launcher's Introduction

rostful_launcher

A simple package to easily configure and launch rostful.

Install rostful

sudo apt-get install ros-kinetic-rostful

Configure rostful

The file config/rostful.cfg is condifured to publish/subscribe topic '/chatter' and to be a client of the service '/add_two_ints'. Thus, you can test basic connections with rostful with the examples in rospy_tutorials package.

By default, the server in configured as 'localhost:5000'.

You can modify this file or make a copy in your own package, modify it, and then launch rostful changing the argument "config_file".

Run rostful

roslaunch rostful_launcher rostful.launch

OR

roslaunch rostful_launcher rostful.launch config_file:="<your_path_to_config_file>"

OR

rosrun rostful_launcher run_rostful.py -c "<your_path_to_config_file>"

Test rostful

To test rostful, follow the instructions on each case.

Subscribe to a topic

  1. roslaunch rostful_launcher rostful.launch
  2. Run the rospy_tutorials examples: rosrun rospy_tutorials talker.py
  3. In a web browser, go to the URL: http://localhost:5000/frontend/chatter
  4. Click on the 'GET LATEST MSG' button. You will see the JSON formatted message.

Publish in a topic

  1. roslaunch rostful_launcher rostful.launch
  2. Run the rospy_tutorials examples: rosrun rospy_tutorials listener.py
  3. In a web browser, go to the URL: http://localhost:5000/frontend/chatter
  4. Fill the data field in 'Send message' section. Click on 'POST NEW MSG' button and check the listener.

Service client

The rostful web frontend does not support non string types. Thus, for this example, you need to install a REST client plugin (there are plenty in Firefox or Chrome).

  1. roslaunch rostful_launcher rostful.launch
  2. Run the rospy_tutorials examples: rosrun rospy_tutorials server_connection_header.py
  3. From the REST client plugin, set URL to: http://localhost:5000/ros/add_two_ints
  4. Select POST method, and put the JSON code in the body of the message:
{
  "a": 1,
  "b": 2
}
  1. Check the JSON formatted response.

Use rostful

Rostful provides a frontend that allows you to do a first testing very easily. However, as it only support strings, it could very limited for different topics or services. Thus, the best way to test the rostful interface is through a REST client plugin in your web browser.

The frontend is accessed via: http://localhost:5000/frontend/<topic_name>

The URL for the REST client is: http://localhost:5000/ros/<topic_name>

All messages are formatted in JSON. The HTTP method is different on each case:

  • Use GET to obtain the latest message received in a subscribed topic.
  • Use POST to send a message to a topic.
  • Use POST to call a service.

rostful_launcher's People

Contributors

arturotorresg avatar

Watchers

 avatar

Forkers

odinhr

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.