Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tdenewiler/node_example
ROS node examples with parameter server, dynamic reconfigure, timers, and custom messages for C++ and Python.
https://github.com/tdenewiler/node_example
code-coverage continuous-integration documentation dynamic-reconfigure ros ros-node ros1 unit-tests
Last synced: 3 months ago
JSON representation
ROS node examples with parameter server, dynamic reconfigure, timers, and custom messages for C++ and Python.
- Host: GitHub
- URL: https://github.com/tdenewiler/node_example
- Owner: tdenewiler
- License: bsd-3-clause
- Created: 2014-07-21T16:03:23.000Z (over 10 years ago)
- Default Branch: main
- Last Pushed: 2023-02-01T01:13:30.000Z (about 2 years ago)
- Last Synced: 2023-04-05T04:38:46.417Z (almost 2 years ago)
- Topics: code-coverage, continuous-integration, documentation, dynamic-reconfigure, ros, ros-node, ros1, unit-tests
- Language: C++
- Homepage:
- Size: 1.61 MB
- Stars: 98
- Watchers: 4
- Forks: 25
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ROS Node Example
![Build & Test](https://github.com/tdenewiler/node_example/workflows/Build%20&%20Test/badge.svg)
[![codecov](https://codecov.io/gh/tdenewiler/node_example/branch/main/graph/badge.svg)](https://codecov.io/gh/tdenewiler/node_example)[ROS](http://ros.org) allows for creating nodes that communicate with each other.
It is very common to use C++ and Python to write these nodes.This package contains example nodes written in C++ and Python that show minimal examples of using
some very basic but powerful features of ROS.
Those features include:* [parameter server](http://wiki.ros.org/Parameter%20Server)
* [dynamic reconfigure](http://wiki.ros.org/dynamic_reconfigure/Tutorials)
* [timers](http://wiki.ros.org/roscpp/Overview/Timers)
* [custom messages](http://wiki.ros.org/ROS/Tutorials/DefiningCustomMessages)
* classes with callback functions for
[publishers and subscribers](http://wiki.ros.org/roscpp/Overview/Publishers%20and%20Subscribers)
* [remap](http://wiki.ros.org/roslaunch/XML/remap) topic namesMore ideas that are explored are deploying documentation using [GitHub Pages](https://pages.github.com/),
writing unit tests, and checking build status and code coverage.Additional documentation at
[http://tdenewiler.github.io/node_example](http://tdenewiler.github.io/node_example).## Description
There are several launch files included, the main one being `node_example.launch`.
This will start a talker and listener written in C++ and a talker and listener written in Python.
One GUI will open allowing you to see what messages are being received by the listeners and another GUI will allow
you to change the values sent from each talker.
Both listener nodes receive messages from both talkers, showing that the languages used to write the talkers and
listeners can be mixed.## Usage
[Build a workspace](http://wiki.ros.org/catkin/Tutorials/create_a_workspace) containing this repository.
A `node_example.rosinstall` file has been included for convenience with [`wstool`](http://wiki.ros.org/wstool).To start all the nodes run
roslaunch node_example node_example.launch
You should see two windows open: `rqt_reconfigure` and `rqt_console`.
They will look like the following screenshots.![Reconfigure GUI](docs/images/reconfigure.png)
![Console GUI](docs/images/console.png)
At this point you can modify the strings or numbers in the reconfigure GUI and you should see those changes show up
in the console GUI.
There are `enable` parameters in each of the talker nodes so that the nodes can effectively be paused and resumed
during runtime.
This is a nice feature that allows easily turning system components on and off during operation for whatever reason
(such as wanting to run multiple similar nodes side-by-side for comparison without using too many CPU/RAM resources,
only running certain nodes when some conditions are met, etc.).## Branches
The `main` branch will keep up with the supported ROS1 distributions.
These currently include Melodic (18.04) and Noetic (20.04).
Tests are run using GitHub Actions for all of these distributions.## Testing
During development there are large benefits to employing unit tests to verify that code changes do not break existing
functionality.
This package contains unit tests for each of the C++ nodes.
The unit tests are run using the `*.test` files in the `test/` directory.
The `*.test` files start the node to be tested plus the unit test code.
The unit test code is written such that it publishes and subscribes to the topics that correspond to the interfaces
of the node under test.
Callbacks are used to verify that the expected data is available on the specified topics.There are several methods of running the unit tests.
Running the tests with continuous integration services for pull requests is a common method used to ensure pull
requests can be safely merged.
One popular continuous integration provider for open source projects is [Travis CI](https://travis-ci.org).
This project now uses GitHub Actions to perform tests prior to merging changes into the `main` branch.
The build and test results for this package can be found in the table at the top of this page.Unit tests are not magic bullets.
The inputs to the nodes must take on enough values to verify that functions return valid values.
This will be different for each function and is not fully covered here.
Another aspect of unit tests is to ensure that all lines of code are exercised by unit tests, also referred to as
code coverage.A popular code coverage provider for open source projects is [codecov](https://codecov.io).
The code coverage results for this package can be found in the table at the top of this page.
This tool provides some measure of confidence that the existing unit tests will catch any issues, and that new
changes are introduced with unit test code.## Deploying GitHub Pages
Deployed using the command `mkdocs gh-deploy`.