-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ba6cbbe
commit 32053b8
Showing
3 changed files
with
16 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ log | |
build | ||
install | ||
.vscode | ||
.cache | ||
.cache | ||
compile_commands.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,27 @@ | ||
#include "TODO_PACKAGE_NAME/TODO_NODE_NAME_node.hpp" | ||
|
||
// For _1 | ||
using namespace std::placeholders; | ||
|
||
TODO_NODE_NAME::TODO_NODE_NAME(const rclcpp::NodeOptions& options) : Node("TODO_NODE_NAME", options) { | ||
// Parameters | ||
float x = this->declare_parameter<float>("foo", -10.0); | ||
|
||
// Pub Sub | ||
this->sub = this->create_subscription<std_msgs::msg::String>("/str", std::bind(&TODO_NODE_NAME::sub_cb, this, _1)); | ||
this->path_pub = this->create_publisher<std_msgs::msg::String>("/run_folder"); | ||
this->sub = | ||
this->create_subscription<std_msgs::msg::String>("/str", 1, std::bind(&TODO_NODE_NAME::sub_cb, this, _1)); | ||
this->pub = this->create_publisher<std_msgs::msg::String>("/run_folder", 1); | ||
|
||
// Log a sample log | ||
RCLCPP_INFO(this->get_logger(), "You passed %f", x); | ||
|
||
// Send a sample message | ||
std_msgs::msg::String msg{}; | ||
msg.data = std::string{"Hello World!"}; | ||
path_pub->publish(msg); | ||
pub->publish(msg); | ||
} | ||
|
||
void TODO_NODE_NAME::sub_cb(const std_msgs::msg::String::SharedPtr msg) { | ||
// Echo message | ||
this->pub.publish(msg); | ||
this->pub->publish(*msg); | ||
} |