Skip to content
This repository has been archived by the owner on Nov 25, 2018. It is now read-only.

vbschettino/archive_roscpp_example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

roscpp example

Rationale behind this package

This is a simple example of a ros package with source files written in C++. The idea is that the folder structure, cmakelists and package.xml files format can be used as template for more complex packages.

As recommended somewhere, the pure C code should be separated from the ROS interface.

Usage

To serve as an example, the simple node will subscribe to a listen topic and publish an echo topic at a fixed rate with the message repeated n times. Whenever a new message is received in listen, the output message will be updated.

n can be chosen by setting a echoer/n_echos parameter on ROS parameter server before running the node. If not set, it defaults to 5. Value of n can be changed during run time by calling the services increase_echos and decrease_echos.

To run an example, go to a terminal and issue:

roslaunch roscpp_example echoer.launch

Then, on another terminal, issue:

rostopic pub /listen std_msgs/String "data: 'Hello'"

To increase number of echos:

rosservice call echoer/increase_echos

About

Example ROS package written in C++

Resources

Stars

Watchers

Forks

Packages

No packages published