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.
- Host: GitHub
- URL: https://github.com/henriktrom/ros-node-interface
- Owner: HenrikTrom
- License: cc0-1.0
- Created: 2025-05-27T14:22:01.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-20T16:41:23.000Z (about 1 year ago)
- Last Synced: 2025-06-20T17:41:21.912Z (about 1 year ago)
- Topics: cpp, interface, ros, ros2
- Language: C++
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
- Citation: Citation.cff
Awesome Lists containing this project
README
# ros-node-interface
[](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