An open API service indexing awesome lists of open source software.

https://github.com/henriktrom/ros-node-interface

A lightweight C++ and python interface template for managing ROS nodes with start/stop/shutdown control via ROS services.
https://github.com/henriktrom/ros-node-interface

cpp interface ros ros2

Last synced: 2 months ago
JSON representation

A lightweight C++ and python interface template for managing ROS nodes with start/stop/shutdown control via ROS services.

Awesome Lists containing this project

README

          

# ros-node-interface

[![DOI](https://zenodo.org/badge/991372107.svg)](https://zenodo.org/badge/latestdoi/991372107)

A lightweight C++ and python interface template for managing ROS nodes with start/stop/shutdown control via ROS services.

## đź“‘ Citation

If you use this software, please use the GitHub **“Cite this repository”** button at the top(-right) of this page.

This module provides a generic wrapper (`BaseRosInterface`) around any ROS-compatible module class, enabling it to be:
- Started and stopped using ROS service calls
- Managed with a clean threaded loop
- Extended for custom node types and behaviors

## Features

- Threaded execution loop (`loop_step`)
- Service-based control (`start`, `stop`, `shutdown`)
- Simple modular interface for defining new node types
- Example `TestModule` provided for demonstration

## Example Usage

```cpp
#include "ros-node-interface.hpp"

int main(int argc, char **argv)
{
ros::init(argc, argv, "my_node");

auto my_module = std::make_unique(
ros::NodeHandle(), "my_topic"
);

ros_node_interface::BaseRosInterface interface(
std::move(my_module)
);

return 0;
}
````

## Dependencies

* ROS (tested with ROS Noetic)
* `std_srvs/Trigger`
* C++14 or newer