Skip to content

"full" template for ros subscriber & publisher package in c++

Notifications You must be signed in to change notification settings

JosefGst/ros_talker_cookiecutter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 

Repository files navigation

{{cookiecutter.pkg_name}}

Contents

I kept copying code from the official documentation or from my previous works every time I created a new ROS package. With this cookiecutter template I hope the repetitive setup task can be reduced and I can jump directly into the development. For now it includes a simple publisher and subscriber, dynamic reconfigurable parameters, documentation generation with rosdoc_lite, linting and c++ debug setup.

Setup

pipx install cookiecutter
cookiecutter [email protected]:JosefGst/template_sub_pub.git

Choose name for the package, header and class.

Run

rosrun {{cookiecutter.pkg_name}} {{cookiecutter.pkg_name}}_node
rosrun {{cookiecutter.pkg_name}} {{cookiecutter.pkg_name}}_node _pub_string:="hello" _rate:=1
roslaunch {{cookiecutter.pkg_name}} {{cookiecutter.pkg_name}}.launch pub_string:="hello" rate:=1

Published Topics

Subscribed Topics

Parameters

  • rate (int,default:1)
    • publish rate of chatter" topic in [Hz]
  • pub_string (string,default:"Hello World")
    • published string on chatter topic

graph

Development

Debugging C++

  1. Move the .vscode folder into the workspace directory.
  2. Edit the launch.json file as necessary.
  3. Run the "make_debug" task
  4. Click the Debug button on the left side in vscode. Select "ROS:Launch" and click the the green arrow.

Alternatively attach to single node

In addition to the previous steps

  1. Run the "ROS:Start" task
  2. rosrun the node
  3. Click the green debug button with ROS:attach selected

References

Polyhobbyist Youtube vscode-ros github

Linting

In root of workspace

catkin_make roslint_{{cookiecutter.pkg_name}}

create documentation

In root of package

rosdoc_lite .

To see the generated documentation website.

TODO

  • make params reconfigurable
  • debugging c++
  • add tests
  • github actions
  • ros2 branch
  • automatic documentation generation
  • dockerization should be in separate docker_ws repo

About

"full" template for ros subscriber & publisher package in c++

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published