Giter Club home page Giter Club logo

ros2_minimalcustomservice's Introduction

ros2_MinimalCustomService

This repository can be used as an example on how to use a custom ros2 service.

It has been created from the ROS 2 examples repo. This package has been highly simplified with respect to its predecessor in order to have an even more basic example. When an integer is provided it simply counts up to said integer, providing the array of all the previous values as feedback and returning a true if the tasks succeeds.

Folders

  • Inside the custom_service folder, we can find the package with the custom service definition
  • Inside the minimal_service folder, we can find the codes for both, the service server and the client server files as well as the python launch file to launch both.

Commands

To download this repo and run the mentioned nodes, use the following commands:

Download and install the package

Create a folder:

mkdir ros2_ws
cd ros2_ws

Download the repo

git clone https://github.com/pep248/ros2_MinimalCustomService.git

Compile the packages:

colcon build --packages-select custom_service minimal_service

Source the environment:

source install/setup.bash

Run the server

Now you can either run the server node manually and make a request through the terminal, or use the launch file that runs the server node and a client node that makes a request with a "goal: 10".

Manual server and requests

To run the server and the client, you can simply run the launch file using the following command:

ros2 launch minimal_service minimal_service.launch.py 

Manual server and requests

If instead you prefer to run the server manually, you can type the following:

Run the server:

ros2 run minimal_service minimal_service_server 

Open another terminal and make a manual requests:

ros2 action send_goal /custom_service custom_service/srv/CustomService 'goal: 10'

Author

ros2_minimalcustomservice's People

Contributors

pep248 avatar

Watchers

 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.