ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

There you have an example of C++ mixed node (pub/sub/srv) for ROS1 with Object-Oriented Programming:

https://roboticsbackend.com/oop-with-ros-in-cpp/

This may be a good enough base to build on. There are some differences from your code, such as with ros::NodeHandle.

In general, if your code works, don't worry - just keep building and coding :) But good examples are very helpful.