| // -------------------------------------------------------- |
| // Copyright (c) |
| // |
| // contributions by author |
| // author@somewhere.net |
| // maintained by maintainer |
| // maintainer@somewhere.net |
| |
| // -------------------------------------------------------- |
| // Code generated by Papyrus C++ |
| // -------------------------------------------------------- |
| |
| #define subscriberCompdef_Subscriber_BODY |
| |
| /************************************************************ |
| Subscriber class body |
| ************************************************************/ |
| |
| // Include from Include stereotype (pre-body) |
| #include <iostream> |
| using namespace std; |
| // End of Include stereotype (pre-body) |
| |
| // include associated header file |
| #include "subscriberCompdef/Subscriber.h" |
| |
| // Derived includes directives |
| #include "rclcpp/rclcpp.hpp" |
| #include "subscriberCompdef/Subscriber_main.h" |
| |
| namespace subscriberCompdef { |
| |
| // static attributes (if any) |
| |
| /** |
| * |
| * @param commobj |
| */ |
| void Subscriber::fListening(const simple_msgs::msg::Map::SharedPtr /*in*/commobj) { |
| cout << "got map data" << endl; |
| cout << "width: " << commobj->ogm.width << endl; |
| cout << "height: " << commobj->ogm.height << endl; |
| cout << "resolution: " << commobj->ogm.resolution << endl; |
| } |
| |
| /** |
| * |
| * @param options |
| */ |
| Subscriber::Subscriber(rclcpp::NodeOptions /*in*/options) : |
| rclcpp_lifecycle::LifecycleNode("Subscriber", options) { |
| rMap_sub_ = create_subscription < simple_msgs::msg::Map |
| > ("rMap", rclcpp::QoS(rclcpp::KeepLast(100)).best_effort(), std::bind( |
| &subscriberCompdef::Subscriber::fListening, (Subscriber*) this, |
| std::placeholders::_1)); |
| |
| } |
| |
| } // of namespace subscriberCompdef |
| |
| /************************************************************ |
| End of Subscriber class body |
| ************************************************************/ |