From b4b971dad8b82bf5ee8f15c8b5cbd5096d30883e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Wed, 8 Dec 2021 13:45:26 +0900 Subject: [PATCH 01/56] Test apps for pub/sub ROS2 standard types to/from mros2 are added --- mros2_float32_test/src/pub_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mros2_float32_test/src/pub_node.cpp b/mros2_float32_test/src/pub_node.cpp index 50bc8e6..bfee56b 100644 --- a/mros2_float32_test/src/pub_node.cpp +++ b/mros2_float32_test/src/pub_node.cpp @@ -25,7 +25,7 @@ class Publisher : public rclcpp::Node void timer_callback() { auto message = std_msgs::msg::Float32(); - message.data = count_++/100; + message.data = count_++/10.0; RCLCPP_INFO(this->get_logger(), "Publishing msg: %f", message.data); publisher_->publish(message); } From 45bcd96346daf00784fc823aae8e8a372058b7fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Wed, 8 Dec 2021 13:51:39 +0900 Subject: [PATCH 02/56] Test apps for pub/sub ROS2 standard types to/from mros2 are added --- mros2_float32_test/src/pub_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mros2_float32_test/src/pub_node.cpp b/mros2_float32_test/src/pub_node.cpp index bfee56b..408ed6c 100644 --- a/mros2_float32_test/src/pub_node.cpp +++ b/mros2_float32_test/src/pub_node.cpp @@ -25,7 +25,7 @@ class Publisher : public rclcpp::Node void timer_callback() { auto message = std_msgs::msg::Float32(); - message.data = count_++/10.0; + message.data = (count_++)/10.0; RCLCPP_INFO(this->get_logger(), "Publishing msg: %f", message.data); publisher_->publish(message); } From 31b5da1410254a6fd515a3777d2964bb8f60e210 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Thu, 9 Dec 2021 17:32:45 +0900 Subject: [PATCH 03/56] health_pubsub modified --- mros2_health_pubsub/src/pub_node.cpp | 2 +- mros2_health_string_pubsub/CMakeLists.txt | 62 ------------------- .../launch/launch_pubsub.py | 21 ------- mros2_health_string_pubsub/package.xml | 21 ------- mros2_health_string_pubsub/src/pub_node.cpp | 43 ------------- mros2_health_string_pubsub/src/sub_node.cpp | 34 ---------- 6 files changed, 1 insertion(+), 182 deletions(-) delete mode 100644 mros2_health_string_pubsub/CMakeLists.txt delete mode 100644 mros2_health_string_pubsub/launch/launch_pubsub.py delete mode 100644 mros2_health_string_pubsub/package.xml delete mode 100644 mros2_health_string_pubsub/src/pub_node.cpp delete mode 100644 mros2_health_string_pubsub/src/sub_node.cpp diff --git a/mros2_health_pubsub/src/pub_node.cpp b/mros2_health_pubsub/src/pub_node.cpp index 1d62900..b8a9c88 100644 --- a/mros2_health_pubsub/src/pub_node.cpp +++ b/mros2_health_pubsub/src/pub_node.cpp @@ -27,7 +27,7 @@ class Publisher : public rclcpp::Node auto message = health_msgs::msg::Health(); message.name = std::to_string(count_++); message.height = 170; - message.weight = 64.5; + message.weight = 63.5; RCLCPP_INFO(this->get_logger(), "Publishing msg: { name: '%s', height: %d cm, weight: %f kg }", message.name.c_str(), message.height, message.weight); publisher_->publish(message); } diff --git a/mros2_health_string_pubsub/CMakeLists.txt b/mros2_health_string_pubsub/CMakeLists.txt deleted file mode 100644 index 13d84b5..0000000 --- a/mros2_health_string_pubsub/CMakeLists.txt +++ /dev/null @@ -1,62 +0,0 @@ -cmake_minimum_required(VERSION 3.5) -project(mros2_health_string_pubsub) - - -# Default to C99 -if(NOT CMAKE_C_STANDARD) - set(CMAKE_C_STANDARD 99) -endif() - -# Default to C++14 -if(NOT CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 14) -endif() - -if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_compile_options(-Wall -Wextra -Wpedantic) -endif() - -# find dependencies -find_package(ament_cmake REQUIRED) -find_package(rclcpp REQUIRED) -find_package(std_msgs REQUIRED) -# uncomment the following section in order to fill in -# further dependencies manually. -# find_package( REQUIRED) - -add_executable(pub_node src/pub_node.cpp) -ament_target_dependencies(pub_node rclcpp std_msgs) - -add_executable(sub_node src/sub_node.cpp) -ament_target_dependencies(sub_node rclcpp std_msgs) - -target_include_directories(pub_node PUBLIC - $ - $) - -target_include_directories(sub_node PUBLIC - $ - $) - -install(TARGETS pub_node - DESTINATION lib/${PROJECT_NAME}) -install(TARGETS sub_node - DESTINATION lib/${PROJECT_NAME}) - -install(DIRECTORY - launch - DESTINATION share/${PROJECT_NAME} -) - -if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - # the following line skips the linter which checks for copyrights - # uncomment the line when a copyright and license is not present in all source files - #set(ament_cmake_copyright_FOUND TRUE) - # the following line skips cpplint (only works in a git repo) - # uncomment the line when this package is not in a git repo - #set(ament_cmake_cpplint_FOUND TRUE) - ament_lint_auto_find_test_dependencies() -endif() - -ament_package() diff --git a/mros2_health_string_pubsub/launch/launch_pubsub.py b/mros2_health_string_pubsub/launch/launch_pubsub.py deleted file mode 100644 index 60026bf..0000000 --- a/mros2_health_string_pubsub/launch/launch_pubsub.py +++ /dev/null @@ -1,21 +0,0 @@ -from launch import LaunchDescription -from launch_ros.actions import Node - -# Note: `node_`, `prefix` and `output` will be removed on Foxy -def generate_launch_description(): - return LaunchDescription([ - Node( - package='mros2_health_string_pubsub', - node_executable='pub_node', - node_name='pub_mros2', - prefix=['stdbuf -o L'], - output="screen" - ), - Node( - package='mros2_health_string_pubsub', - node_executable='sub_node', - node_name='mros2_sub', - prefix=['stdbuf -o L'], - output="screen" - ) - ]) diff --git a/mros2_health_string_pubsub/package.xml b/mros2_health_string_pubsub/package.xml deleted file mode 100644 index 8284039..0000000 --- a/mros2_health_string_pubsub/package.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - mros2_health_string_pubsub - 0.0.0 - TODO: Package description - uden - TODO: License declaration - - ament_cmake -rclcpp -std_msgs -rclcpp -std_msgs - ament_lint_auto - ament_lint_common - - - ament_cmake - - diff --git a/mros2_health_string_pubsub/src/pub_node.cpp b/mros2_health_string_pubsub/src/pub_node.cpp deleted file mode 100644 index aee6d2a..0000000 --- a/mros2_health_string_pubsub/src/pub_node.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "std_msgs/msg/string.hpp" - -using namespace std::chrono_literals; - -/* This example creates a subclass of Node and uses std::bind() to register a -* member function as a callback from the timer. */ - -class Publisher : public rclcpp::Node -{ -public: - Publisher() - : Node("pub_mros2"), count_(0) - { - publisher_ = this->create_publisher("to_stm", 10); - timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); - } - -private: - void timer_callback() - { - auto message = std_msgs::msg::String(); - message.data = std::to_string(count_++) + ",170,63.5"; - RCLCPP_INFO(this->get_logger(), "Publishing msg: '%s'", message.data.c_str()); - publisher_->publish(message); - } - rclcpp::TimerBase::SharedPtr timer_; - rclcpp::Publisher::SharedPtr publisher_; - size_t count_; -}; - -int main(int argc, char * argv[]) -{ - rclcpp::init(argc, argv); - rclcpp::spin(std::make_shared()); - rclcpp::shutdown(); - return 0; -} diff --git a/mros2_health_string_pubsub/src/sub_node.cpp b/mros2_health_string_pubsub/src/sub_node.cpp deleted file mode 100644 index 896dab9..0000000 --- a/mros2_health_string_pubsub/src/sub_node.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "std_msgs/msg/string.hpp" - -using std::placeholders::_1; - -class Subscriber : public rclcpp::Node -{ -public: - Subscriber() : Node("mros2_sub") - { - subscriber_ = this->create_subscription("to_linux", rclcpp::QoS(10).best_effort(), std::bind(&Subscriber::topic_callback, this, _1)); - } - -private: - void topic_callback(const std_msgs::msg::String::SharedPtr msg) const - { - RCLCPP_INFO(this->get_logger(), "Subscribed msg: '%s'", msg->data.c_str()); - } - rclcpp::Subscription::SharedPtr subscriber_; -}; - - -int main(int argc, char *argv[]) -{ - rclcpp::init(argc, argv); - rclcpp::spin(std::make_shared()); - rclcpp::shutdown(); - return 0; -} \ No newline at end of file From 6bc7d5595e0c771d979153b9a5788d1b2f151335 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Thu, 9 Dec 2021 18:54:33 +0900 Subject: [PATCH 04/56] health_pubsub modified --- mros2_health_pubsub/src/pub_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mros2_health_pubsub/src/pub_node.cpp b/mros2_health_pubsub/src/pub_node.cpp index b8a9c88..50c8039 100644 --- a/mros2_health_pubsub/src/pub_node.cpp +++ b/mros2_health_pubsub/src/pub_node.cpp @@ -28,7 +28,7 @@ class Publisher : public rclcpp::Node message.name = std::to_string(count_++); message.height = 170; message.weight = 63.5; - RCLCPP_INFO(this->get_logger(), "Publishing msg: { name: '%s', height: %d cm, weight: %f kg }", message.name.c_str(), message.height, message.weight); + RCLCPP_INFO(this->get_logger(), "Publishing msg: { name: '%s', height: %u cm, weight: %f kg }", message.name.c_str(), message.height, message.weight); publisher_->publish(message); } rclcpp::TimerBase::SharedPtr timer_; From 6c461acfcd58c47df663b7019b6e461417a8d341 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Thu, 9 Dec 2021 20:24:40 +0900 Subject: [PATCH 05/56] health_pubsub modified --- mros2_health_pubsub/src/pub_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mros2_health_pubsub/src/pub_node.cpp b/mros2_health_pubsub/src/pub_node.cpp index 50c8039..ca2f78d 100644 --- a/mros2_health_pubsub/src/pub_node.cpp +++ b/mros2_health_pubsub/src/pub_node.cpp @@ -18,7 +18,7 @@ class Publisher : public rclcpp::Node : Node("pub_mros2"), count_(0) { publisher_ = this->create_publisher("to_stm", 10); - timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); + timer_ = this->create_wall_timer(5000ms, std::bind(&Publisher::timer_callback, this)); } private: From 9842e6621428fe96ee81773cc10674c885b17478 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Thu, 9 Dec 2021 20:26:01 +0900 Subject: [PATCH 06/56] health_pubsub modified --- mros2_health_pubsub/src/pub_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mros2_health_pubsub/src/pub_node.cpp b/mros2_health_pubsub/src/pub_node.cpp index ca2f78d..50c8039 100644 --- a/mros2_health_pubsub/src/pub_node.cpp +++ b/mros2_health_pubsub/src/pub_node.cpp @@ -18,7 +18,7 @@ class Publisher : public rclcpp::Node : Node("pub_mros2"), count_(0) { publisher_ = this->create_publisher("to_stm", 10); - timer_ = this->create_wall_timer(5000ms, std::bind(&Publisher::timer_callback, this)); + timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); } private: From 86938c44b1ceb823308040bac792d9875799507f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Thu, 9 Dec 2021 23:41:03 +0900 Subject: [PATCH 07/56] health_pubsub modified --- mros2_health_pubsub/src/pub_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mros2_health_pubsub/src/pub_node.cpp b/mros2_health_pubsub/src/pub_node.cpp index 50c8039..36bad41 100644 --- a/mros2_health_pubsub/src/pub_node.cpp +++ b/mros2_health_pubsub/src/pub_node.cpp @@ -28,7 +28,7 @@ class Publisher : public rclcpp::Node message.name = std::to_string(count_++); message.height = 170; message.weight = 63.5; - RCLCPP_INFO(this->get_logger(), "Publishing msg: { name: '%s', height: %u cm, weight: %f kg }", message.name.c_str(), message.height, message.weight); + RCLCPP_INFO(this->get_logger(), "Publishing msg: { name: 'Hibara', height: %u cm, weight: %f kg }", message.height, message.weight); publisher_->publish(message); } rclcpp::TimerBase::SharedPtr timer_; From 14c52235384bda4c9d6f841ae3417f6a06b04fca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Thu, 9 Dec 2021 23:43:57 +0900 Subject: [PATCH 08/56] health_pubsub modified --- mros2_health_pubsub/src/pub_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mros2_health_pubsub/src/pub_node.cpp b/mros2_health_pubsub/src/pub_node.cpp index 36bad41..322d03e 100644 --- a/mros2_health_pubsub/src/pub_node.cpp +++ b/mros2_health_pubsub/src/pub_node.cpp @@ -25,7 +25,7 @@ class Publisher : public rclcpp::Node void timer_callback() { auto message = health_msgs::msg::Health(); - message.name = std::to_string(count_++); + message.name = "Hibara"; //std::to_string(count_++); message.height = 170; message.weight = 63.5; RCLCPP_INFO(this->get_logger(), "Publishing msg: { name: 'Hibara', height: %u cm, weight: %f kg }", message.height, message.weight); From f42d13038c7c412c31120e77f909a5e206eb41e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Thu, 9 Dec 2021 23:45:40 +0900 Subject: [PATCH 09/56] health_pubsub modified --- mros2_health_pubsub/src/pub_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mros2_health_pubsub/src/pub_node.cpp b/mros2_health_pubsub/src/pub_node.cpp index 322d03e..fc341e7 100644 --- a/mros2_health_pubsub/src/pub_node.cpp +++ b/mros2_health_pubsub/src/pub_node.cpp @@ -25,7 +25,7 @@ class Publisher : public rclcpp::Node void timer_callback() { auto message = health_msgs::msg::Health(); - message.name = "Hibara"; //std::to_string(count_++); + message.name = "H"; //std::to_string(count_++); message.height = 170; message.weight = 63.5; RCLCPP_INFO(this->get_logger(), "Publishing msg: { name: 'Hibara', height: %u cm, weight: %f kg }", message.height, message.weight); From 952c51373840891092dbd7d78c7cc1f44fce2b80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Sat, 11 Dec 2021 13:43:36 +0900 Subject: [PATCH 10/56] pub_node of health_pubsub modified --- mros2_health_pubsub/src/pub_node.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mros2_health_pubsub/src/pub_node.cpp b/mros2_health_pubsub/src/pub_node.cpp index fc341e7..50c8039 100644 --- a/mros2_health_pubsub/src/pub_node.cpp +++ b/mros2_health_pubsub/src/pub_node.cpp @@ -25,10 +25,10 @@ class Publisher : public rclcpp::Node void timer_callback() { auto message = health_msgs::msg::Health(); - message.name = "H"; //std::to_string(count_++); + message.name = std::to_string(count_++); message.height = 170; message.weight = 63.5; - RCLCPP_INFO(this->get_logger(), "Publishing msg: { name: 'Hibara', height: %u cm, weight: %f kg }", message.height, message.weight); + RCLCPP_INFO(this->get_logger(), "Publishing msg: { name: '%s', height: %u cm, weight: %f kg }", message.name.c_str(), message.height, message.weight); publisher_->publish(message); } rclcpp::TimerBase::SharedPtr timer_; From 083d0405b0163ef6163ec721cfc941f1c39dcbc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Sat, 11 Dec 2021 14:28:00 +0900 Subject: [PATCH 11/56] pub_node of health_pubsub modified --- mros2_health_pubsub/src/pub_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mros2_health_pubsub/src/pub_node.cpp b/mros2_health_pubsub/src/pub_node.cpp index 50c8039..e99473d 100644 --- a/mros2_health_pubsub/src/pub_node.cpp +++ b/mros2_health_pubsub/src/pub_node.cpp @@ -15,7 +15,7 @@ class Publisher : public rclcpp::Node { public: Publisher() - : Node("pub_mros2"), count_(0) + : Node("pub_mros2"), count_(10) { publisher_ = this->create_publisher("to_stm", 10); timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); From f0ddb9cb472cb154515ca010ebc6e5e84db06be4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Sat, 11 Dec 2021 14:29:58 +0900 Subject: [PATCH 12/56] pub_node of health_pubsub modified --- mros2_health_pubsub/src/pub_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mros2_health_pubsub/src/pub_node.cpp b/mros2_health_pubsub/src/pub_node.cpp index e99473d..fb3272f 100644 --- a/mros2_health_pubsub/src/pub_node.cpp +++ b/mros2_health_pubsub/src/pub_node.cpp @@ -15,7 +15,7 @@ class Publisher : public rclcpp::Node { public: Publisher() - : Node("pub_mros2"), count_(10) + : Node("pub_mros2"), count_(100) { publisher_ = this->create_publisher("to_stm", 10); timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); From ca7a310a7f4d70f28413816901766d758c5f5509 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Sat, 11 Dec 2021 14:31:26 +0900 Subject: [PATCH 13/56] pub_node of health_pubsub modified --- mros2_health_pubsub/src/pub_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mros2_health_pubsub/src/pub_node.cpp b/mros2_health_pubsub/src/pub_node.cpp index fb3272f..1771eab 100644 --- a/mros2_health_pubsub/src/pub_node.cpp +++ b/mros2_health_pubsub/src/pub_node.cpp @@ -15,7 +15,7 @@ class Publisher : public rclcpp::Node { public: Publisher() - : Node("pub_mros2"), count_(100) + : Node("pub_mros2"), count_(1000) { publisher_ = this->create_publisher("to_stm", 10); timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); From 7ce937bacf37caaa264ef949e133bff4899a6c1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Sat, 11 Dec 2021 14:34:24 +0900 Subject: [PATCH 14/56] pub_node of health_pubsub modified --- mros2_health_pubsub/src/pub_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mros2_health_pubsub/src/pub_node.cpp b/mros2_health_pubsub/src/pub_node.cpp index 1771eab..749eaa8 100644 --- a/mros2_health_pubsub/src/pub_node.cpp +++ b/mros2_health_pubsub/src/pub_node.cpp @@ -15,7 +15,7 @@ class Publisher : public rclcpp::Node { public: Publisher() - : Node("pub_mros2"), count_(1000) + : Node("pub_mros2"), count_(9990) { publisher_ = this->create_publisher("to_stm", 10); timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); From 75334027df6cd64c0dd5b0f2cc0be8a1f20a0c1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Sat, 11 Dec 2021 14:36:21 +0900 Subject: [PATCH 15/56] pub_node of health_pubsub modified --- mros2_health_pubsub/src/pub_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mros2_health_pubsub/src/pub_node.cpp b/mros2_health_pubsub/src/pub_node.cpp index 749eaa8..620ea24 100644 --- a/mros2_health_pubsub/src/pub_node.cpp +++ b/mros2_health_pubsub/src/pub_node.cpp @@ -15,7 +15,7 @@ class Publisher : public rclcpp::Node { public: Publisher() - : Node("pub_mros2"), count_(9990) + : Node("pub_mros2"), count_(90) { publisher_ = this->create_publisher("to_stm", 10); timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); From 237cea2653555e3189a512436095169aca15b2b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Sat, 11 Dec 2021 14:37:41 +0900 Subject: [PATCH 16/56] pub_node of health_pubsub modified --- mros2_health_pubsub/src/pub_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mros2_health_pubsub/src/pub_node.cpp b/mros2_health_pubsub/src/pub_node.cpp index 620ea24..fb3272f 100644 --- a/mros2_health_pubsub/src/pub_node.cpp +++ b/mros2_health_pubsub/src/pub_node.cpp @@ -15,7 +15,7 @@ class Publisher : public rclcpp::Node { public: Publisher() - : Node("pub_mros2"), count_(90) + : Node("pub_mros2"), count_(100) { publisher_ = this->create_publisher("to_stm", 10); timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); From ddf7948b06903c924e9bb52cbd2346aceef22b99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Sat, 11 Dec 2021 14:39:06 +0900 Subject: [PATCH 17/56] pub_node of health_pubsub modified --- mros2_health_pubsub/src/pub_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mros2_health_pubsub/src/pub_node.cpp b/mros2_health_pubsub/src/pub_node.cpp index fb3272f..b2df9b0 100644 --- a/mros2_health_pubsub/src/pub_node.cpp +++ b/mros2_health_pubsub/src/pub_node.cpp @@ -15,7 +15,7 @@ class Publisher : public rclcpp::Node { public: Publisher() - : Node("pub_mros2"), count_(100) + : Node("pub_mros2"), count_(100000) { publisher_ = this->create_publisher("to_stm", 10); timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); From bafafd1a56d3ff8865f1a00b63284163c87e8b79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Sat, 11 Dec 2021 14:39:19 +0900 Subject: [PATCH 18/56] pub_node of health_pubsub modified --- mros2_health_pubsub/src/pub_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mros2_health_pubsub/src/pub_node.cpp b/mros2_health_pubsub/src/pub_node.cpp index b2df9b0..f85d493 100644 --- a/mros2_health_pubsub/src/pub_node.cpp +++ b/mros2_health_pubsub/src/pub_node.cpp @@ -15,7 +15,7 @@ class Publisher : public rclcpp::Node { public: Publisher() - : Node("pub_mros2"), count_(100000) + : Node("pub_mros2"), count_(99990) { publisher_ = this->create_publisher("to_stm", 10); timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); From b2c2b45f54eededdba34d52706b1b45057ab0850 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Sat, 11 Dec 2021 14:40:37 +0900 Subject: [PATCH 19/56] pub_node of health_pubsub modified --- mros2_health_pubsub/src/pub_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mros2_health_pubsub/src/pub_node.cpp b/mros2_health_pubsub/src/pub_node.cpp index f85d493..e5cbfd6 100644 --- a/mros2_health_pubsub/src/pub_node.cpp +++ b/mros2_health_pubsub/src/pub_node.cpp @@ -15,7 +15,7 @@ class Publisher : public rclcpp::Node { public: Publisher() - : Node("pub_mros2"), count_(99990) + : Node("pub_mros2"), count_(999990) { publisher_ = this->create_publisher("to_stm", 10); timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); From 5e493dd46abe2b76da002576f3383321a3e8d41d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Sat, 11 Dec 2021 14:41:35 +0900 Subject: [PATCH 20/56] pub_node of health_pubsub modified --- mros2_health_pubsub/src/pub_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mros2_health_pubsub/src/pub_node.cpp b/mros2_health_pubsub/src/pub_node.cpp index e5cbfd6..497b7ba 100644 --- a/mros2_health_pubsub/src/pub_node.cpp +++ b/mros2_health_pubsub/src/pub_node.cpp @@ -15,7 +15,7 @@ class Publisher : public rclcpp::Node { public: Publisher() - : Node("pub_mros2"), count_(999990) + : Node("pub_mros2"), count_(1000000) { publisher_ = this->create_publisher("to_stm", 10); timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); From 68d250d86176c8c95438669d2f8c8b3985463a79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Sat, 11 Dec 2021 14:43:30 +0900 Subject: [PATCH 21/56] pub_node of health_pubsub modified --- mros2_health_pubsub/src/pub_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mros2_health_pubsub/src/pub_node.cpp b/mros2_health_pubsub/src/pub_node.cpp index 497b7ba..c6db4e9 100644 --- a/mros2_health_pubsub/src/pub_node.cpp +++ b/mros2_health_pubsub/src/pub_node.cpp @@ -15,7 +15,7 @@ class Publisher : public rclcpp::Node { public: Publisher() - : Node("pub_mros2"), count_(1000000) + : Node("pub_mros2"), count_(5000000) { publisher_ = this->create_publisher("to_stm", 10); timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); From 6bde649f07b3cd285b885b9d9ca8b102c03c987b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Sat, 11 Dec 2021 14:44:26 +0900 Subject: [PATCH 22/56] pub_node of health_pubsub modified --- mros2_health_pubsub/src/pub_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mros2_health_pubsub/src/pub_node.cpp b/mros2_health_pubsub/src/pub_node.cpp index c6db4e9..749eaa8 100644 --- a/mros2_health_pubsub/src/pub_node.cpp +++ b/mros2_health_pubsub/src/pub_node.cpp @@ -15,7 +15,7 @@ class Publisher : public rclcpp::Node { public: Publisher() - : Node("pub_mros2"), count_(5000000) + : Node("pub_mros2"), count_(9990) { publisher_ = this->create_publisher("to_stm", 10); timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); From 9bd09ef70f9d9bb98de620284974e66ce26f3c81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Sat, 11 Dec 2021 14:57:43 +0900 Subject: [PATCH 23/56] pub_node of health_pubsub modified --- mros2_health_pubsub/src/pub_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mros2_health_pubsub/src/pub_node.cpp b/mros2_health_pubsub/src/pub_node.cpp index 749eaa8..a7006f5 100644 --- a/mros2_health_pubsub/src/pub_node.cpp +++ b/mros2_health_pubsub/src/pub_node.cpp @@ -15,7 +15,7 @@ class Publisher : public rclcpp::Node { public: Publisher() - : Node("pub_mros2"), count_(9990) + : Node("pub_mros2"), count_(10000000) { publisher_ = this->create_publisher("to_stm", 10); timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); From 45181d608a063e2f17d9d536703e72511557eae6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Sat, 11 Dec 2021 14:59:56 +0900 Subject: [PATCH 24/56] pub_node of health_pubsub modified --- mros2_health_pubsub/src/pub_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mros2_health_pubsub/src/pub_node.cpp b/mros2_health_pubsub/src/pub_node.cpp index a7006f5..5c21f38 100644 --- a/mros2_health_pubsub/src/pub_node.cpp +++ b/mros2_health_pubsub/src/pub_node.cpp @@ -15,7 +15,7 @@ class Publisher : public rclcpp::Node { public: Publisher() - : Node("pub_mros2"), count_(10000000) + : Node("pub_mros2"), count_(99999990) { publisher_ = this->create_publisher("to_stm", 10); timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); From 9213d2ae9b9b1b798cba7b88558d84ff5fdd04fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Sat, 11 Dec 2021 15:12:39 +0900 Subject: [PATCH 25/56] pub_node of health_pubsub modified --- mros2_health_pubsub/src/pub_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mros2_health_pubsub/src/pub_node.cpp b/mros2_health_pubsub/src/pub_node.cpp index 5c21f38..f032848 100644 --- a/mros2_health_pubsub/src/pub_node.cpp +++ b/mros2_health_pubsub/src/pub_node.cpp @@ -15,7 +15,7 @@ class Publisher : public rclcpp::Node { public: Publisher() - : Node("pub_mros2"), count_(99999990) + : Node("pub_mros2"), count_(100000000) { publisher_ = this->create_publisher("to_stm", 10); timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); From a7ca3683f883fd4bc8ac7540303e26f4d9f09773 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Sat, 11 Dec 2021 15:13:40 +0900 Subject: [PATCH 26/56] pub_node of health_pubsub modified --- mros2_health_pubsub/src/pub_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mros2_health_pubsub/src/pub_node.cpp b/mros2_health_pubsub/src/pub_node.cpp index f032848..5c21f38 100644 --- a/mros2_health_pubsub/src/pub_node.cpp +++ b/mros2_health_pubsub/src/pub_node.cpp @@ -15,7 +15,7 @@ class Publisher : public rclcpp::Node { public: Publisher() - : Node("pub_mros2"), count_(100000000) + : Node("pub_mros2"), count_(99999990) { publisher_ = this->create_publisher("to_stm", 10); timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); From 2b18df85dcf0bc8fa790325dfd68053152eafbbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Sat, 11 Dec 2021 15:14:36 +0900 Subject: [PATCH 27/56] pub_node of health_pubsub modified --- mros2_health_pubsub/src/pub_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mros2_health_pubsub/src/pub_node.cpp b/mros2_health_pubsub/src/pub_node.cpp index 5c21f38..bceffe2 100644 --- a/mros2_health_pubsub/src/pub_node.cpp +++ b/mros2_health_pubsub/src/pub_node.cpp @@ -15,7 +15,7 @@ class Publisher : public rclcpp::Node { public: Publisher() - : Node("pub_mros2"), count_(99999990) + : Node("pub_mros2"), count_(999999990) { publisher_ = this->create_publisher("to_stm", 10); timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); From deb1a37087c011a3f5a05e2681a7dc315e60f7b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Sat, 11 Dec 2021 15:16:29 +0900 Subject: [PATCH 28/56] pub_node of health_pubsub modified --- mros2_health_pubsub/src/pub_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mros2_health_pubsub/src/pub_node.cpp b/mros2_health_pubsub/src/pub_node.cpp index bceffe2..3c65948 100644 --- a/mros2_health_pubsub/src/pub_node.cpp +++ b/mros2_health_pubsub/src/pub_node.cpp @@ -15,7 +15,7 @@ class Publisher : public rclcpp::Node { public: Publisher() - : Node("pub_mros2"), count_(999999990) + : Node("pub_mros2"), count_(9999999990) { publisher_ = this->create_publisher("to_stm", 10); timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); From a5251c9d0b799a0c4c40870732501783add4d440 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Sat, 11 Dec 2021 15:17:34 +0900 Subject: [PATCH 29/56] pub_node of health_pubsub modified --- mros2_health_pubsub/src/pub_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mros2_health_pubsub/src/pub_node.cpp b/mros2_health_pubsub/src/pub_node.cpp index 3c65948..0df8939 100644 --- a/mros2_health_pubsub/src/pub_node.cpp +++ b/mros2_health_pubsub/src/pub_node.cpp @@ -15,7 +15,7 @@ class Publisher : public rclcpp::Node { public: Publisher() - : Node("pub_mros2"), count_(9999999990) + : Node("pub_mros2"), count_(99999999990) { publisher_ = this->create_publisher("to_stm", 10); timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); From 4c4978cbba04ab9f2ea247833ae801f75c1747a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Sat, 11 Dec 2021 15:18:19 +0900 Subject: [PATCH 30/56] pub_node of health_pubsub modified --- mros2_health_pubsub/src/pub_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mros2_health_pubsub/src/pub_node.cpp b/mros2_health_pubsub/src/pub_node.cpp index 0df8939..d347d4b 100644 --- a/mros2_health_pubsub/src/pub_node.cpp +++ b/mros2_health_pubsub/src/pub_node.cpp @@ -15,7 +15,7 @@ class Publisher : public rclcpp::Node { public: Publisher() - : Node("pub_mros2"), count_(99999999990) + : Node("pub_mros2"), count_(999999999990) { publisher_ = this->create_publisher("to_stm", 10); timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); From 0d6a184c2fd1b9ac4436e10c15c7a721a3a1de78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Sat, 11 Dec 2021 15:45:53 +0900 Subject: [PATCH 31/56] pub_node of health_pubsub modified --- mros2_health_pubsub/src/pub_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mros2_health_pubsub/src/pub_node.cpp b/mros2_health_pubsub/src/pub_node.cpp index d347d4b..50c8039 100644 --- a/mros2_health_pubsub/src/pub_node.cpp +++ b/mros2_health_pubsub/src/pub_node.cpp @@ -15,7 +15,7 @@ class Publisher : public rclcpp::Node { public: Publisher() - : Node("pub_mros2"), count_(999999999990) + : Node("pub_mros2"), count_(0) { publisher_ = this->create_publisher("to_stm", 10); timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); From fe517aa5a153854aa20c6fb261506fa734fa71ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Sat, 11 Dec 2021 16:02:28 +0900 Subject: [PATCH 32/56] pub_node of health_pubsub modified --- mros2_health_pubsub/src/pub_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mros2_health_pubsub/src/pub_node.cpp b/mros2_health_pubsub/src/pub_node.cpp index 50c8039..8b7df0c 100644 --- a/mros2_health_pubsub/src/pub_node.cpp +++ b/mros2_health_pubsub/src/pub_node.cpp @@ -25,7 +25,7 @@ class Publisher : public rclcpp::Node void timer_callback() { auto message = health_msgs::msg::Health(); - message.name = std::to_string(count_++); + message.name = "Hi"; message.height = 170; message.weight = 63.5; RCLCPP_INFO(this->get_logger(), "Publishing msg: { name: '%s', height: %u cm, weight: %f kg }", message.name.c_str(), message.height, message.weight); From 61f05074c227f92523382f6b4c7b21988ea12311 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Thu, 16 Dec 2021 14:03:27 +0900 Subject: [PATCH 33/56] float_location app added --- .../float_location_msgs/CMakeLists.txt | 37 +++++++++++ .../float_location_msgs/msg/FloatLocation.msg | 3 + custom_msgs/float_location_msgs/package.xml | 23 +++++++ mros2_float_location_pubsub/CMakeLists.txt | 62 +++++++++++++++++++ .../launch/launch_pubsub.py | 21 +++++++ mros2_float_location_pubsub/package.xml | 21 +++++++ mros2_float_location_pubsub/src/pub_node.cpp | 45 ++++++++++++++ mros2_float_location_pubsub/src/sub_node.cpp | 34 ++++++++++ 8 files changed, 246 insertions(+) create mode 100644 custom_msgs/float_location_msgs/CMakeLists.txt create mode 100644 custom_msgs/float_location_msgs/msg/FloatLocation.msg create mode 100644 custom_msgs/float_location_msgs/package.xml create mode 100644 mros2_float_location_pubsub/CMakeLists.txt create mode 100644 mros2_float_location_pubsub/launch/launch_pubsub.py create mode 100644 mros2_float_location_pubsub/package.xml create mode 100644 mros2_float_location_pubsub/src/pub_node.cpp create mode 100644 mros2_float_location_pubsub/src/sub_node.cpp diff --git a/custom_msgs/float_location_msgs/CMakeLists.txt b/custom_msgs/float_location_msgs/CMakeLists.txt new file mode 100644 index 0000000..40c46f9 --- /dev/null +++ b/custom_msgs/float_location_msgs/CMakeLists.txt @@ -0,0 +1,37 @@ +cmake_minimum_required(VERSION 3.5) +project(float_location_msgs) + +# Default to C99 +if(NOT CMAKE_C_STANDARD) + set(CMAKE_C_STANDARD 99) +endif() + +# Default to C++14 +if(NOT CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 14) +endif() + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +# find dependencies +find_package(ament_cmake REQUIRED) +find_package(rosidl_default_generators REQUIRED) + +rosidl_generate_interfaces(${PROJECT_NAME} + "msg/FloatLocation.msg" +) + +if(BUILD_TESTING) + find_package(ament_lint_auto REQUIRED) + # the following line skips the linter which checks for copyrights + # uncomment the line when a copyright and license is not present in all source files + #set(ament_cmake_copyright_FOUND TRUE) + # the following line skips cpplint (only works in a git repo) + # uncomment the line when this package is not in a git repo + #set(ament_cmake_cpplint_FOUND TRUE) + ament_lint_auto_find_test_dependencies() +endif() + +ament_package() \ No newline at end of file diff --git a/custom_msgs/float_location_msgs/msg/FloatLocation.msg b/custom_msgs/float_location_msgs/msg/FloatLocation.msg new file mode 100644 index 0000000..0fb5429 --- /dev/null +++ b/custom_msgs/float_location_msgs/msg/FloatLocation.msg @@ -0,0 +1,3 @@ +float32 x +float32 y +float32 z \ No newline at end of file diff --git a/custom_msgs/float_location_msgs/package.xml b/custom_msgs/float_location_msgs/package.xml new file mode 100644 index 0000000..57aceb4 --- /dev/null +++ b/custom_msgs/float_location_msgs/package.xml @@ -0,0 +1,23 @@ + + + + float_location_msgs + 0.0.0 + TODO: Package description + uden + TODO: License declaration + + ament_cmake + + rosidl_default_generators + rosidl_default_runtime + + rosidl_interface_packages + + ament_lint_auto + ament_lint_common + + + ament_cmake + + \ No newline at end of file diff --git a/mros2_float_location_pubsub/CMakeLists.txt b/mros2_float_location_pubsub/CMakeLists.txt new file mode 100644 index 0000000..93d94d1 --- /dev/null +++ b/mros2_float_location_pubsub/CMakeLists.txt @@ -0,0 +1,62 @@ +cmake_minimum_required(VERSION 3.5) +project(mros2_float_location_pubsub) + + +# Default to C99 +if(NOT CMAKE_C_STANDARD) + set(CMAKE_C_STANDARD 99) +endif() + +# Default to C++14 +if(NOT CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 14) +endif() + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +# find dependencies +find_package(ament_cmake REQUIRED) +find_package(rclcpp REQUIRED) +find_package(location_msgs REQUIRED) +# uncomment the following section in order to fill in +# further dependencies manually. +# find_package( REQUIRED) + +add_executable(pub_node src/pub_node.cpp) +ament_target_dependencies(pub_node rclcpp float_location_msgs) + +add_executable(sub_node src/sub_node.cpp) +ament_target_dependencies(sub_node rclcpp float_location_msgs) + +target_include_directories(pub_node PUBLIC + $ + $) + +target_include_directories(sub_node PUBLIC + $ + $) + +install(TARGETS pub_node + DESTINATION lib/${PROJECT_NAME}) +install(TARGETS sub_node + DESTINATION lib/${PROJECT_NAME}) + +install(DIRECTORY + launch + DESTINATION share/${PROJECT_NAME} +) + +if(BUILD_TESTING) + find_package(ament_lint_auto REQUIRED) + # the following line skips the linter which checks for copyrights + # uncomment the line when a copyright and license is not present in all source files + #set(ament_cmake_copyright_FOUND TRUE) + # the following line skips cpplint (only works in a git repo) + # uncomment the line when this package is not in a git repo + #set(ament_cmake_cpplint_FOUND TRUE) + ament_lint_auto_find_test_dependencies() +endif() + +ament_package() diff --git a/mros2_float_location_pubsub/launch/launch_pubsub.py b/mros2_float_location_pubsub/launch/launch_pubsub.py new file mode 100644 index 0000000..469410c --- /dev/null +++ b/mros2_float_location_pubsub/launch/launch_pubsub.py @@ -0,0 +1,21 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +# Note: `node_`, `prefix` and `output` will be removed on Foxy +def generate_launch_description(): + return LaunchDescription([ + Node( + package='mros2_float_location_pubsub', + node_executable='pub_node', + node_name='pub_mros2', + prefix=['stdbuf -o L'], + output="screen" + ), + Node( + package='mros2_float_location_pubsub', + node_executable='sub_node', + node_name='mros2_sub', + prefix=['stdbuf -o L'], + output="screen" + ) + ]) diff --git a/mros2_float_location_pubsub/package.xml b/mros2_float_location_pubsub/package.xml new file mode 100644 index 0000000..c07c419 --- /dev/null +++ b/mros2_float_location_pubsub/package.xml @@ -0,0 +1,21 @@ + + + + mros2_float_location_pubsub + 0.0.0 + TODO: Package description + uden + TODO: License declaration + + ament_cmake +rclcpp +float_location_msgs +rclcpp +float_location_msgs + ament_lint_auto + ament_lint_common + + + ament_cmake + + diff --git a/mros2_float_location_pubsub/src/pub_node.cpp b/mros2_float_location_pubsub/src/pub_node.cpp new file mode 100644 index 0000000..b4f85d8 --- /dev/null +++ b/mros2_float_location_pubsub/src/pub_node.cpp @@ -0,0 +1,45 @@ +#include +#include +#include +#include + +#include "rclcpp/rclcpp.hpp" +#include "location_msgs/msg/float_location.hpp" + +using namespace std::chrono_literals; + +/* This example creates a subclass of Node and uses std::bind() to register a +* member function as a callback from the timer. */ + +class Publisher : public rclcpp::Node +{ +public: + Publisher() + : Node("pub_mros2"), count_(0) + { + publisher_ = this->create_publisher("to_stm", 10); + timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); + } + +private: + void timer_callback() + { + auto message = location_msgs::msg::FloatLocation(); + message.x = count_++/10.0; + message.y = 2*count_++/10.0; + message.z = 3*count_++/10.0; + RCLCPP_INFO(this->get_logger(), "Publishing msg: { x: %f, y: %f, z: %f }", message.x,message.y, message.z); + publisher_->publish(message); + } + rclcpp::TimerBase::SharedPtr timer_; + rclcpp::Publisher::SharedPtr publisher_; + size_t count_; +}; + +int main(int argc, char *argv[]) +{ + rclcpp::init(argc, argv); + rclcpp::spin(std::make_shared()); + rclcpp::shutdown(); + return 0; +} diff --git a/mros2_float_location_pubsub/src/sub_node.cpp b/mros2_float_location_pubsub/src/sub_node.cpp new file mode 100644 index 0000000..d7522b8 --- /dev/null +++ b/mros2_float_location_pubsub/src/sub_node.cpp @@ -0,0 +1,34 @@ +#include +#include +#include +#include + +#include "rclcpp/rclcpp.hpp" +#include "location_msgs/msg/float_location.hpp" + +using std::placeholders::_1; + +class Subscriber : public rclcpp::Node +{ +public: + Subscriber() : Node("mros2_sub") + { + subscriber_ = this->create_subscription("to_linux", rclcpp::QoS(10).best_effort(), std::bind(&Subscriber::topic_callback, this, _1)); + } + +private: + void topic_callback(const location_msgs::msg::FloatLocation::SharedPtr message) const + { + RCLCPP_INFO(this->get_logger(), "Subscribed msg: { x: %f, y: %f, z: %f }", message->x,message->y, message->z); + } + rclcpp::Subscription::SharedPtr subscriber_; +}; + + +int main(int argc, char *argv[]) +{ + rclcpp::init(argc, argv); + rclcpp::spin(std::make_shared()); + rclcpp::shutdown(); + return 0; +} \ No newline at end of file From c9c636822501688285ee67a24e516555aed3c169 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Thu, 16 Dec 2021 14:05:17 +0900 Subject: [PATCH 34/56] float_location app added --- mros2_float_location_pubsub/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mros2_float_location_pubsub/CMakeLists.txt b/mros2_float_location_pubsub/CMakeLists.txt index 93d94d1..9455076 100644 --- a/mros2_float_location_pubsub/CMakeLists.txt +++ b/mros2_float_location_pubsub/CMakeLists.txt @@ -19,7 +19,7 @@ endif() # find dependencies find_package(ament_cmake REQUIRED) find_package(rclcpp REQUIRED) -find_package(location_msgs REQUIRED) +find_package(float_location_msgs REQUIRED) # uncomment the following section in order to fill in # further dependencies manually. # find_package( REQUIRED) From 826edd1743ea2db12542a4e3056d75acd147bdc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Thu, 16 Dec 2021 14:19:49 +0900 Subject: [PATCH 35/56] float_location app added --- mros2_float_location_pubsub/src/pub_node.cpp | 2 +- mros2_float_location_pubsub/src/sub_node.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mros2_float_location_pubsub/src/pub_node.cpp b/mros2_float_location_pubsub/src/pub_node.cpp index b4f85d8..f4229d4 100644 --- a/mros2_float_location_pubsub/src/pub_node.cpp +++ b/mros2_float_location_pubsub/src/pub_node.cpp @@ -4,7 +4,7 @@ #include #include "rclcpp/rclcpp.hpp" -#include "location_msgs/msg/float_location.hpp" +#include "location_msgs/msg/floatlocation.hpp" using namespace std::chrono_literals; diff --git a/mros2_float_location_pubsub/src/sub_node.cpp b/mros2_float_location_pubsub/src/sub_node.cpp index d7522b8..e695834 100644 --- a/mros2_float_location_pubsub/src/sub_node.cpp +++ b/mros2_float_location_pubsub/src/sub_node.cpp @@ -4,7 +4,7 @@ #include #include "rclcpp/rclcpp.hpp" -#include "location_msgs/msg/float_location.hpp" +#include "location_msgs/msg/floatlocation.hpp" using std::placeholders::_1; From 1714d7c84821d31abee0d855fafa01ea4d0f883e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Thu, 16 Dec 2021 14:22:00 +0900 Subject: [PATCH 36/56] float_location app added --- mros2_float_location_pubsub/src/pub_node.cpp | 2 +- mros2_float_location_pubsub/src/sub_node.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mros2_float_location_pubsub/src/pub_node.cpp b/mros2_float_location_pubsub/src/pub_node.cpp index f4229d4..aad9e74 100644 --- a/mros2_float_location_pubsub/src/pub_node.cpp +++ b/mros2_float_location_pubsub/src/pub_node.cpp @@ -4,7 +4,7 @@ #include #include "rclcpp/rclcpp.hpp" -#include "location_msgs/msg/floatlocation.hpp" +#include "float_location_msgs/msg/float_location.hpp" using namespace std::chrono_literals; diff --git a/mros2_float_location_pubsub/src/sub_node.cpp b/mros2_float_location_pubsub/src/sub_node.cpp index e695834..123a3f3 100644 --- a/mros2_float_location_pubsub/src/sub_node.cpp +++ b/mros2_float_location_pubsub/src/sub_node.cpp @@ -4,7 +4,7 @@ #include #include "rclcpp/rclcpp.hpp" -#include "location_msgs/msg/floatlocation.hpp" +#include "float_location_msgs/msg/float_location.hpp" using std::placeholders::_1; From dd2255c379c32440e5baa94f5217f05ab75ff863 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AA=9C=E5=8E=9F=E9=99=BD=E4=B8=80=E9=83=8E?= Date: Thu, 16 Dec 2021 14:23:20 +0900 Subject: [PATCH 37/56] float_location app added --- mros2_float_location_pubsub/src/pub_node.cpp | 6 +++--- mros2_float_location_pubsub/src/sub_node.cpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mros2_float_location_pubsub/src/pub_node.cpp b/mros2_float_location_pubsub/src/pub_node.cpp index aad9e74..4192938 100644 --- a/mros2_float_location_pubsub/src/pub_node.cpp +++ b/mros2_float_location_pubsub/src/pub_node.cpp @@ -17,14 +17,14 @@ class Publisher : public rclcpp::Node Publisher() : Node("pub_mros2"), count_(0) { - publisher_ = this->create_publisher("to_stm", 10); + publisher_ = this->create_publisher("to_stm", 10); timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); } private: void timer_callback() { - auto message = location_msgs::msg::FloatLocation(); + auto message = float_location_msgs::msg::FloatLocation(); message.x = count_++/10.0; message.y = 2*count_++/10.0; message.z = 3*count_++/10.0; @@ -32,7 +32,7 @@ class Publisher : public rclcpp::Node publisher_->publish(message); } rclcpp::TimerBase::SharedPtr timer_; - rclcpp::Publisher::SharedPtr publisher_; + rclcpp::Publisher::SharedPtr publisher_; size_t count_; }; diff --git a/mros2_float_location_pubsub/src/sub_node.cpp b/mros2_float_location_pubsub/src/sub_node.cpp index 123a3f3..0c21ebf 100644 --- a/mros2_float_location_pubsub/src/sub_node.cpp +++ b/mros2_float_location_pubsub/src/sub_node.cpp @@ -13,15 +13,15 @@ class Subscriber : public rclcpp::Node public: Subscriber() : Node("mros2_sub") { - subscriber_ = this->create_subscription("to_linux", rclcpp::QoS(10).best_effort(), std::bind(&Subscriber::topic_callback, this, _1)); + subscriber_ = this->create_subscription("to_linux", rclcpp::QoS(10).best_effort(), std::bind(&Subscriber::topic_callback, this, _1)); } private: - void topic_callback(const location_msgs::msg::FloatLocation::SharedPtr message) const + void topic_callback(const float_location_msgs::msg::FloatLocation::SharedPtr message) const { RCLCPP_INFO(this->get_logger(), "Subscribed msg: { x: %f, y: %f, z: %f }", message->x,message->y, message->z); } - rclcpp::Subscription::SharedPtr subscriber_; + rclcpp::Subscription::SharedPtr subscriber_; }; From 5255199a01dea0b5ce8cade4c224956d2d7fd332 Mon Sep 17 00:00:00 2001 From: MEIP-users Date: Wed, 22 Dec 2021 16:43:06 +0900 Subject: [PATCH 38/56] mix_msgs pubsub app added(support array) --- .gitignore | 4 ++ .../float_location_msgs/msg/FloatLocation | 3 -- .../CMakeLists.txt | 4 +- custom_msgs/mix_msgs/msg/Mix.msg | 4 ++ .../package.xml | 2 +- .../src/pub_node.cpp | 45 ----------------- .../src/sub_node.cpp | 34 ------------- mros2_echoback_health/src/pub_node.cpp | 2 +- .../CMakeLists.txt | 10 ++-- .../launch/launch_pubsub.py | 6 +-- .../package.xml | 8 ++-- mros2_echoback_mix/src/pub_node.cpp | 48 +++++++++++++++++++ mros2_echoback_mix/src/sub_node.cpp | 34 +++++++++++++ 13 files changed, 106 insertions(+), 98 deletions(-) create mode 100644 .gitignore delete mode 100644 custom_msgs/float_location_msgs/msg/FloatLocation rename custom_msgs/{float_location_msgs => mix_msgs}/CMakeLists.txt (94%) create mode 100644 custom_msgs/mix_msgs/msg/Mix.msg rename custom_msgs/{float_location_msgs => mix_msgs}/package.xml (95%) delete mode 100644 mros2_echoback_float_location/src/pub_node.cpp delete mode 100644 mros2_echoback_float_location/src/sub_node.cpp rename {mros2_echoback_float_location => mros2_echoback_mix}/CMakeLists.txt (87%) rename {mros2_echoback_float_location => mros2_echoback_mix}/launch/launch_pubsub.py (82%) rename {mros2_echoback_float_location => mros2_echoback_mix}/package.xml (80%) create mode 100644 mros2_echoback_mix/src/pub_node.cpp create mode 100644 mros2_echoback_mix/src/sub_node.cpp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f2afc7a --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +log/ +.vscode/ +build/ +install/ \ No newline at end of file diff --git a/custom_msgs/float_location_msgs/msg/FloatLocation b/custom_msgs/float_location_msgs/msg/FloatLocation deleted file mode 100644 index 0fb5429..0000000 --- a/custom_msgs/float_location_msgs/msg/FloatLocation +++ /dev/null @@ -1,3 +0,0 @@ -float32 x -float32 y -float32 z \ No newline at end of file diff --git a/custom_msgs/float_location_msgs/CMakeLists.txt b/custom_msgs/mix_msgs/CMakeLists.txt similarity index 94% rename from custom_msgs/float_location_msgs/CMakeLists.txt rename to custom_msgs/mix_msgs/CMakeLists.txt index 40c46f9..d3d4416 100644 --- a/custom_msgs/float_location_msgs/CMakeLists.txt +++ b/custom_msgs/mix_msgs/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.5) -project(float_location_msgs) +project(mix_msgs) # Default to C99 if(NOT CMAKE_C_STANDARD) @@ -20,7 +20,7 @@ find_package(ament_cmake REQUIRED) find_package(rosidl_default_generators REQUIRED) rosidl_generate_interfaces(${PROJECT_NAME} - "msg/FloatLocation.msg" + "msg/Mix.msg" ) if(BUILD_TESTING) diff --git a/custom_msgs/mix_msgs/msg/Mix.msg b/custom_msgs/mix_msgs/msg/Mix.msg new file mode 100644 index 0000000..1b8f5db --- /dev/null +++ b/custom_msgs/mix_msgs/msg/Mix.msg @@ -0,0 +1,4 @@ +string name +uint16 height +float32 weight +uint32[] array \ No newline at end of file diff --git a/custom_msgs/float_location_msgs/package.xml b/custom_msgs/mix_msgs/package.xml similarity index 95% rename from custom_msgs/float_location_msgs/package.xml rename to custom_msgs/mix_msgs/package.xml index 57aceb4..8ebe014 100644 --- a/custom_msgs/float_location_msgs/package.xml +++ b/custom_msgs/mix_msgs/package.xml @@ -1,7 +1,7 @@ - float_location_msgs + mix_msgs 0.0.0 TODO: Package description uden diff --git a/mros2_echoback_float_location/src/pub_node.cpp b/mros2_echoback_float_location/src/pub_node.cpp deleted file mode 100644 index 4192938..0000000 --- a/mros2_echoback_float_location/src/pub_node.cpp +++ /dev/null @@ -1,45 +0,0 @@ -#include -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "float_location_msgs/msg/float_location.hpp" - -using namespace std::chrono_literals; - -/* This example creates a subclass of Node and uses std::bind() to register a -* member function as a callback from the timer. */ - -class Publisher : public rclcpp::Node -{ -public: - Publisher() - : Node("pub_mros2"), count_(0) - { - publisher_ = this->create_publisher("to_stm", 10); - timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); - } - -private: - void timer_callback() - { - auto message = float_location_msgs::msg::FloatLocation(); - message.x = count_++/10.0; - message.y = 2*count_++/10.0; - message.z = 3*count_++/10.0; - RCLCPP_INFO(this->get_logger(), "Publishing msg: { x: %f, y: %f, z: %f }", message.x,message.y, message.z); - publisher_->publish(message); - } - rclcpp::TimerBase::SharedPtr timer_; - rclcpp::Publisher::SharedPtr publisher_; - size_t count_; -}; - -int main(int argc, char *argv[]) -{ - rclcpp::init(argc, argv); - rclcpp::spin(std::make_shared()); - rclcpp::shutdown(); - return 0; -} diff --git a/mros2_echoback_float_location/src/sub_node.cpp b/mros2_echoback_float_location/src/sub_node.cpp deleted file mode 100644 index 0c21ebf..0000000 --- a/mros2_echoback_float_location/src/sub_node.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "float_location_msgs/msg/float_location.hpp" - -using std::placeholders::_1; - -class Subscriber : public rclcpp::Node -{ -public: - Subscriber() : Node("mros2_sub") - { - subscriber_ = this->create_subscription("to_linux", rclcpp::QoS(10).best_effort(), std::bind(&Subscriber::topic_callback, this, _1)); - } - -private: - void topic_callback(const float_location_msgs::msg::FloatLocation::SharedPtr message) const - { - RCLCPP_INFO(this->get_logger(), "Subscribed msg: { x: %f, y: %f, z: %f }", message->x,message->y, message->z); - } - rclcpp::Subscription::SharedPtr subscriber_; -}; - - -int main(int argc, char *argv[]) -{ - rclcpp::init(argc, argv); - rclcpp::spin(std::make_shared()); - rclcpp::shutdown(); - return 0; -} \ No newline at end of file diff --git a/mros2_echoback_health/src/pub_node.cpp b/mros2_echoback_health/src/pub_node.cpp index 8b7df0c..50c8039 100644 --- a/mros2_echoback_health/src/pub_node.cpp +++ b/mros2_echoback_health/src/pub_node.cpp @@ -25,7 +25,7 @@ class Publisher : public rclcpp::Node void timer_callback() { auto message = health_msgs::msg::Health(); - message.name = "Hi"; + message.name = std::to_string(count_++); message.height = 170; message.weight = 63.5; RCLCPP_INFO(this->get_logger(), "Publishing msg: { name: '%s', height: %u cm, weight: %f kg }", message.name.c_str(), message.height, message.weight); diff --git a/mros2_echoback_float_location/CMakeLists.txt b/mros2_echoback_mix/CMakeLists.txt similarity index 87% rename from mros2_echoback_float_location/CMakeLists.txt rename to mros2_echoback_mix/CMakeLists.txt index 4b7171a..f61e790 100644 --- a/mros2_echoback_float_location/CMakeLists.txt +++ b/mros2_echoback_mix/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.5) -project(mros2_echoback_float_location) +project(mros2_echoback_mix) # Default to C99 @@ -19,16 +19,16 @@ endif() # find dependencies find_package(ament_cmake REQUIRED) find_package(rclcpp REQUIRED) -find_package(float_location_msgs REQUIRED) +find_package(mix_msgs REQUIRED) # uncomment the following section in order to fill in # further dependencies manually. # find_package( REQUIRED) add_executable(pub_node src/pub_node.cpp) -ament_target_dependencies(pub_node rclcpp float_location_msgs) +ament_target_dependencies(pub_node rclcpp mix_msgs) add_executable(sub_node src/sub_node.cpp) -ament_target_dependencies(sub_node rclcpp float_location_msgs) +ament_target_dependencies(sub_node rclcpp mix_msgs) target_include_directories(pub_node PUBLIC $ @@ -59,4 +59,4 @@ if(BUILD_TESTING) ament_lint_auto_find_test_dependencies() endif() -ament_package() +ament_package() \ No newline at end of file diff --git a/mros2_echoback_float_location/launch/launch_pubsub.py b/mros2_echoback_mix/launch/launch_pubsub.py similarity index 82% rename from mros2_echoback_float_location/launch/launch_pubsub.py rename to mros2_echoback_mix/launch/launch_pubsub.py index 974491e..dc56c29 100644 --- a/mros2_echoback_float_location/launch/launch_pubsub.py +++ b/mros2_echoback_mix/launch/launch_pubsub.py @@ -5,17 +5,17 @@ def generate_launch_description(): return LaunchDescription([ Node( - package='mros2_echoback_float_location', + package='mros2_echoback_mix', node_executable='pub_node', node_name='pub_mros2', prefix=['stdbuf -o L'], output="screen" ), Node( - package='mros2_echoback_float_location', + package='mros2_echoback_mix', node_executable='sub_node', node_name='mros2_sub', prefix=['stdbuf -o L'], output="screen" ) - ]) + ]) \ No newline at end of file diff --git a/mros2_echoback_float_location/package.xml b/mros2_echoback_mix/package.xml similarity index 80% rename from mros2_echoback_float_location/package.xml rename to mros2_echoback_mix/package.xml index 7349b49..2a71f50 100644 --- a/mros2_echoback_float_location/package.xml +++ b/mros2_echoback_mix/package.xml @@ -1,7 +1,7 @@ - mros2_echoback_float_location + mros2_echoback_mix 0.0.0 TODO: Package description uden @@ -9,13 +9,13 @@ ament_cmake rclcpp -float_location_msgs +mix_msgs rclcpp -float_location_msgs +mix_msgs ament_lint_auto ament_lint_common ament_cmake - + \ No newline at end of file diff --git a/mros2_echoback_mix/src/pub_node.cpp b/mros2_echoback_mix/src/pub_node.cpp new file mode 100644 index 0000000..dbc0ccb --- /dev/null +++ b/mros2_echoback_mix/src/pub_node.cpp @@ -0,0 +1,48 @@ +#include +#include +#include +#include + +#include "rclcpp/rclcpp.hpp" +#include "mix_msgs/msg/mix.hpp" + +using namespace std::chrono_literals; + +/* This example creates a subclass of Node and uses std::bind() to register a +* member function as a callback from the timer. */ + +class Publisher : public rclcpp::Node +{ +public: + Publisher() + : Node("pub_mros2"), count_(0) + { + publisher_ = this->create_publisher("to_stm", 10); + timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); + } + +private: + void timer_callback() + { + auto message = mix_msgs::msg::Mix(); + message.name = std::to_string(count_++); + message.height = 170; + message.weight = 63.5; + message.array.push_back(count_); + message.array.push_back(count_+1); + message.array.push_back(count_+2); + RCLCPP_INFO(this->get_logger(), "Publishing msg: { name: '%s', height: %u cm, weight: %f kg, array: {%u,%u,%u} }", message.name.c_str(), message.height, message.weight, message.array[0], message.array[1], message.array[2]); + publisher_->publish(message); + } + rclcpp::TimerBase::SharedPtr timer_; + rclcpp::Publisher::SharedPtr publisher_; + size_t count_; +}; + +int main(int argc, char * argv[]) +{ + rclcpp::init(argc, argv); + rclcpp::spin(std::make_shared()); + rclcpp::shutdown(); + return 0; +} diff --git a/mros2_echoback_mix/src/sub_node.cpp b/mros2_echoback_mix/src/sub_node.cpp new file mode 100644 index 0000000..7f9ee5c --- /dev/null +++ b/mros2_echoback_mix/src/sub_node.cpp @@ -0,0 +1,34 @@ +#include +#include +#include +#include + +#include "rclcpp/rclcpp.hpp" +#include "mix_msgs/msg/mix.hpp" + +using std::placeholders::_1; + +class Subscriber : public rclcpp::Node +{ +public: + Subscriber() : Node("mros2_sub") + { + subscriber_ = this->create_subscription("to_linux", rclcpp::QoS(10).best_effort(), std::bind(&Subscriber::topic_callback, this, _1)); + } + +private: + void topic_callback(const mix_msgs::msg::Mix::SharedPtr message) const + { + RCLCPP_INFO(this->get_logger(), "Subscribed msg: { name: '%s', height: %d cm, weight: %f kg, array: {%u,%u,%u} }", message->name.c_str(), message->height, message->weight, message->array[0], message->array[1], message->array[2]); + } + rclcpp::Subscription::SharedPtr subscriber_; +}; + + +int main(int argc, char *argv[]) +{ + rclcpp::init(argc, argv); + rclcpp::spin(std::make_shared()); + rclcpp::shutdown(); + return 0; +} \ No newline at end of file From 12474b7a5e04bb747794c82e4d29c2642aa9eab0 Mon Sep 17 00:00:00 2001 From: MEIP-users Date: Thu, 23 Dec 2021 00:20:35 +0900 Subject: [PATCH 39/56] vector3 app added --- custom_msgs/geometry_msgs/CMakeLists.txt | 37 +++++++++++ custom_msgs/geometry_msgs/msg/Vector3.msg | 3 + custom_msgs/geometry_msgs/package.xml | 23 +++++++ custom_msgs/mix_msgs/msg/Mix.msg | 2 +- mros2_echoback_vector3/CMakeLists.txt | 62 +++++++++++++++++++ .../launch/launch_pubsub.py | 21 +++++++ mros2_echoback_vector3/package.xml | 21 +++++++ mros2_echoback_vector3/src/pub_node.cpp | 45 ++++++++++++++ mros2_echoback_vector3/src/sub_node.cpp | 34 ++++++++++ 9 files changed, 247 insertions(+), 1 deletion(-) create mode 100644 custom_msgs/geometry_msgs/CMakeLists.txt create mode 100644 custom_msgs/geometry_msgs/msg/Vector3.msg create mode 100644 custom_msgs/geometry_msgs/package.xml create mode 100644 mros2_echoback_vector3/CMakeLists.txt create mode 100644 mros2_echoback_vector3/launch/launch_pubsub.py create mode 100644 mros2_echoback_vector3/package.xml create mode 100644 mros2_echoback_vector3/src/pub_node.cpp create mode 100644 mros2_echoback_vector3/src/sub_node.cpp diff --git a/custom_msgs/geometry_msgs/CMakeLists.txt b/custom_msgs/geometry_msgs/CMakeLists.txt new file mode 100644 index 0000000..351ceb2 --- /dev/null +++ b/custom_msgs/geometry_msgs/CMakeLists.txt @@ -0,0 +1,37 @@ +cmake_minimum_required(VERSION 3.5) +project(geometry_msgs) + +# Default to C99 +if(NOT CMAKE_C_STANDARD) + set(CMAKE_C_STANDARD 99) +endif() + +# Default to C++14 +if(NOT CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 14) +endif() + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +# find dependencies +find_package(ament_cmake REQUIRED) +find_package(rosidl_default_generators REQUIRED) + +rosidl_generate_interfaces(${PROJECT_NAME} + "msg/Vector3.msg" +) + +if(BUILD_TESTING) + find_package(ament_lint_auto REQUIRED) + # the following line skips the linter which checks for copyrights + # uncomment the line when a copyright and license is not present in all source files + #set(ament_cmake_copyright_FOUND TRUE) + # the following line skips cpplint (only works in a git repo) + # uncomment the line when this package is not in a git repo + #set(ament_cmake_cpplint_FOUND TRUE) + ament_lint_auto_find_test_dependencies() +endif() + +ament_package() \ No newline at end of file diff --git a/custom_msgs/geometry_msgs/msg/Vector3.msg b/custom_msgs/geometry_msgs/msg/Vector3.msg new file mode 100644 index 0000000..681257d --- /dev/null +++ b/custom_msgs/geometry_msgs/msg/Vector3.msg @@ -0,0 +1,3 @@ +float64 x +float64 y +float64 z \ No newline at end of file diff --git a/custom_msgs/geometry_msgs/package.xml b/custom_msgs/geometry_msgs/package.xml new file mode 100644 index 0000000..4ba5e75 --- /dev/null +++ b/custom_msgs/geometry_msgs/package.xml @@ -0,0 +1,23 @@ + + + + geometry_msgs + 0.0.0 + TODO: Package description + uden + TODO: License declaration + + ament_cmake + + rosidl_default_generators + rosidl_default_runtime + + rosidl_interface_packages + + ament_lint_auto + ament_lint_common + + + ament_cmake + + \ No newline at end of file diff --git a/custom_msgs/mix_msgs/msg/Mix.msg b/custom_msgs/mix_msgs/msg/Mix.msg index 1b8f5db..4e55741 100644 --- a/custom_msgs/mix_msgs/msg/Mix.msg +++ b/custom_msgs/mix_msgs/msg/Mix.msg @@ -1,4 +1,4 @@ string name uint16 height float32 weight -uint32[] array \ No newline at end of file +uint16[] array \ No newline at end of file diff --git a/mros2_echoback_vector3/CMakeLists.txt b/mros2_echoback_vector3/CMakeLists.txt new file mode 100644 index 0000000..fa1c53b --- /dev/null +++ b/mros2_echoback_vector3/CMakeLists.txt @@ -0,0 +1,62 @@ +cmake_minimum_required(VERSION 3.5) +project(mros2_echoback_vector3) + + +# Default to C99 +if(NOT CMAKE_C_STANDARD) + set(CMAKE_C_STANDARD 99) +endif() + +# Default to C++14 +if(NOT CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 14) +endif() + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +# find dependencies +find_package(ament_cmake REQUIRED) +find_package(rclcpp REQUIRED) +find_package(geometry_msgs REQUIRED) +# uncomment the following section in order to fill in +# further dependencies manually. +# find_package( REQUIRED) + +add_executable(pub_node src/pub_node.cpp) +ament_target_dependencies(pub_node rclcpp geometry_msgs) + +add_executable(sub_node src/sub_node.cpp) +ament_target_dependencies(sub_node rclcpp geometry_msgs) + +target_include_directories(pub_node PUBLIC + $ + $) + +target_include_directories(sub_node PUBLIC + $ + $) + +install(TARGETS pub_node + DESTINATION lib/${PROJECT_NAME}) +install(TARGETS sub_node + DESTINATION lib/${PROJECT_NAME}) + +install(DIRECTORY + launch + DESTINATION share/${PROJECT_NAME} +) + +if(BUILD_TESTING) + find_package(ament_lint_auto REQUIRED) + # the following line skips the linter which checks for copyrights + # uncomment the line when a copyright and license is not present in all source files + #set(ament_cmake_copyright_FOUND TRUE) + # the following line skips cpplint (only works in a git repo) + # uncomment the line when this package is not in a git repo + #set(ament_cmake_cpplint_FOUND TRUE) + ament_lint_auto_find_test_dependencies() +endif() + +ament_package() \ No newline at end of file diff --git a/mros2_echoback_vector3/launch/launch_pubsub.py b/mros2_echoback_vector3/launch/launch_pubsub.py new file mode 100644 index 0000000..8bbf203 --- /dev/null +++ b/mros2_echoback_vector3/launch/launch_pubsub.py @@ -0,0 +1,21 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +# Note: `node_`, `prefix` and `output` will be removed on Foxy +def generate_launch_description(): + return LaunchDescription([ + Node( + package='mros2_echoback_vector3', + node_executable='pub_node', + node_name='pub_mros2', + prefix=['stdbuf -o L'], + output="screen" + ), + Node( + package='mros2_echoback_vector3', + node_executable='sub_node', + node_name='mros2_sub', + prefix=['stdbuf -o L'], + output="screen" + ) + ]) \ No newline at end of file diff --git a/mros2_echoback_vector3/package.xml b/mros2_echoback_vector3/package.xml new file mode 100644 index 0000000..cb043c9 --- /dev/null +++ b/mros2_echoback_vector3/package.xml @@ -0,0 +1,21 @@ + + + + mros2_echoback_vector3 + 0.0.0 + TODO: Package description + uden + TODO: License declaration + + ament_cmake +rclcpp +geometry_msgs +rclcpp +geometry_msgs + ament_lint_auto + ament_lint_common + + + ament_cmake + + \ No newline at end of file diff --git a/mros2_echoback_vector3/src/pub_node.cpp b/mros2_echoback_vector3/src/pub_node.cpp new file mode 100644 index 0000000..a662f62 --- /dev/null +++ b/mros2_echoback_vector3/src/pub_node.cpp @@ -0,0 +1,45 @@ +#include +#include +#include +#include + +#include "rclcpp/rclcpp.hpp" +#include "geometry_msgs/msg/vector3.hpp" + +using namespace std::chrono_literals; + +/* This example creates a subclass of Node and uses std::bind() to register a +* member function as a callback from the timer. */ + +class Publisher : public rclcpp::Node +{ +public: + Publisher() + : Node("pub_mros2"), count_(0) + { + publisher_ = this->create_publisher("to_stm", 10); + timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); + } + +private: + void timer_callback() + { + auto message = geometry_msgs::msg::Vector3(); + message.x = count_++/10.0; + message.y = 2*count_++/10.0; + message.z = 3*count_++/10.0; + RCLCPP_INFO(this->get_logger(), "Publishing msg: { x: %f, y: %f, z: %f }", message.x,message.y, message.z); + publisher_->publish(message); + } + rclcpp::TimerBase::SharedPtr timer_; + rclcpp::Publisher::SharedPtr publisher_; + size_t count_; +}; + +int main(int argc, char *argv[]) +{ + rclcpp::init(argc, argv); + rclcpp::spin(std::make_shared()); + rclcpp::shutdown(); + return 0; +} \ No newline at end of file diff --git a/mros2_echoback_vector3/src/sub_node.cpp b/mros2_echoback_vector3/src/sub_node.cpp new file mode 100644 index 0000000..d40cf44 --- /dev/null +++ b/mros2_echoback_vector3/src/sub_node.cpp @@ -0,0 +1,34 @@ +#include +#include +#include +#include + +#include "rclcpp/rclcpp.hpp" +#include "geometry_msgs/msg/vector3.hpp" + +using std::placeholders::_1; + +class Subscriber : public rclcpp::Node +{ +public: + Subscriber() : Node("mros2_sub") + { + subscriber_ = this->create_subscription("to_linux", rclcpp::QoS(10).best_effort(), std::bind(&Subscriber::topic_callback, this, _1)); + } + +private: + void topic_callback(const geometry_msgs::msg::Vector3::SharedPtr message) const + { + RCLCPP_INFO(this->get_logger(), "Subscribed msg: { x: %f, y: %f, z: %f }", message->x,message->y, message->z); + } + rclcpp::Subscription::SharedPtr subscriber_; +}; + + +int main(int argc, char *argv[]) +{ + rclcpp::init(argc, argv); + rclcpp::spin(std::make_shared()); + rclcpp::shutdown(); + return 0; +} \ No newline at end of file From 291d814e736a044862b034281eabf2343ea4caea Mon Sep 17 00:00:00 2001 From: MEIP-users Date: Thu, 23 Dec 2021 13:55:24 +0900 Subject: [PATCH 40/56] twist app worked --- custom_msgs/geometry_msgs/CMakeLists.txt | 1 + custom_msgs/geometry_msgs/msg/Twist.msg | 2 + mros2_echoback_twist/CMakeLists.txt | 62 ++++++++++++++++++++ mros2_echoback_twist/launch/launch_pubsub.py | 21 +++++++ mros2_echoback_twist/package.xml | 21 +++++++ mros2_echoback_twist/src/pub_node.cpp | 48 +++++++++++++++ mros2_echoback_twist/src/sub_node.cpp | 34 +++++++++++ 7 files changed, 189 insertions(+) create mode 100644 custom_msgs/geometry_msgs/msg/Twist.msg create mode 100644 mros2_echoback_twist/CMakeLists.txt create mode 100644 mros2_echoback_twist/launch/launch_pubsub.py create mode 100644 mros2_echoback_twist/package.xml create mode 100644 mros2_echoback_twist/src/pub_node.cpp create mode 100644 mros2_echoback_twist/src/sub_node.cpp diff --git a/custom_msgs/geometry_msgs/CMakeLists.txt b/custom_msgs/geometry_msgs/CMakeLists.txt index 351ceb2..b19822e 100644 --- a/custom_msgs/geometry_msgs/CMakeLists.txt +++ b/custom_msgs/geometry_msgs/CMakeLists.txt @@ -21,6 +21,7 @@ find_package(rosidl_default_generators REQUIRED) rosidl_generate_interfaces(${PROJECT_NAME} "msg/Vector3.msg" + "msg/Twist.msg" ) if(BUILD_TESTING) diff --git a/custom_msgs/geometry_msgs/msg/Twist.msg b/custom_msgs/geometry_msgs/msg/Twist.msg new file mode 100644 index 0000000..4cdb251 --- /dev/null +++ b/custom_msgs/geometry_msgs/msg/Twist.msg @@ -0,0 +1,2 @@ +Vector3 linear +Vector3 angular \ No newline at end of file diff --git a/mros2_echoback_twist/CMakeLists.txt b/mros2_echoback_twist/CMakeLists.txt new file mode 100644 index 0000000..ad7f64e --- /dev/null +++ b/mros2_echoback_twist/CMakeLists.txt @@ -0,0 +1,62 @@ +cmake_minimum_required(VERSION 3.5) +project(mros2_echoback_twist) + + +# Default to C99 +if(NOT CMAKE_C_STANDARD) + set(CMAKE_C_STANDARD 99) +endif() + +# Default to C++14 +if(NOT CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 14) +endif() + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +# find dependencies +find_package(ament_cmake REQUIRED) +find_package(rclcpp REQUIRED) +find_package(geometry_msgs REQUIRED) +# uncomment the following section in order to fill in +# further dependencies manually. +# find_package( REQUIRED) + +add_executable(pub_node src/pub_node.cpp) +ament_target_dependencies(pub_node rclcpp geometry_msgs) + +add_executable(sub_node src/sub_node.cpp) +ament_target_dependencies(sub_node rclcpp geometry_msgs) + +target_include_directories(pub_node PUBLIC + $ + $) + +target_include_directories(sub_node PUBLIC + $ + $) + +install(TARGETS pub_node + DESTINATION lib/${PROJECT_NAME}) +install(TARGETS sub_node + DESTINATION lib/${PROJECT_NAME}) + +install(DIRECTORY + launch + DESTINATION share/${PROJECT_NAME} +) + +if(BUILD_TESTING) + find_package(ament_lint_auto REQUIRED) + # the following line skips the linter which checks for copyrights + # uncomment the line when a copyright and license is not present in all source files + #set(ament_cmake_copyright_FOUND TRUE) + # the following line skips cpplint (only works in a git repo) + # uncomment the line when this package is not in a git repo + #set(ament_cmake_cpplint_FOUND TRUE) + ament_lint_auto_find_test_dependencies() +endif() + +ament_package() \ No newline at end of file diff --git a/mros2_echoback_twist/launch/launch_pubsub.py b/mros2_echoback_twist/launch/launch_pubsub.py new file mode 100644 index 0000000..2198bd1 --- /dev/null +++ b/mros2_echoback_twist/launch/launch_pubsub.py @@ -0,0 +1,21 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +# Note: `node_`, `prefix` and `output` will be removed on Foxy +def generate_launch_description(): + return LaunchDescription([ + Node( + package='mros2_echoback_twist', + node_executable='pub_node', + node_name='pub_mros2', + prefix=['stdbuf -o L'], + output="screen" + ), + Node( + package='mros2_echoback_twist', + node_executable='sub_node', + node_name='mros2_sub', + prefix=['stdbuf -o L'], + output="screen" + ) + ]) \ No newline at end of file diff --git a/mros2_echoback_twist/package.xml b/mros2_echoback_twist/package.xml new file mode 100644 index 0000000..3b17b12 --- /dev/null +++ b/mros2_echoback_twist/package.xml @@ -0,0 +1,21 @@ + + + + mros2_echoback_twist + 0.0.0 + TODO: Package description + uden + TODO: License declaration + + ament_cmake +rclcpp +geometry_msgs +rclcpp +geometry_msgs + ament_lint_auto + ament_lint_common + + + ament_cmake + + \ No newline at end of file diff --git a/mros2_echoback_twist/src/pub_node.cpp b/mros2_echoback_twist/src/pub_node.cpp new file mode 100644 index 0000000..22f678b --- /dev/null +++ b/mros2_echoback_twist/src/pub_node.cpp @@ -0,0 +1,48 @@ +#include +#include +#include +#include + +#include "rclcpp/rclcpp.hpp" +#include "geometry_msgs/msg/twist.hpp" + +using namespace std::chrono_literals; + +/* This example creates a subclass of Node and uses std::bind() to register a +* member function as a callback from the timer. */ + +class Publisher : public rclcpp::Node +{ +public: + Publisher() + : Node("pub_mros2"), count_(0) + { + publisher_ = this->create_publisher("to_stm", 10); + timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); + } + +private: + void timer_callback() + { + auto message = geometry_msgs::msg::Twist(); + message.linear.x = count_++/10.0; + message.linear.y = count_++/10.0; + message.linear.z = count_++/10.0; + message.angular.x = count_++/50.0; + message.angular.y = count_++/50.0; + message.angular.z = count_++/50.0; + RCLCPP_INFO(this->get_logger(), "Publishing msg: { linear: { x: %f, y: %f, z: %f }, angular: { x: %f, y: %f, z: %f } }", message.linear.x, message.linear.y, message.linear.z, message.angular.x, message.angular.y, message.angular.z); + publisher_->publish(message); + } + rclcpp::TimerBase::SharedPtr timer_; + rclcpp::Publisher::SharedPtr publisher_; + size_t count_; +}; + +int main(int argc, char *argv[]) +{ + rclcpp::init(argc, argv); + rclcpp::spin(std::make_shared()); + rclcpp::shutdown(); + return 0; +} \ No newline at end of file diff --git a/mros2_echoback_twist/src/sub_node.cpp b/mros2_echoback_twist/src/sub_node.cpp new file mode 100644 index 0000000..ff7f060 --- /dev/null +++ b/mros2_echoback_twist/src/sub_node.cpp @@ -0,0 +1,34 @@ +#include +#include +#include +#include + +#include "rclcpp/rclcpp.hpp" +#include "geometry_msgs/msg/twist.hpp" + +using std::placeholders::_1; + +class Subscriber : public rclcpp::Node +{ +public: + Subscriber() : Node("mros2_sub") + { + subscriber_ = this->create_subscription("to_linux", rclcpp::QoS(10).best_effort(), std::bind(&Subscriber::topic_callback, this, _1)); + } + +private: + void topic_callback(const geometry_msgs::msg::Twist::SharedPtr message) const + { + RCLCPP_INFO(this->get_logger(), "Subscribed msg: { linear: { x: %f, y: %f, z: %f }, angular: { x: %f, y: %f, z: %f } }", message->linear.x, message->linear.y, message->linear.z, message->angular.x, message->angular.y, message->angular.z); + } + rclcpp::Subscription::SharedPtr subscriber_; +}; + + +int main(int argc, char *argv[]) +{ + rclcpp::init(argc, argv); + rclcpp::spin(std::make_shared()); + rclcpp::shutdown(); + return 0; +} \ No newline at end of file From bcc03be50d45fafb11846343d591d3a1b17db20d Mon Sep 17 00:00:00 2001 From: MEIP-users Date: Wed, 29 Dec 2021 01:26:55 +0900 Subject: [PATCH 41/56] clean repogitry & odometry app added --- custom_msgs/geometry_msgs/CMakeLists.txt | 38 ----------- custom_msgs/geometry_msgs/msg/Twist.msg | 2 - custom_msgs/geometry_msgs/msg/Vector3.msg | 3 - custom_msgs/geometry_msgs/package.xml | 23 ------- custom_msgs/location_msgs/CMakeLists.txt | 37 ----------- custom_msgs/location_msgs/msg/Location.msg | 3 - custom_msgs/location_msgs/package.xml | 23 ------- mros2_echoback_location/CMakeLists.txt | 62 ------------------ mros2_echoback_location/package.xml | 21 ------ mros2_echoback_location/src/pub_node.cpp | 45 ------------- mros2_echoback_location/src/sub_node.cpp | 34 ---------- .../CMakeLists.txt | 8 ++- .../launch/launch_pubsub.py | 4 +- .../package.xml | 6 +- mros2_echoback_odometry/src/pub_node.cpp | 64 +++++++++++++++++++ mros2_echoback_odometry/src/sub_node.cpp | 34 ++++++++++ .../launch/launch_pubsub.py | 21 ------ mros2_echoback_vector3/src/pub_node.cpp | 45 ------------- mros2_echoback_vector3/src/sub_node.cpp | 34 ---------- 19 files changed, 110 insertions(+), 397 deletions(-) delete mode 100644 custom_msgs/geometry_msgs/CMakeLists.txt delete mode 100644 custom_msgs/geometry_msgs/msg/Twist.msg delete mode 100644 custom_msgs/geometry_msgs/msg/Vector3.msg delete mode 100644 custom_msgs/geometry_msgs/package.xml delete mode 100644 custom_msgs/location_msgs/CMakeLists.txt delete mode 100644 custom_msgs/location_msgs/msg/Location.msg delete mode 100644 custom_msgs/location_msgs/package.xml delete mode 100644 mros2_echoback_location/CMakeLists.txt delete mode 100644 mros2_echoback_location/package.xml delete mode 100644 mros2_echoback_location/src/pub_node.cpp delete mode 100644 mros2_echoback_location/src/sub_node.cpp rename {mros2_echoback_vector3 => mros2_echoback_odometry}/CMakeLists.txt (86%) rename {mros2_echoback_location => mros2_echoback_odometry}/launch/launch_pubsub.py (84%) rename {mros2_echoback_vector3 => mros2_echoback_odometry}/package.xml (79%) create mode 100644 mros2_echoback_odometry/src/pub_node.cpp create mode 100644 mros2_echoback_odometry/src/sub_node.cpp delete mode 100644 mros2_echoback_vector3/launch/launch_pubsub.py delete mode 100644 mros2_echoback_vector3/src/pub_node.cpp delete mode 100644 mros2_echoback_vector3/src/sub_node.cpp diff --git a/custom_msgs/geometry_msgs/CMakeLists.txt b/custom_msgs/geometry_msgs/CMakeLists.txt deleted file mode 100644 index b19822e..0000000 --- a/custom_msgs/geometry_msgs/CMakeLists.txt +++ /dev/null @@ -1,38 +0,0 @@ -cmake_minimum_required(VERSION 3.5) -project(geometry_msgs) - -# Default to C99 -if(NOT CMAKE_C_STANDARD) - set(CMAKE_C_STANDARD 99) -endif() - -# Default to C++14 -if(NOT CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 14) -endif() - -if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_compile_options(-Wall -Wextra -Wpedantic) -endif() - -# find dependencies -find_package(ament_cmake REQUIRED) -find_package(rosidl_default_generators REQUIRED) - -rosidl_generate_interfaces(${PROJECT_NAME} - "msg/Vector3.msg" - "msg/Twist.msg" -) - -if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - # the following line skips the linter which checks for copyrights - # uncomment the line when a copyright and license is not present in all source files - #set(ament_cmake_copyright_FOUND TRUE) - # the following line skips cpplint (only works in a git repo) - # uncomment the line when this package is not in a git repo - #set(ament_cmake_cpplint_FOUND TRUE) - ament_lint_auto_find_test_dependencies() -endif() - -ament_package() \ No newline at end of file diff --git a/custom_msgs/geometry_msgs/msg/Twist.msg b/custom_msgs/geometry_msgs/msg/Twist.msg deleted file mode 100644 index 4cdb251..0000000 --- a/custom_msgs/geometry_msgs/msg/Twist.msg +++ /dev/null @@ -1,2 +0,0 @@ -Vector3 linear -Vector3 angular \ No newline at end of file diff --git a/custom_msgs/geometry_msgs/msg/Vector3.msg b/custom_msgs/geometry_msgs/msg/Vector3.msg deleted file mode 100644 index 681257d..0000000 --- a/custom_msgs/geometry_msgs/msg/Vector3.msg +++ /dev/null @@ -1,3 +0,0 @@ -float64 x -float64 y -float64 z \ No newline at end of file diff --git a/custom_msgs/geometry_msgs/package.xml b/custom_msgs/geometry_msgs/package.xml deleted file mode 100644 index 4ba5e75..0000000 --- a/custom_msgs/geometry_msgs/package.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - geometry_msgs - 0.0.0 - TODO: Package description - uden - TODO: License declaration - - ament_cmake - - rosidl_default_generators - rosidl_default_runtime - - rosidl_interface_packages - - ament_lint_auto - ament_lint_common - - - ament_cmake - - \ No newline at end of file diff --git a/custom_msgs/location_msgs/CMakeLists.txt b/custom_msgs/location_msgs/CMakeLists.txt deleted file mode 100644 index e44afa9..0000000 --- a/custom_msgs/location_msgs/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -cmake_minimum_required(VERSION 3.5) -project(location_msgs) - -# Default to C99 -if(NOT CMAKE_C_STANDARD) - set(CMAKE_C_STANDARD 99) -endif() - -# Default to C++14 -if(NOT CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 14) -endif() - -if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_compile_options(-Wall -Wextra -Wpedantic) -endif() - -# find dependencies -find_package(ament_cmake REQUIRED) -find_package(rosidl_default_generators REQUIRED) - -rosidl_generate_interfaces(${PROJECT_NAME} - "msg/Location.msg" -) - -if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - # the following line skips the linter which checks for copyrights - # uncomment the line when a copyright and license is not present in all source files - #set(ament_cmake_copyright_FOUND TRUE) - # the following line skips cpplint (only works in a git repo) - # uncomment the line when this package is not in a git repo - #set(ament_cmake_cpplint_FOUND TRUE) - ament_lint_auto_find_test_dependencies() -endif() - -ament_package() \ No newline at end of file diff --git a/custom_msgs/location_msgs/msg/Location.msg b/custom_msgs/location_msgs/msg/Location.msg deleted file mode 100644 index e8b93b2..0000000 --- a/custom_msgs/location_msgs/msg/Location.msg +++ /dev/null @@ -1,3 +0,0 @@ -uint16 x -uint16 y -uint16 z \ No newline at end of file diff --git a/custom_msgs/location_msgs/package.xml b/custom_msgs/location_msgs/package.xml deleted file mode 100644 index f47623c..0000000 --- a/custom_msgs/location_msgs/package.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - location_msgs - 0.0.0 - TODO: Package description - uden - TODO: License declaration - - ament_cmake - - rosidl_default_generators - rosidl_default_runtime - - rosidl_interface_packages - - ament_lint_auto - ament_lint_common - - - ament_cmake - - \ No newline at end of file diff --git a/mros2_echoback_location/CMakeLists.txt b/mros2_echoback_location/CMakeLists.txt deleted file mode 100644 index 8c680b3..0000000 --- a/mros2_echoback_location/CMakeLists.txt +++ /dev/null @@ -1,62 +0,0 @@ -cmake_minimum_required(VERSION 3.5) -project(mros2_echoback_location) - - -# Default to C99 -if(NOT CMAKE_C_STANDARD) - set(CMAKE_C_STANDARD 99) -endif() - -# Default to C++14 -if(NOT CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 14) -endif() - -if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_compile_options(-Wall -Wextra -Wpedantic) -endif() - -# find dependencies -find_package(ament_cmake REQUIRED) -find_package(rclcpp REQUIRED) -find_package(location_msgs REQUIRED) -# uncomment the following section in order to fill in -# further dependencies manually. -# find_package( REQUIRED) - -add_executable(pub_node src/pub_node.cpp) -ament_target_dependencies(pub_node rclcpp location_msgs) - -add_executable(sub_node src/sub_node.cpp) -ament_target_dependencies(sub_node rclcpp location_msgs) - -target_include_directories(pub_node PUBLIC - $ - $) - -target_include_directories(sub_node PUBLIC - $ - $) - -install(TARGETS pub_node - DESTINATION lib/${PROJECT_NAME}) -install(TARGETS sub_node - DESTINATION lib/${PROJECT_NAME}) - -install(DIRECTORY - launch - DESTINATION share/${PROJECT_NAME} -) - -if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - # the following line skips the linter which checks for copyrights - # uncomment the line when a copyright and license is not present in all source files - #set(ament_cmake_copyright_FOUND TRUE) - # the following line skips cpplint (only works in a git repo) - # uncomment the line when this package is not in a git repo - #set(ament_cmake_cpplint_FOUND TRUE) - ament_lint_auto_find_test_dependencies() -endif() - -ament_package() \ No newline at end of file diff --git a/mros2_echoback_location/package.xml b/mros2_echoback_location/package.xml deleted file mode 100644 index 76a41bf..0000000 --- a/mros2_echoback_location/package.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - mros2_echoback_location - 0.0.0 - TODO: Package description - uden - TODO: License declaration - - ament_cmake -rclcpp -location_msgs -rclcpp -location_msgs - ament_lint_auto - ament_lint_common - - - ament_cmake - - \ No newline at end of file diff --git a/mros2_echoback_location/src/pub_node.cpp b/mros2_echoback_location/src/pub_node.cpp deleted file mode 100644 index 6e6e2fe..0000000 --- a/mros2_echoback_location/src/pub_node.cpp +++ /dev/null @@ -1,45 +0,0 @@ -#include -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "location_msgs/msg/location.hpp" - -using namespace std::chrono_literals; - -/* This example creates a subclass of Node and uses std::bind() to register a -* member function as a callback from the timer. */ - -class Publisher : public rclcpp::Node -{ -public: - Publisher() - : Node("pub_mros2"), count_(0) - { - publisher_ = this->create_publisher("to_stm", 10); - timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); - } - -private: - void timer_callback() - { - auto message = location_msgs::msg::Location(); - message.x = count_++; - message.y = 2*count_++; - message.z = 3*count_++; - RCLCPP_INFO(this->get_logger(), "Publishing msg: { x: %u, y: %u, z: %u }", message.x,message.y, message.z); - publisher_->publish(message); - } - rclcpp::TimerBase::SharedPtr timer_; - rclcpp::Publisher::SharedPtr publisher_; - size_t count_; -}; - -int main(int argc, char *argv[]) -{ - rclcpp::init(argc, argv); - rclcpp::spin(std::make_shared()); - rclcpp::shutdown(); - return 0; -} \ No newline at end of file diff --git a/mros2_echoback_location/src/sub_node.cpp b/mros2_echoback_location/src/sub_node.cpp deleted file mode 100644 index 010d1c4..0000000 --- a/mros2_echoback_location/src/sub_node.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "location_msgs/msg/location.hpp" - -using std::placeholders::_1; - -class Subscriber : public rclcpp::Node -{ -public: - Subscriber() : Node("mros2_sub") - { - subscriber_ = this->create_subscription("to_linux", rclcpp::QoS(10).best_effort(), std::bind(&Subscriber::topic_callback, this, _1)); - } - -private: - void topic_callback(const location_msgs::msg::Location::SharedPtr message) const - { - RCLCPP_INFO(this->get_logger(), "Subscribed msg: { x: %u, y: %u, z: %u }", message->x,message->y, message->z); - } - rclcpp::Subscription::SharedPtr subscriber_; -}; - - -int main(int argc, char *argv[]) -{ - rclcpp::init(argc, argv); - rclcpp::spin(std::make_shared()); - rclcpp::shutdown(); - return 0; -} \ No newline at end of file diff --git a/mros2_echoback_vector3/CMakeLists.txt b/mros2_echoback_odometry/CMakeLists.txt similarity index 86% rename from mros2_echoback_vector3/CMakeLists.txt rename to mros2_echoback_odometry/CMakeLists.txt index fa1c53b..695e8af 100644 --- a/mros2_echoback_vector3/CMakeLists.txt +++ b/mros2_echoback_odometry/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.5) -project(mros2_echoback_vector3) +project(mros2_echoback_odometry) # Default to C99 @@ -19,16 +19,18 @@ endif() # find dependencies find_package(ament_cmake REQUIRED) find_package(rclcpp REQUIRED) +find_package(std_msgs REQUIRED) find_package(geometry_msgs REQUIRED) +find_package(nav_msgs REQUIRED) # uncomment the following section in order to fill in # further dependencies manually. # find_package( REQUIRED) add_executable(pub_node src/pub_node.cpp) -ament_target_dependencies(pub_node rclcpp geometry_msgs) +ament_target_dependencies(pub_node rclcpp std_msgs geometry_msgs nav_msgs) add_executable(sub_node src/sub_node.cpp) -ament_target_dependencies(sub_node rclcpp geometry_msgs) +ament_target_dependencies(sub_node rclcpp std_msgs geometry_msgs nav_msgs) target_include_directories(pub_node PUBLIC $ diff --git a/mros2_echoback_location/launch/launch_pubsub.py b/mros2_echoback_odometry/launch/launch_pubsub.py similarity index 84% rename from mros2_echoback_location/launch/launch_pubsub.py rename to mros2_echoback_odometry/launch/launch_pubsub.py index 537c2d9..d3c4e9e 100644 --- a/mros2_echoback_location/launch/launch_pubsub.py +++ b/mros2_echoback_odometry/launch/launch_pubsub.py @@ -5,14 +5,14 @@ def generate_launch_description(): return LaunchDescription([ Node( - package='mros2_echoback_location', + package='mros2_echoback_odometry', node_executable='pub_node', node_name='pub_mros2', prefix=['stdbuf -o L'], output="screen" ), Node( - package='mros2_echoback_location', + package='mros2_echoback_odometry', node_executable='sub_node', node_name='mros2_sub', prefix=['stdbuf -o L'], diff --git a/mros2_echoback_vector3/package.xml b/mros2_echoback_odometry/package.xml similarity index 79% rename from mros2_echoback_vector3/package.xml rename to mros2_echoback_odometry/package.xml index cb043c9..c78c927 100644 --- a/mros2_echoback_vector3/package.xml +++ b/mros2_echoback_odometry/package.xml @@ -1,7 +1,7 @@ - mros2_echoback_vector3 + mros2_echoback_odometry 0.0.0 TODO: Package description uden @@ -9,9 +9,13 @@ ament_cmake rclcpp +std_msgs geometry_msgs +nav_msgs rclcpp +std_msgs geometry_msgs +nav_msgs ament_lint_auto ament_lint_common diff --git a/mros2_echoback_odometry/src/pub_node.cpp b/mros2_echoback_odometry/src/pub_node.cpp new file mode 100644 index 0000000..355aa0a --- /dev/null +++ b/mros2_echoback_odometry/src/pub_node.cpp @@ -0,0 +1,64 @@ +#include +#include +#include +#include + +#include "rclcpp/rclcpp.hpp" +#include "nav_msgs/msg/odometry.hpp" + +using namespace std::chrono_literals; + +/* This example creates a subclass of Node and uses std::bind() to register a +* member function as a callback from the timer. */ + +class Publisher : public rclcpp::Node +{ +public: + Publisher() + : Node("pub_mros2"), count_(0) + { + publisher_ = this->create_publisher("to_stm", 10); + timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); + } + +private: + void timer_callback() + { + auto message = nav_msgs::msg::Odometry(); + message.header.stamp = this->get_clock()->now(); + for (int i=0;i<36;i++){ + message.pose.covariance[i]=(i/100.0); + } + message.pose.pose.position.x=count_++/10.0; + message.pose.pose.position.y=count_++/10.0; + message.pose.pose.position.z=count_++/10.0; + message.pose.pose.orientation.x=count_++/20.0; + message.pose.pose.orientation.y=count_++/20.0; + message.pose.pose.orientation.z=count_++/20.0; + message.pose.pose.orientation.w=count_++/20.0; + + for (int i=0;i<36;i++){ + message.twist.covariance[i]=(i/100.0); + } + message.twist.twist.linear.x = count_++/50.0; + message.twist.twist.linear.y = count_++/50.0; + message.twist.twist.linear.z = count_++/50.0; + message.twist.twist.angular.x = count_++/100.0; + message.twist.twist.angular.y = count_++/100.0; + message.twist.twist.angular.z = count_++/100.0; + + RCLCPP_INFO(this->get_logger(), "Publishing msg: { sec:%d, nanosec:%u, frame_id:%s, child_frame_id:%s, pos_x:%f, ori_x:%f, pos_cov:%f, lin:%f, ang:%f, twi_cov:%f }", message.header.stamp.sec, message.header.stamp.nanosec, message.header.frame_id, message.child_frame_id, message.pose.pose.position.x, message.pose.pose.orientation.x, message.pose.covariance[18], message.twist.twist.linear.x, message.twist.twist.angular.x, message.twist.covariance[18] ); + publisher_->publish(message); + } + rclcpp::TimerBase::SharedPtr timer_; + rclcpp::Publisher::SharedPtr publisher_; + size_t count_; +}; + +int main(int argc, char *argv[]) +{ + rclcpp::init(argc, argv); + rclcpp::spin(std::make_shared()); + rclcpp::shutdown(); + return 0; +} \ No newline at end of file diff --git a/mros2_echoback_odometry/src/sub_node.cpp b/mros2_echoback_odometry/src/sub_node.cpp new file mode 100644 index 0000000..6464ad8 --- /dev/null +++ b/mros2_echoback_odometry/src/sub_node.cpp @@ -0,0 +1,34 @@ +#include +#include +#include +#include + +#include "rclcpp/rclcpp.hpp" +#include "nav_msgs/msg/odometry.hpp" + +using std::placeholders::_1; + +class Subscriber : public rclcpp::Node +{ +public: + Subscriber() : Node("mros2_sub") + { + subscriber_ = this->create_subscription("to_linux", rclcpp::QoS(10).best_effort(), std::bind(&Subscriber::topic_callback, this, _1)); + } + +private: + void topic_callback(const nav_msgs::msg::Odometry::SharedPtr message) const + { + RCLCPP_INFO(this->get_logger(), "Subscribed msg: { sec:%d, nanosec:%u, frame_id:%s, child_frame_id:%s, pos_x:%f, ori_x:%f, pos_cov:%f, lin:%f, ang:%f, twi_cov:%f }", message->header.stamp.sec, message->header.stamp.nanosec, message->header.frame_id, message->child_frame_id, message->pose.pose.position.x, message->pose.pose.orientation.x, message->pose.covariance[18], message->twist.twist.linear.x, message->twist.twist.angular.x, message->twist.covariance[18] ); + } + rclcpp::Subscription::SharedPtr subscriber_; +}; + + +int main(int argc, char *argv[]) +{ + rclcpp::init(argc, argv); + rclcpp::spin(std::make_shared()); + rclcpp::shutdown(); + return 0; +} \ No newline at end of file diff --git a/mros2_echoback_vector3/launch/launch_pubsub.py b/mros2_echoback_vector3/launch/launch_pubsub.py deleted file mode 100644 index 8bbf203..0000000 --- a/mros2_echoback_vector3/launch/launch_pubsub.py +++ /dev/null @@ -1,21 +0,0 @@ -from launch import LaunchDescription -from launch_ros.actions import Node - -# Note: `node_`, `prefix` and `output` will be removed on Foxy -def generate_launch_description(): - return LaunchDescription([ - Node( - package='mros2_echoback_vector3', - node_executable='pub_node', - node_name='pub_mros2', - prefix=['stdbuf -o L'], - output="screen" - ), - Node( - package='mros2_echoback_vector3', - node_executable='sub_node', - node_name='mros2_sub', - prefix=['stdbuf -o L'], - output="screen" - ) - ]) \ No newline at end of file diff --git a/mros2_echoback_vector3/src/pub_node.cpp b/mros2_echoback_vector3/src/pub_node.cpp deleted file mode 100644 index a662f62..0000000 --- a/mros2_echoback_vector3/src/pub_node.cpp +++ /dev/null @@ -1,45 +0,0 @@ -#include -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "geometry_msgs/msg/vector3.hpp" - -using namespace std::chrono_literals; - -/* This example creates a subclass of Node and uses std::bind() to register a -* member function as a callback from the timer. */ - -class Publisher : public rclcpp::Node -{ -public: - Publisher() - : Node("pub_mros2"), count_(0) - { - publisher_ = this->create_publisher("to_stm", 10); - timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); - } - -private: - void timer_callback() - { - auto message = geometry_msgs::msg::Vector3(); - message.x = count_++/10.0; - message.y = 2*count_++/10.0; - message.z = 3*count_++/10.0; - RCLCPP_INFO(this->get_logger(), "Publishing msg: { x: %f, y: %f, z: %f }", message.x,message.y, message.z); - publisher_->publish(message); - } - rclcpp::TimerBase::SharedPtr timer_; - rclcpp::Publisher::SharedPtr publisher_; - size_t count_; -}; - -int main(int argc, char *argv[]) -{ - rclcpp::init(argc, argv); - rclcpp::spin(std::make_shared()); - rclcpp::shutdown(); - return 0; -} \ No newline at end of file diff --git a/mros2_echoback_vector3/src/sub_node.cpp b/mros2_echoback_vector3/src/sub_node.cpp deleted file mode 100644 index d40cf44..0000000 --- a/mros2_echoback_vector3/src/sub_node.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "geometry_msgs/msg/vector3.hpp" - -using std::placeholders::_1; - -class Subscriber : public rclcpp::Node -{ -public: - Subscriber() : Node("mros2_sub") - { - subscriber_ = this->create_subscription("to_linux", rclcpp::QoS(10).best_effort(), std::bind(&Subscriber::topic_callback, this, _1)); - } - -private: - void topic_callback(const geometry_msgs::msg::Vector3::SharedPtr message) const - { - RCLCPP_INFO(this->get_logger(), "Subscribed msg: { x: %f, y: %f, z: %f }", message->x,message->y, message->z); - } - rclcpp::Subscription::SharedPtr subscriber_; -}; - - -int main(int argc, char *argv[]) -{ - rclcpp::init(argc, argv); - rclcpp::spin(std::make_shared()); - rclcpp::shutdown(); - return 0; -} \ No newline at end of file From acb2531eca491d26e1d475513e3e47b2385c23ff Mon Sep 17 00:00:00 2001 From: MEIP-users Date: Fri, 31 Dec 2021 00:55:31 +0900 Subject: [PATCH 42/56] header type test app added and modified some apps --- custom_msgs/mix_msgs/CMakeLists.txt | 1 + custom_msgs/mix_msgs/msg/IntVector3.msg | 4 ++ custom_msgs/mix_msgs/msg/Mix.msg | 3 +- mros2_echoback_header/CMakeLists.txt | 62 +++++++++++++++++++ mros2_echoback_header/launch/launch_pubsub.py | 21 +++++++ mros2_echoback_header/package.xml | 21 +++++++ mros2_echoback_header/src/pub_node.cpp | 44 +++++++++++++ mros2_echoback_header/src/sub_node.cpp | 34 ++++++++++ mros2_echoback_mix/src/pub_node.cpp | 11 ++-- mros2_echoback_mix/src/sub_node.cpp | 2 +- mros2_echoback_odometry/src/pub_node.cpp | 4 +- mros2_echoback_odometry/src/sub_node.cpp | 2 +- 12 files changed, 201 insertions(+), 8 deletions(-) create mode 100644 custom_msgs/mix_msgs/msg/IntVector3.msg create mode 100644 mros2_echoback_header/CMakeLists.txt create mode 100644 mros2_echoback_header/launch/launch_pubsub.py create mode 100644 mros2_echoback_header/package.xml create mode 100644 mros2_echoback_header/src/pub_node.cpp create mode 100644 mros2_echoback_header/src/sub_node.cpp diff --git a/custom_msgs/mix_msgs/CMakeLists.txt b/custom_msgs/mix_msgs/CMakeLists.txt index d3d4416..4d512f1 100644 --- a/custom_msgs/mix_msgs/CMakeLists.txt +++ b/custom_msgs/mix_msgs/CMakeLists.txt @@ -20,6 +20,7 @@ find_package(ament_cmake REQUIRED) find_package(rosidl_default_generators REQUIRED) rosidl_generate_interfaces(${PROJECT_NAME} + "msg/IntVector3.msg" "msg/Mix.msg" ) diff --git a/custom_msgs/mix_msgs/msg/IntVector3.msg b/custom_msgs/mix_msgs/msg/IntVector3.msg new file mode 100644 index 0000000..ff026c9 --- /dev/null +++ b/custom_msgs/mix_msgs/msg/IntVector3.msg @@ -0,0 +1,4 @@ +uint16 x +uint16 y +uint16 z + diff --git a/custom_msgs/mix_msgs/msg/Mix.msg b/custom_msgs/mix_msgs/msg/Mix.msg index 4e55741..b5bc382 100644 --- a/custom_msgs/mix_msgs/msg/Mix.msg +++ b/custom_msgs/mix_msgs/msg/Mix.msg @@ -1,4 +1,5 @@ string name +IntVector3 vec3 uint16 height float32 weight -uint16[] array \ No newline at end of file +float64[] array \ No newline at end of file diff --git a/mros2_echoback_header/CMakeLists.txt b/mros2_echoback_header/CMakeLists.txt new file mode 100644 index 0000000..d139de9 --- /dev/null +++ b/mros2_echoback_header/CMakeLists.txt @@ -0,0 +1,62 @@ +cmake_minimum_required(VERSION 3.5) +project(mros2_echoback_header) + + +# Default to C99 +if(NOT CMAKE_C_STANDARD) + set(CMAKE_C_STANDARD 99) +endif() + +# Default to C++14 +if(NOT CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 14) +endif() + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +# find dependencies +find_package(ament_cmake REQUIRED) +find_package(rclcpp REQUIRED) +find_package(std_msgs REQUIRED) +# uncomment the following section in order to fill in +# further dependencies manually. +# find_package( REQUIRED) + +add_executable(pub_node src/pub_node.cpp) +ament_target_dependencies(pub_node rclcpp std_msgs) + +add_executable(sub_node src/sub_node.cpp) +ament_target_dependencies(sub_node rclcpp std_msgs) + +target_include_directories(pub_node PUBLIC + $ + $) + +target_include_directories(sub_node PUBLIC + $ + $) + +install(TARGETS pub_node + DESTINATION lib/${PROJECT_NAME}) +install(TARGETS sub_node + DESTINATION lib/${PROJECT_NAME}) + +install(DIRECTORY + launch + DESTINATION share/${PROJECT_NAME} +) + +if(BUILD_TESTING) + find_package(ament_lint_auto REQUIRED) + # the following line skips the linter which checks for copyrights + # uncomment the line when a copyright and license is not present in all source files + #set(ament_cmake_copyright_FOUND TRUE) + # the following line skips cpplint (only works in a git repo) + # uncomment the line when this package is not in a git repo + #set(ament_cmake_cpplint_FOUND TRUE) + ament_lint_auto_find_test_dependencies() +endif() + +ament_package() diff --git a/mros2_echoback_header/launch/launch_pubsub.py b/mros2_echoback_header/launch/launch_pubsub.py new file mode 100644 index 0000000..9f79f12 --- /dev/null +++ b/mros2_echoback_header/launch/launch_pubsub.py @@ -0,0 +1,21 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +# Note: `node_`, `prefix` and `output` will be removed on Foxy +def generate_launch_description(): + return LaunchDescription([ + Node( + package='mros2_echoback_header', + node_executable='pub_node', + node_name='pub_mros2', + prefix=['stdbuf -o L'], + output="screen" + ), + Node( + package='mros2_echoback_header', + node_executable='sub_node', + node_name='mros2_sub', + prefix=['stdbuf -o L'], + output="screen" + ) + ]) diff --git a/mros2_echoback_header/package.xml b/mros2_echoback_header/package.xml new file mode 100644 index 0000000..d25a846 --- /dev/null +++ b/mros2_echoback_header/package.xml @@ -0,0 +1,21 @@ + + + + mros2_echoback_header + 0.0.0 + TODO: Package description + uden + TODO: License declaration + + ament_cmake +rclcpp +std_msgs +rclcpp +std_msgs + ament_lint_auto + ament_lint_common + + + ament_cmake + + diff --git a/mros2_echoback_header/src/pub_node.cpp b/mros2_echoback_header/src/pub_node.cpp new file mode 100644 index 0000000..f1a3ec0 --- /dev/null +++ b/mros2_echoback_header/src/pub_node.cpp @@ -0,0 +1,44 @@ +#include +#include +#include +#include + +#include "rclcpp/rclcpp.hpp" +#include "std_msgs/msg/header.hpp" + +using namespace std::chrono_literals; + +/* This example creates a subclass of Node and uses std::bind() to register a +* member function as a callback from the timer. */ + +class Publisher : public rclcpp::Node +{ +public: + Publisher() + : Node("pub_mros2"), count_(0) + { + publisher_ = this->create_publisher("to_stm", 10); + timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); + } + +private: + void timer_callback() + { + auto message = std_msgs::msg::Header(); + message.frame_id = "Hello, world! " + std::to_string(count_++); + message.stamp = this->get_clock()->now(); + RCLCPP_INFO(this->get_logger(), "Publishing msg: { frame_id: '%s', sec: %d, nanosec: %u } ", message.frame_id.c_str(), message.stamp.sec, message.stamp.nanosec ); + publisher_->publish(message); + } + rclcpp::TimerBase::SharedPtr timer_; + rclcpp::Publisher::SharedPtr publisher_; + size_t count_; +}; + +int main(int argc, char * argv[]) +{ + rclcpp::init(argc, argv); + rclcpp::spin(std::make_shared()); + rclcpp::shutdown(); + return 0; +} diff --git a/mros2_echoback_header/src/sub_node.cpp b/mros2_echoback_header/src/sub_node.cpp new file mode 100644 index 0000000..a4f3044 --- /dev/null +++ b/mros2_echoback_header/src/sub_node.cpp @@ -0,0 +1,34 @@ +#include +#include +#include +#include + +#include "rclcpp/rclcpp.hpp" +#include "std_msgs/msg/header.hpp" + +using std::placeholders::_1; + +class Subscriber : public rclcpp::Node +{ +public: + Subscriber() : Node("mros2_sub") + { + subscriber_ = this->create_subscription("to_linux", rclcpp::QoS(10).best_effort(), std::bind(&Subscriber::topic_callback, this, _1)); + } + +private: + void topic_callback(const std_msgs::msg::Header::SharedPtr msg) const + { + RCLCPP_INFO(this->get_logger(), "Subscribed msg: { frame_id: '%s',sec: %d, nanosec: %u }", msg->frame_id.c_str(), msg->stamp.sec, msg->stamp.nanosec ); + } + rclcpp::Subscription::SharedPtr subscriber_; +}; + + +int main(int argc, char *argv[]) +{ + rclcpp::init(argc, argv); + rclcpp::spin(std::make_shared()); + rclcpp::shutdown(); + return 0; +} \ No newline at end of file diff --git a/mros2_echoback_mix/src/pub_node.cpp b/mros2_echoback_mix/src/pub_node.cpp index dbc0ccb..4a710cb 100644 --- a/mros2_echoback_mix/src/pub_node.cpp +++ b/mros2_echoback_mix/src/pub_node.cpp @@ -26,12 +26,15 @@ class Publisher : public rclcpp::Node { auto message = mix_msgs::msg::Mix(); message.name = std::to_string(count_++); + message.vec3.x = 1; + message.vec3.y = 1; + message.vec3.z = 1; message.height = 170; message.weight = 63.5; - message.array.push_back(count_); - message.array.push_back(count_+1); - message.array.push_back(count_+2); - RCLCPP_INFO(this->get_logger(), "Publishing msg: { name: '%s', height: %u cm, weight: %f kg, array: {%u,%u,%u} }", message.name.c_str(), message.height, message.weight, message.array[0], message.array[1], message.array[2]); + for (int i=0;i<8;i++){ + message.array.push_back(i/100.0); + } + RCLCPP_INFO(this->get_logger(), "Publishing msg: { name: '%s', x: %u, y: %u, z: %u,height: %u cm, weight: %f kg, array: {%f,%f,%f} }", message.name.c_str(), message.vec3.x, message.vec3.y, message.vec3.z, message.height, message.weight, message.array[0], message.array[1], message.array[2]); publisher_->publish(message); } rclcpp::TimerBase::SharedPtr timer_; diff --git a/mros2_echoback_mix/src/sub_node.cpp b/mros2_echoback_mix/src/sub_node.cpp index 7f9ee5c..ad12e29 100644 --- a/mros2_echoback_mix/src/sub_node.cpp +++ b/mros2_echoback_mix/src/sub_node.cpp @@ -19,7 +19,7 @@ class Subscriber : public rclcpp::Node private: void topic_callback(const mix_msgs::msg::Mix::SharedPtr message) const { - RCLCPP_INFO(this->get_logger(), "Subscribed msg: { name: '%s', height: %d cm, weight: %f kg, array: {%u,%u,%u} }", message->name.c_str(), message->height, message->weight, message->array[0], message->array[1], message->array[2]); + RCLCPP_INFO(this->get_logger(), "Subscribed msg: { name: '%s', x: %u, y: %u, z: %u, height: %d cm, weight: %f kg, array: {%f,%f,%f} }", message->name.c_str(), message->vec3.x, message->vec3.y, message->vec3.z, message->height, message->weight, message->array[0], message->array[1], message->array[2]); } rclcpp::Subscription::SharedPtr subscriber_; }; diff --git a/mros2_echoback_odometry/src/pub_node.cpp b/mros2_echoback_odometry/src/pub_node.cpp index 355aa0a..fb2287c 100644 --- a/mros2_echoback_odometry/src/pub_node.cpp +++ b/mros2_echoback_odometry/src/pub_node.cpp @@ -26,6 +26,8 @@ class Publisher : public rclcpp::Node { auto message = nav_msgs::msg::Odometry(); message.header.stamp = this->get_clock()->now(); + message.header.frame_id = "odometry"; + message.child_frame_id = "child_odometry"; for (int i=0;i<36;i++){ message.pose.covariance[i]=(i/100.0); } @@ -47,7 +49,7 @@ class Publisher : public rclcpp::Node message.twist.twist.angular.y = count_++/100.0; message.twist.twist.angular.z = count_++/100.0; - RCLCPP_INFO(this->get_logger(), "Publishing msg: { sec:%d, nanosec:%u, frame_id:%s, child_frame_id:%s, pos_x:%f, ori_x:%f, pos_cov:%f, lin:%f, ang:%f, twi_cov:%f }", message.header.stamp.sec, message.header.stamp.nanosec, message.header.frame_id, message.child_frame_id, message.pose.pose.position.x, message.pose.pose.orientation.x, message.pose.covariance[18], message.twist.twist.linear.x, message.twist.twist.angular.x, message.twist.covariance[18] ); + RCLCPP_INFO(this->get_logger(), "Publishing msg: { sec:%d, nanosec:%u, frame_id:%s, child_frame_id:%s, pos_x:%f, ori_x:%f, pos_cov:%f, lin:%f, ang:%f, twi_cov:%f }", message.header.stamp.sec, message.header.stamp.nanosec, message.header.frame_id.c_str(), message.child_frame_id.c_str(), message.pose.pose.position.x, message.pose.pose.orientation.x, message.pose.covariance[18], message.twist.twist.linear.x, message.twist.twist.angular.x, message.twist.covariance[18] ); publisher_->publish(message); } rclcpp::TimerBase::SharedPtr timer_; diff --git a/mros2_echoback_odometry/src/sub_node.cpp b/mros2_echoback_odometry/src/sub_node.cpp index 6464ad8..6c0d986 100644 --- a/mros2_echoback_odometry/src/sub_node.cpp +++ b/mros2_echoback_odometry/src/sub_node.cpp @@ -19,7 +19,7 @@ class Subscriber : public rclcpp::Node private: void topic_callback(const nav_msgs::msg::Odometry::SharedPtr message) const { - RCLCPP_INFO(this->get_logger(), "Subscribed msg: { sec:%d, nanosec:%u, frame_id:%s, child_frame_id:%s, pos_x:%f, ori_x:%f, pos_cov:%f, lin:%f, ang:%f, twi_cov:%f }", message->header.stamp.sec, message->header.stamp.nanosec, message->header.frame_id, message->child_frame_id, message->pose.pose.position.x, message->pose.pose.orientation.x, message->pose.covariance[18], message->twist.twist.linear.x, message->twist.twist.angular.x, message->twist.covariance[18] ); + RCLCPP_INFO(this->get_logger(), "Subscribed msg: { sec:%d, nanosec:%u, frame_id:%s, child_frame_id:%s, pos_x:%f, ori_x:%f, pos_cov:%f, lin:%f, ang:%f, twi_cov:%f }", message->header.stamp.sec, message->header.stamp.nanosec, message->header.frame_id.c_str(), message->child_frame_id.c_str(), message->pose.pose.position.x, message->pose.pose.orientation.x, message->pose.covariance[18], message->twist.twist.linear.x, message->twist.twist.angular.x, message->twist.covariance[18] ); } rclcpp::Subscription::SharedPtr subscriber_; }; From d6c0910460a709aaac254c362f59796ec8d0fa92 Mon Sep 17 00:00:00 2001 From: MEIP-users Date: Fri, 31 Dec 2021 01:21:41 +0900 Subject: [PATCH 43/56] joint_state app added --- mros2_echoback_joint_state/CMakeLists.txt | 63 +++++++++++++++++++ .../launch/launch_pubsub.py | 21 +++++++ mros2_echoback_joint_state/package.xml | 23 +++++++ mros2_echoback_joint_state/src/pub_node.cpp | 56 +++++++++++++++++ mros2_echoback_joint_state/src/sub_node.cpp | 34 ++++++++++ 5 files changed, 197 insertions(+) create mode 100644 mros2_echoback_joint_state/CMakeLists.txt create mode 100644 mros2_echoback_joint_state/launch/launch_pubsub.py create mode 100644 mros2_echoback_joint_state/package.xml create mode 100644 mros2_echoback_joint_state/src/pub_node.cpp create mode 100644 mros2_echoback_joint_state/src/sub_node.cpp diff --git a/mros2_echoback_joint_state/CMakeLists.txt b/mros2_echoback_joint_state/CMakeLists.txt new file mode 100644 index 0000000..7d625be --- /dev/null +++ b/mros2_echoback_joint_state/CMakeLists.txt @@ -0,0 +1,63 @@ +cmake_minimum_required(VERSION 3.5) +project(mros2_echoback_joint_state) + + +# Default to C99 +if(NOT CMAKE_C_STANDARD) + set(CMAKE_C_STANDARD 99) +endif() + +# Default to C++14 +if(NOT CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 14) +endif() + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +# find dependencies +find_package(ament_cmake REQUIRED) +find_package(rclcpp REQUIRED) +find_package(std_msgs REQUIRED) +find_package(sensor_msgs REQUIRED) +# uncomment the following section in order to fill in +# further dependencies manually. +# find_package( REQUIRED) + +add_executable(pub_node src/pub_node.cpp) +ament_target_dependencies(pub_node rclcpp std_msgs sensor_msgs) + +add_executable(sub_node src/sub_node.cpp) +ament_target_dependencies(sub_node rclcpp std_msgs sensor_msgs) + +target_include_directories(pub_node PUBLIC + $ + $) + +target_include_directories(sub_node PUBLIC + $ + $) + +install(TARGETS pub_node + DESTINATION lib/${PROJECT_NAME}) +install(TARGETS sub_node + DESTINATION lib/${PROJECT_NAME}) + +install(DIRECTORY + launch + DESTINATION share/${PROJECT_NAME} +) + +if(BUILD_TESTING) + find_package(ament_lint_auto REQUIRED) + # the following line skips the linter which checks for copyrights + # uncomment the line when a copyright and license is not present in all source files + #set(ament_cmake_copyright_FOUND TRUE) + # the following line skips cpplint (only works in a git repo) + # uncomment the line when this package is not in a git repo + #set(ament_cmake_cpplint_FOUND TRUE) + ament_lint_auto_find_test_dependencies() +endif() + +ament_package() \ No newline at end of file diff --git a/mros2_echoback_joint_state/launch/launch_pubsub.py b/mros2_echoback_joint_state/launch/launch_pubsub.py new file mode 100644 index 0000000..b098e67 --- /dev/null +++ b/mros2_echoback_joint_state/launch/launch_pubsub.py @@ -0,0 +1,21 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +# Note: `node_`, `prefix` and `output` will be removed on Foxy +def generate_launch_description(): + return LaunchDescription([ + Node( + package='mros2_echoback_joint_state', + node_executable='pub_node', + node_name='pub_mros2', + prefix=['stdbuf -o L'], + output="screen" + ), + Node( + package='mros2_echoback_joint_state', + node_executable='sub_node', + node_name='mros2_sub', + prefix=['stdbuf -o L'], + output="screen" + ) + ]) \ No newline at end of file diff --git a/mros2_echoback_joint_state/package.xml b/mros2_echoback_joint_state/package.xml new file mode 100644 index 0000000..438cde9 --- /dev/null +++ b/mros2_echoback_joint_state/package.xml @@ -0,0 +1,23 @@ + + + + mros2_echoback_joint_state + 0.0.0 + TODO: Package description + uden + TODO: License declaration + + ament_cmake +rclcpp +std_msgs +sensor_msgs +rclcpp +std_msgs +sensor_msgs + ament_lint_auto + ament_lint_common + + + ament_cmake + + \ No newline at end of file diff --git a/mros2_echoback_joint_state/src/pub_node.cpp b/mros2_echoback_joint_state/src/pub_node.cpp new file mode 100644 index 0000000..e4c0127 --- /dev/null +++ b/mros2_echoback_joint_state/src/pub_node.cpp @@ -0,0 +1,56 @@ +#include +#include +#include +#include + +#include "rclcpp/rclcpp.hpp" +#include "sensor_msgs/msg/joint_state.hpp" + +using namespace std::chrono_literals; + +/* This example creates a subclass of Node and uses std::bind() to register a +* member function as a callback from the timer. */ + +class Publisher : public rclcpp::Node +{ +public: + Publisher() + : Node("pub_mros2"), count_(0) + { + publisher_ = this->create_publisher("to_stm", 10); + timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); + } + +private: + void timer_callback() + { + auto message = sensor_msgs::msg::JointState(); + message.header.frame_id = "JointState"; + message.header.stamp = this->get_clock()->now(); + for (int i=0;i<3;i++){ + message.name.push_back(std::to_string(count_++)); + } + for (int i=0;i<3;i++){ + message.position.push_back(count_++/1.0); + } + for (int i=0;i<3;i++){ + message.velocity.push_back(count_++/10.0); + } + for (int i=0;i<3;i++){ + message.effort.push_back(count_++/20.0); + } + RCLCPP_INFO(this->get_logger(), "Publishing msg: { frame_id: '%s', sec: %d, nanosec: %u, name: { %s, %s, %s }, position: { x: %f, y: %f, z: %f }, velocity: { x: %f, y: %f, z: %f }, effort: { x: %f, y: %f, z: %f } }", message.header.frame_id.c_str(), message.header.stamp.sec, message.header.stamp.nanosec, message.name[0], message.name[1], message.name[2], message.position[0], message.position[1], message.position[2], message.velocity[0], message.velocity[1], message.velocity[2], message.effort[0], message.effort[1], message.effort[2] ); + publisher_->publish(message); + } + rclcpp::TimerBase::SharedPtr timer_; + rclcpp::Publisher::SharedPtr publisher_; + size_t count_; +}; + +int main(int argc, char *argv[]) +{ + rclcpp::init(argc, argv); + rclcpp::spin(std::make_shared()); + rclcpp::shutdown(); + return 0; +} \ No newline at end of file diff --git a/mros2_echoback_joint_state/src/sub_node.cpp b/mros2_echoback_joint_state/src/sub_node.cpp new file mode 100644 index 0000000..2464823 --- /dev/null +++ b/mros2_echoback_joint_state/src/sub_node.cpp @@ -0,0 +1,34 @@ +#include +#include +#include +#include + +#include "rclcpp/rclcpp.hpp" +#include "sensor_msgs/msg/joint_state.hpp" + +using std::placeholders::_1; + +class Subscriber : public rclcpp::Node +{ +public: + Subscriber() : Node("mros2_sub") + { + subscriber_ = this->create_subscription("to_linux", rclcpp::QoS(10).best_effort(), std::bind(&Subscriber::topic_callback, this, _1)); + } + +private: + void topic_callback(const sensor_msgs::msg::JointState::SharedPtr message) const + { + RCLCPP_INFO(this->get_logger(), "Subscribed msg: { frame_id: '%s', sec: %d, nanosec: %u, name: { %s, %s, %s }, position: { x: %f, y: %f, z: %f }, velocity: { x: %f, y: %f, z: %f }, effort: { x: %f, y: %f, z: %f } }", message->header.frame_id.c_str(), message->header.stamp.sec, message->header.stamp.nanosec, message->name[0], message->name[1], message->name[2], message->position[0], message->position[1], message->position[2], message->velocity[0], message->velocity[1], message->velocity[2], message->effort[0], message->effort[1], message->effort[2] ); + } + rclcpp::Subscription::SharedPtr subscriber_; +}; + + +int main(int argc, char *argv[]) +{ + rclcpp::init(argc, argv); + rclcpp::spin(std::make_shared()); + rclcpp::shutdown(); + return 0; +} \ No newline at end of file From 26e6b3b3163f8dbbf827fe133cb72303ea64e652 Mon Sep 17 00:00:00 2001 From: MEIP-users Date: Fri, 31 Dec 2021 18:16:44 +0900 Subject: [PATCH 44/56] fix joint_state app --- mros2_echoback_joint_state/CMakeLists.txt | 5 ++--- mros2_echoback_joint_state/package.xml | 2 -- mros2_echoback_joint_state/src/pub_node.cpp | 2 +- mros2_echoback_joint_state/src/sub_node.cpp | 2 +- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/mros2_echoback_joint_state/CMakeLists.txt b/mros2_echoback_joint_state/CMakeLists.txt index 7d625be..3e43520 100644 --- a/mros2_echoback_joint_state/CMakeLists.txt +++ b/mros2_echoback_joint_state/CMakeLists.txt @@ -19,17 +19,16 @@ endif() # find dependencies find_package(ament_cmake REQUIRED) find_package(rclcpp REQUIRED) -find_package(std_msgs REQUIRED) find_package(sensor_msgs REQUIRED) # uncomment the following section in order to fill in # further dependencies manually. # find_package( REQUIRED) add_executable(pub_node src/pub_node.cpp) -ament_target_dependencies(pub_node rclcpp std_msgs sensor_msgs) +ament_target_dependencies(pub_node rclcpp sensor_msgs) add_executable(sub_node src/sub_node.cpp) -ament_target_dependencies(sub_node rclcpp std_msgs sensor_msgs) +ament_target_dependencies(sub_node rclcpp sensor_msgs) target_include_directories(pub_node PUBLIC $ diff --git a/mros2_echoback_joint_state/package.xml b/mros2_echoback_joint_state/package.xml index 438cde9..860e6c0 100644 --- a/mros2_echoback_joint_state/package.xml +++ b/mros2_echoback_joint_state/package.xml @@ -9,10 +9,8 @@ ament_cmake rclcpp -std_msgs sensor_msgs rclcpp -std_msgs sensor_msgs ament_lint_auto ament_lint_common diff --git a/mros2_echoback_joint_state/src/pub_node.cpp b/mros2_echoback_joint_state/src/pub_node.cpp index e4c0127..523396a 100644 --- a/mros2_echoback_joint_state/src/pub_node.cpp +++ b/mros2_echoback_joint_state/src/pub_node.cpp @@ -39,7 +39,7 @@ class Publisher : public rclcpp::Node for (int i=0;i<3;i++){ message.effort.push_back(count_++/20.0); } - RCLCPP_INFO(this->get_logger(), "Publishing msg: { frame_id: '%s', sec: %d, nanosec: %u, name: { %s, %s, %s }, position: { x: %f, y: %f, z: %f }, velocity: { x: %f, y: %f, z: %f }, effort: { x: %f, y: %f, z: %f } }", message.header.frame_id.c_str(), message.header.stamp.sec, message.header.stamp.nanosec, message.name[0], message.name[1], message.name[2], message.position[0], message.position[1], message.position[2], message.velocity[0], message.velocity[1], message.velocity[2], message.effort[0], message.effort[1], message.effort[2] ); + RCLCPP_INFO(this->get_logger(), "Publishing msg: { frame_id: '%s', sec: %d, nanosec: %u, name: { %s, %s, %s }, position: { x: %f, y: %f, z: %f }, velocity: { x: %f, y: %f, z: %f }, effort: { x: %f, y: %f, z: %f } }", message.header.frame_id.c_str(), message.header.stamp.sec, message.header.stamp.nanosec, message.name[0].c_str(), message.name[1].c_str(), message.name[2].c_str(), message.position[0], message.position[1], message.position[2], message.velocity[0], message.velocity[1], message.velocity[2], message.effort[0], message.effort[1], message.effort[2] ); publisher_->publish(message); } rclcpp::TimerBase::SharedPtr timer_; diff --git a/mros2_echoback_joint_state/src/sub_node.cpp b/mros2_echoback_joint_state/src/sub_node.cpp index 2464823..837bea3 100644 --- a/mros2_echoback_joint_state/src/sub_node.cpp +++ b/mros2_echoback_joint_state/src/sub_node.cpp @@ -19,7 +19,7 @@ class Subscriber : public rclcpp::Node private: void topic_callback(const sensor_msgs::msg::JointState::SharedPtr message) const { - RCLCPP_INFO(this->get_logger(), "Subscribed msg: { frame_id: '%s', sec: %d, nanosec: %u, name: { %s, %s, %s }, position: { x: %f, y: %f, z: %f }, velocity: { x: %f, y: %f, z: %f }, effort: { x: %f, y: %f, z: %f } }", message->header.frame_id.c_str(), message->header.stamp.sec, message->header.stamp.nanosec, message->name[0], message->name[1], message->name[2], message->position[0], message->position[1], message->position[2], message->velocity[0], message->velocity[1], message->velocity[2], message->effort[0], message->effort[1], message->effort[2] ); + RCLCPP_INFO(this->get_logger(), "Subscribed msg: { frame_id: '%s', sec: %d, nanosec: %u, name: { %s, %s, %s }, position: { x: %f, y: %f, z: %f }, velocity: { x: %f, y: %f, z: %f }, effort: { x: %f, y: %f, z: %f } }", message->header.frame_id.c_str(), message->header.stamp.sec, message->header.stamp.nanosec, message->name[0].c_str(), message->name[1].c_str(), message->name[2].c_str(), message->position[0], message->position[1], message->position[2], message->velocity[0], message->velocity[1], message->velocity[2], message->effort[0], message->effort[1], message->effort[2] ); } rclcpp::Subscription::SharedPtr subscriber_; }; From c87bc281bc3b4df364f7e3756e13f95f18bab941 Mon Sep 17 00:00:00 2001 From: MEIP-users Date: Mon, 3 Jan 2022 23:28:45 +0900 Subject: [PATCH 45/56] twist_string app added --- mros2_echoback_twist_string/CMakeLists.txt | 63 +++++++++++++++++++ .../launch/launch_pubsub.py | 21 +++++++ mros2_echoback_twist_string/package.xml | 23 +++++++ mros2_echoback_twist_string/src/pub_node.cpp | 52 +++++++++++++++ mros2_echoback_twist_string/src/sub_node.cpp | 44 +++++++++++++ 5 files changed, 203 insertions(+) create mode 100644 mros2_echoback_twist_string/CMakeLists.txt create mode 100644 mros2_echoback_twist_string/launch/launch_pubsub.py create mode 100644 mros2_echoback_twist_string/package.xml create mode 100644 mros2_echoback_twist_string/src/pub_node.cpp create mode 100644 mros2_echoback_twist_string/src/sub_node.cpp diff --git a/mros2_echoback_twist_string/CMakeLists.txt b/mros2_echoback_twist_string/CMakeLists.txt new file mode 100644 index 0000000..2308c67 --- /dev/null +++ b/mros2_echoback_twist_string/CMakeLists.txt @@ -0,0 +1,63 @@ +cmake_minimum_required(VERSION 3.5) +project(mros2_echoback_twist_string) + + +# Default to C99 +if(NOT CMAKE_C_STANDARD) + set(CMAKE_C_STANDARD 99) +endif() + +# Default to C++14 +if(NOT CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 14) +endif() + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +# find dependencies +find_package(ament_cmake REQUIRED) +find_package(rclcpp REQUIRED) +find_package(geometry_msgs REQUIRED) +find_package(std_msgs REQUIRED) +# uncomment the following section in order to fill in +# further dependencies manually. +# find_package( REQUIRED) + +add_executable(pub_node src/pub_node.cpp) +ament_target_dependencies(pub_node rclcpp geometry_msgs std_msgs) + +add_executable(sub_node src/sub_node.cpp) +ament_target_dependencies(sub_node rclcpp geometry_msgs std_msgs) + +target_include_directories(pub_node PUBLIC + $ + $) + +target_include_directories(sub_node PUBLIC + $ + $) + +install(TARGETS pub_node + DESTINATION lib/${PROJECT_NAME}) +install(TARGETS sub_node + DESTINATION lib/${PROJECT_NAME}) + +install(DIRECTORY + launch + DESTINATION share/${PROJECT_NAME} +) + +if(BUILD_TESTING) + find_package(ament_lint_auto REQUIRED) + # the following line skips the linter which checks for copyrights + # uncomment the line when a copyright and license is not present in all source files + #set(ament_cmake_copyright_FOUND TRUE) + # the following line skips cpplint (only works in a git repo) + # uncomment the line when this package is not in a git repo + #set(ament_cmake_cpplint_FOUND TRUE) + ament_lint_auto_find_test_dependencies() +endif() + +ament_package() \ No newline at end of file diff --git a/mros2_echoback_twist_string/launch/launch_pubsub.py b/mros2_echoback_twist_string/launch/launch_pubsub.py new file mode 100644 index 0000000..bbb9b10 --- /dev/null +++ b/mros2_echoback_twist_string/launch/launch_pubsub.py @@ -0,0 +1,21 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +# Note: `node_`, `prefix` and `output` will be removed on Foxy +def generate_launch_description(): + return LaunchDescription([ + Node( + package='mros2_echoback_twist_string', + node_executable='pub_node', + node_name='pub_mros2', + prefix=['stdbuf -o L'], + output="screen" + ), + Node( + package='mros2_echoback_twist_string', + node_executable='sub_node', + node_name='mros2_sub', + prefix=['stdbuf -o L'], + output="screen" + ) + ]) \ No newline at end of file diff --git a/mros2_echoback_twist_string/package.xml b/mros2_echoback_twist_string/package.xml new file mode 100644 index 0000000..6695201 --- /dev/null +++ b/mros2_echoback_twist_string/package.xml @@ -0,0 +1,23 @@ + + + + mros2_echoback_twist_string + 0.0.0 + TODO: Package description + uden + TODO: License declaration + + ament_cmake +rclcpp +geometry_msgs +std_msgs +rclcpp +geometry_msgs +std_msgs + ament_lint_auto + ament_lint_common + + + ament_cmake + + \ No newline at end of file diff --git a/mros2_echoback_twist_string/src/pub_node.cpp b/mros2_echoback_twist_string/src/pub_node.cpp new file mode 100644 index 0000000..925e441 --- /dev/null +++ b/mros2_echoback_twist_string/src/pub_node.cpp @@ -0,0 +1,52 @@ +#include +#include +#include +#include + +#include "rclcpp/rclcpp.hpp" +#include "geometry_msgs/msg/twist.hpp" +#include "std_msgs/msg/string.hpp" + +using namespace std::chrono_literals; + +/* This example creates a subclass of Node and uses std::bind() to register a +* member function as a callback from the timer. */ + +class Publisher : public rclcpp::Node +{ +public: + Publisher() + : Node("pub_mros2"), count_(0) + { + publisher_ = this->create_publisher("to_stm", 10); + timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); + } + +private: + void timer_callback() + { + auto message = geometry_msgs::msg::Twist(); + message.linear.x = count_++/10.0; + message.linear.y = count_++/10.0; + message.linear.z = count_++/10.0; + message.angular.x = count_++/50.0; + message.angular.y = count_++/50.0; + message.angular.z = count_++/50.0; + RCLCPP_INFO(this->get_logger(), "Publishing msg: { linear: { x: %f, y: %f, z: %f }, angular: { x: %f, y: %f, z: %f } }", message.linear.x, message.linear.y, message.linear.z, message.angular.x, message.angular.y, message.angular.z); + auto converted_message = std_msgs::msg::String(); + converted_message.data = std::to_string(message.linear.x) + std::to_string(message.linear.y) + std::to_string(message.linear.z) + std::to_string(message.angular.x) + std::to_string(message.angular.y) + std::to_string(message.angular.z); + + publisher_->publish(converted_message); + } + rclcpp::TimerBase::SharedPtr timer_; + rclcpp::Publisher::SharedPtr publisher_; + size_t count_; +}; + +int main(int argc, char *argv[]) +{ + rclcpp::init(argc, argv); + rclcpp::spin(std::make_shared()); + rclcpp::shutdown(); + return 0; +} \ No newline at end of file diff --git a/mros2_echoback_twist_string/src/sub_node.cpp b/mros2_echoback_twist_string/src/sub_node.cpp new file mode 100644 index 0000000..63ee554 --- /dev/null +++ b/mros2_echoback_twist_string/src/sub_node.cpp @@ -0,0 +1,44 @@ +#include +#include +#include +#include + +#include "rclcpp/rclcpp.hpp" +#include "geometry_msgs/msg/twist.hpp" +#include "std_msgs/msg/string.hpp" + + +using std::placeholders::_1; + +class Subscriber : public rclcpp::Node +{ +public: + Subscriber() : Node("mros2_sub") + { + subscriber_ = this->create_subscription("to_linux", rclcpp::QoS(10).best_effort(), std::bind(&Subscriber::topic_callback, this, _1)); + } + +private: + void topic_callback(const std_msgs::msg::String::SharedPtr message) const + { + auto reconverted_message = geometry_msgs::msg::Twist(); + reconverted_message.linear.x = std::stod(message->data.substr(0,8)); + reconverted_message.linear.y = std::stod(message->data.substr(8,8)); + reconverted_message.linear.z = std::stod(message->data.substr(16,8)); + reconverted_message.angular.x = std::stod(message->data.substr(24,8)); + reconverted_message.angular.y = std::stod(message->data.substr(32,8)); + reconverted_message.angular.z = std::stod(message->data.substr(40,8)); + + RCLCPP_INFO(this->get_logger(), "Subscribed msg: { linear: { x: %f, y: %f, z: %f }, angular: { x: %f, y: %f, z: %f } }", reconverted_message.linear.x, reconverted_message.linear.y, reconverted_message.linear.z, reconverted_message.angular.x, reconverted_message.angular.y, reconverted_message.angular.z); + } + rclcpp::Subscription::SharedPtr subscriber_; +}; + + +int main(int argc, char *argv[]) +{ + rclcpp::init(argc, argv); + rclcpp::spin(std::make_shared()); + rclcpp::shutdown(); + return 0; +} \ No newline at end of file From c9423a85bb7fdf4aa02f0415d0666bda34226e16 Mon Sep 17 00:00:00 2001 From: MEIP-users Date: Thu, 6 Jan 2022 14:42:21 +0900 Subject: [PATCH 46/56] joint_state app modified --- custom_msgs/mix_msgs/msg/Mix.msg | 2 +- mros2_echoback_joint_state/src/pub_node.cpp | 6 +++--- mros2_echoback_mix/src/pub_node.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/custom_msgs/mix_msgs/msg/Mix.msg b/custom_msgs/mix_msgs/msg/Mix.msg index b5bc382..da24ec0 100644 --- a/custom_msgs/mix_msgs/msg/Mix.msg +++ b/custom_msgs/mix_msgs/msg/Mix.msg @@ -2,4 +2,4 @@ string name IntVector3 vec3 uint16 height float32 weight -float64[] array \ No newline at end of file +float64[8] array \ No newline at end of file diff --git a/mros2_echoback_joint_state/src/pub_node.cpp b/mros2_echoback_joint_state/src/pub_node.cpp index 523396a..c8e112b 100644 --- a/mros2_echoback_joint_state/src/pub_node.cpp +++ b/mros2_echoback_joint_state/src/pub_node.cpp @@ -30,13 +30,13 @@ class Publisher : public rclcpp::Node for (int i=0;i<3;i++){ message.name.push_back(std::to_string(count_++)); } - for (int i=0;i<3;i++){ + for (int i=0;i<1;i++){ message.position.push_back(count_++/1.0); } - for (int i=0;i<3;i++){ + for (int i=0;i<1;i++){ message.velocity.push_back(count_++/10.0); } - for (int i=0;i<3;i++){ + for (int i=0;i<1;i++){ message.effort.push_back(count_++/20.0); } RCLCPP_INFO(this->get_logger(), "Publishing msg: { frame_id: '%s', sec: %d, nanosec: %u, name: { %s, %s, %s }, position: { x: %f, y: %f, z: %f }, velocity: { x: %f, y: %f, z: %f }, effort: { x: %f, y: %f, z: %f } }", message.header.frame_id.c_str(), message.header.stamp.sec, message.header.stamp.nanosec, message.name[0].c_str(), message.name[1].c_str(), message.name[2].c_str(), message.position[0], message.position[1], message.position[2], message.velocity[0], message.velocity[1], message.velocity[2], message.effort[0], message.effort[1], message.effort[2] ); diff --git a/mros2_echoback_mix/src/pub_node.cpp b/mros2_echoback_mix/src/pub_node.cpp index 4a710cb..82a30f6 100644 --- a/mros2_echoback_mix/src/pub_node.cpp +++ b/mros2_echoback_mix/src/pub_node.cpp @@ -32,7 +32,7 @@ class Publisher : public rclcpp::Node message.height = 170; message.weight = 63.5; for (int i=0;i<8;i++){ - message.array.push_back(i/100.0); + message.array[i]=i/100.0; } RCLCPP_INFO(this->get_logger(), "Publishing msg: { name: '%s', x: %u, y: %u, z: %u,height: %u cm, weight: %f kg, array: {%f,%f,%f} }", message.name.c_str(), message.vec3.x, message.vec3.y, message.vec3.z, message.height, message.weight, message.array[0], message.array[1], message.array[2]); publisher_->publish(message); From a1644eb3c7617288fce31b9607cd06fd52b11e20 Mon Sep 17 00:00:00 2001 From: MEIP-users Date: Thu, 13 Jan 2022 11:45:01 +0900 Subject: [PATCH 47/56] calc time --- custom_msgs/mix_msgs/CMakeLists.txt | 1 + custom_msgs/mix_msgs/msg/IntVector3.msg | 5 +- custom_msgs/mix_msgs/msg/Vector3.msg | 3 + mros2_echoback_joint_state/src/pub_node.cpp | 6 +- mros2_echoback_mesh/CMakeLists.txt | 63 ++++++ mros2_echoback_mesh/launch/launch_pubsub.py | 21 ++ mros2_echoback_mesh/package.xml | 23 ++ mros2_echoback_mesh/src/pub_node.cpp | 56 +++++ mros2_echoback_mesh/src/sub_node.cpp | 34 +++ mros2_echoback_mix/src/pub_node.cpp | 8 +- mros2_echoback_mix/src/sub_node.cpp | 2 +- mros2_echoback_string/src/pub_node.cpp | 2 +- .../CMakeLists.txt | 62 ++++++ .../launch/launch_pubsub.py | 21 ++ mros2_echoback_twist _calc_time/package.xml | 21 ++ .../src/pub_node.cpp | 61 ++++++ .../src/sub_node.cpp | 43 ++++ .../CMakeLists.txt | 63 ++++++ .../launch/launch_pubsub.py | 21 ++ .../package.xml | 23 ++ .../src/pub_node.cpp | 64 ++++++ .../src/sub_node.cpp | 52 +++++ twist_publog.txt | 200 ++++++++++++++++++ twist_string_publog.txt | 200 ++++++++++++++++++ twist_string_sublog.txt | 200 ++++++++++++++++++ twist_sublog.txt | 200 ++++++++++++++++++ 26 files changed, 1442 insertions(+), 13 deletions(-) create mode 100644 custom_msgs/mix_msgs/msg/Vector3.msg create mode 100644 mros2_echoback_mesh/CMakeLists.txt create mode 100644 mros2_echoback_mesh/launch/launch_pubsub.py create mode 100644 mros2_echoback_mesh/package.xml create mode 100644 mros2_echoback_mesh/src/pub_node.cpp create mode 100644 mros2_echoback_mesh/src/sub_node.cpp create mode 100644 mros2_echoback_twist _calc_time/CMakeLists.txt create mode 100644 mros2_echoback_twist _calc_time/launch/launch_pubsub.py create mode 100644 mros2_echoback_twist _calc_time/package.xml create mode 100644 mros2_echoback_twist _calc_time/src/pub_node.cpp create mode 100644 mros2_echoback_twist _calc_time/src/sub_node.cpp create mode 100644 mros2_echoback_twist_string_calc_time/CMakeLists.txt create mode 100644 mros2_echoback_twist_string_calc_time/launch/launch_pubsub.py create mode 100644 mros2_echoback_twist_string_calc_time/package.xml create mode 100644 mros2_echoback_twist_string_calc_time/src/pub_node.cpp create mode 100644 mros2_echoback_twist_string_calc_time/src/sub_node.cpp create mode 100644 twist_publog.txt create mode 100644 twist_string_publog.txt create mode 100644 twist_string_sublog.txt create mode 100644 twist_sublog.txt diff --git a/custom_msgs/mix_msgs/CMakeLists.txt b/custom_msgs/mix_msgs/CMakeLists.txt index 4d512f1..07b9916 100644 --- a/custom_msgs/mix_msgs/CMakeLists.txt +++ b/custom_msgs/mix_msgs/CMakeLists.txt @@ -20,6 +20,7 @@ find_package(ament_cmake REQUIRED) find_package(rosidl_default_generators REQUIRED) rosidl_generate_interfaces(${PROJECT_NAME} + "msg/Vector3.msg" "msg/IntVector3.msg" "msg/Mix.msg" ) diff --git a/custom_msgs/mix_msgs/msg/IntVector3.msg b/custom_msgs/mix_msgs/msg/IntVector3.msg index ff026c9..703e430 100644 --- a/custom_msgs/mix_msgs/msg/IntVector3.msg +++ b/custom_msgs/mix_msgs/msg/IntVector3.msg @@ -1,4 +1 @@ -uint16 x -uint16 y -uint16 z - +Vector3 vec3 diff --git a/custom_msgs/mix_msgs/msg/Vector3.msg b/custom_msgs/mix_msgs/msg/Vector3.msg new file mode 100644 index 0000000..99a4d40 --- /dev/null +++ b/custom_msgs/mix_msgs/msg/Vector3.msg @@ -0,0 +1,3 @@ +uint16 x +uint16 y +uint16 z diff --git a/mros2_echoback_joint_state/src/pub_node.cpp b/mros2_echoback_joint_state/src/pub_node.cpp index c8e112b..523396a 100644 --- a/mros2_echoback_joint_state/src/pub_node.cpp +++ b/mros2_echoback_joint_state/src/pub_node.cpp @@ -30,13 +30,13 @@ class Publisher : public rclcpp::Node for (int i=0;i<3;i++){ message.name.push_back(std::to_string(count_++)); } - for (int i=0;i<1;i++){ + for (int i=0;i<3;i++){ message.position.push_back(count_++/1.0); } - for (int i=0;i<1;i++){ + for (int i=0;i<3;i++){ message.velocity.push_back(count_++/10.0); } - for (int i=0;i<1;i++){ + for (int i=0;i<3;i++){ message.effort.push_back(count_++/20.0); } RCLCPP_INFO(this->get_logger(), "Publishing msg: { frame_id: '%s', sec: %d, nanosec: %u, name: { %s, %s, %s }, position: { x: %f, y: %f, z: %f }, velocity: { x: %f, y: %f, z: %f }, effort: { x: %f, y: %f, z: %f } }", message.header.frame_id.c_str(), message.header.stamp.sec, message.header.stamp.nanosec, message.name[0].c_str(), message.name[1].c_str(), message.name[2].c_str(), message.position[0], message.position[1], message.position[2], message.velocity[0], message.velocity[1], message.velocity[2], message.effort[0], message.effort[1], message.effort[2] ); diff --git a/mros2_echoback_mesh/CMakeLists.txt b/mros2_echoback_mesh/CMakeLists.txt new file mode 100644 index 0000000..b8a97aa --- /dev/null +++ b/mros2_echoback_mesh/CMakeLists.txt @@ -0,0 +1,63 @@ +cmake_minimum_required(VERSION 3.5) +project(mros2_echoback_mesh) + + +# Default to C99 +if(NOT CMAKE_C_STANDARD) + set(CMAKE_C_STANDARD 99) +endif() + +# Default to C++14 +if(NOT CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 14) +endif() + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +# find dependencies +find_package(ament_cmake REQUIRED) +find_package(rclcpp REQUIRED) +find_package(geometry_msgs REQUIRED) +find_package(shape_msgs REQUIRED) +# uncomment the following section in order to fill in +# further dependencies manually. +# find_package( REQUIRED) + +add_executable(pub_node src/pub_node.cpp) +ament_target_dependencies(pub_node rclcpp geometry_msgs shape_msgs) + +add_executable(sub_node src/sub_node.cpp) +ament_target_dependencies(sub_node rclcpp geometry_msgs shape_msgs) + +target_include_directories(pub_node PUBLIC + $ + $) + +target_include_directories(sub_node PUBLIC + $ + $) + +install(TARGETS pub_node + DESTINATION lib/${PROJECT_NAME}) +install(TARGETS sub_node + DESTINATION lib/${PROJECT_NAME}) + +install(DIRECTORY + launch + DESTINATION share/${PROJECT_NAME} +) + +if(BUILD_TESTING) + find_package(ament_lint_auto REQUIRED) + # the following line skips the linter which checks for copyrights + # uncomment the line when a copyright and license is not present in all source files + #set(ament_cmake_copyright_FOUND TRUE) + # the following line skips cpplint (only works in a git repo) + # uncomment the line when this package is not in a git repo + #set(ament_cmake_cpplint_FOUND TRUE) + ament_lint_auto_find_test_dependencies() +endif() + +ament_package() \ No newline at end of file diff --git a/mros2_echoback_mesh/launch/launch_pubsub.py b/mros2_echoback_mesh/launch/launch_pubsub.py new file mode 100644 index 0000000..6351c51 --- /dev/null +++ b/mros2_echoback_mesh/launch/launch_pubsub.py @@ -0,0 +1,21 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +# Note: `node_`, `prefix` and `output` will be removed on Foxy +def generate_launch_description(): + return LaunchDescription([ + Node( + package='mros2_echoback_mesh', + node_executable='pub_node', + node_name='pub_mros2', + prefix=['stdbuf -o L'], + output="screen" + ), + Node( + package='mros2_echoback_mesh', + node_executable='sub_node', + node_name='mros2_sub', + prefix=['stdbuf -o L'], + output="screen" + ) + ]) \ No newline at end of file diff --git a/mros2_echoback_mesh/package.xml b/mros2_echoback_mesh/package.xml new file mode 100644 index 0000000..1e69b09 --- /dev/null +++ b/mros2_echoback_mesh/package.xml @@ -0,0 +1,23 @@ + + + + mros2_echoback_mesh + 0.0.0 + TODO: Package description + uden + TODO: License declaration + + ament_cmake +rclcpp +geometry_msgs +shape_msgs +rclcpp +geometry_msgs +shape_msgs + ament_lint_auto + ament_lint_common + + + ament_cmake + + \ No newline at end of file diff --git a/mros2_echoback_mesh/src/pub_node.cpp b/mros2_echoback_mesh/src/pub_node.cpp new file mode 100644 index 0000000..be801e7 --- /dev/null +++ b/mros2_echoback_mesh/src/pub_node.cpp @@ -0,0 +1,56 @@ +#include +#include +#include +#include + +#include "rclcpp/rclcpp.hpp" +#include "shape_msgs/msg/mesh.hpp" + +using namespace std::chrono_literals; + +/* This example creates a subclass of Node and uses std::bind() to register a +* member function as a callback from the timer. */ + +class Publisher : public rclcpp::Node +{ +public: + Publisher() + : Node("pub_mros2"), count_(0) + { + publisher_ = this->create_publisher("to_stm", 10); + timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); + } + +private: + void timer_callback() + { + auto message = shape_msgs::msg::Mesh(); + message.triangles.reserve(2); + message.vertices.reserve(2); + for (int i=0;i<2;i++){ + for (int j=0;j<3;j++){ + message.triangles[i].vertex_indices[j]=count_++; + } + } + for (int i=0;i<2;i++){ + for (int j=0;j<3;j++){ + message.vertices[i].x=count_++; + message.vertices[i].y=count_++; + message.vertices[i].z=count_++; + } + } + RCLCPP_INFO(this->get_logger(), "Publishing msg: { triangles: {{ %lu, %lu, %lu }, { %lu, %lu, %lu }}, vertices: {{ %f, %f, %f }, { %f, %f, %f }}}", message.triangles[0].vertex_indices[0], message.triangles[0].vertex_indices[1], message.triangles[0].vertex_indices[2], message.triangles[1].vertex_indices[0], message.triangles[1].vertex_indices[1], message.triangles[1].vertex_indices[2], message.vertices[0].x, message.vertices[0].y, message.vertices[0].z, message.vertices[1].x, message.vertices[1].y, message.vertices[1].z); + publisher_->publish(message); + } + rclcpp::TimerBase::SharedPtr timer_; + rclcpp::Publisher::SharedPtr publisher_; + size_t count_; +}; + +int main(int argc, char *argv[]) +{ + rclcpp::init(argc, argv); + rclcpp::spin(std::make_shared()); + rclcpp::shutdown(); + return 0; +} \ No newline at end of file diff --git a/mros2_echoback_mesh/src/sub_node.cpp b/mros2_echoback_mesh/src/sub_node.cpp new file mode 100644 index 0000000..097165a --- /dev/null +++ b/mros2_echoback_mesh/src/sub_node.cpp @@ -0,0 +1,34 @@ +#include +#include +#include +#include + +#include "rclcpp/rclcpp.hpp" +#include "shape_msgs/msg/mesh.hpp" + +using std::placeholders::_1; + +class Subscriber : public rclcpp::Node +{ +public: + Subscriber() : Node("mros2_sub") + { + subscriber_ = this->create_subscription("to_linux", rclcpp::QoS(10).best_effort(), std::bind(&Subscriber::topic_callback, this, _1)); + } + +private: + void topic_callback(const shape_msgs::msg::Mesh::SharedPtr message) const + { + RCLCPP_INFO(this->get_logger(), "Subscribed msg: { triangles: {{ %lu, %lu, %lu }, { %lu, %lu, %lu }}, vertices: {{ %f, %f, %f }, { %f, %f, %f }}}", message->triangles[0].vertex_indices[0], message->triangles[0].vertex_indices[1], message->triangles[0].vertex_indices[2], message->triangles[1].vertex_indices[0], message->triangles[1].vertex_indices[1], message->triangles[1].vertex_indices[2], message->vertices[0].x, message->vertices[0].y, message->vertices[0].z, message->vertices[1].x, message->vertices[1].y, message->vertices[1].z); + } + rclcpp::Subscription::SharedPtr subscriber_; +}; + + +int main(int argc, char *argv[]) +{ + rclcpp::init(argc, argv); + rclcpp::spin(std::make_shared()); + rclcpp::shutdown(); + return 0; +} \ No newline at end of file diff --git a/mros2_echoback_mix/src/pub_node.cpp b/mros2_echoback_mix/src/pub_node.cpp index 82a30f6..fd9eddc 100644 --- a/mros2_echoback_mix/src/pub_node.cpp +++ b/mros2_echoback_mix/src/pub_node.cpp @@ -26,15 +26,15 @@ class Publisher : public rclcpp::Node { auto message = mix_msgs::msg::Mix(); message.name = std::to_string(count_++); - message.vec3.x = 1; - message.vec3.y = 1; - message.vec3.z = 1; + message.vec3.vec3.x = 1; + message.vec3.vec3.y = 1; + message.vec3.vec3.z = 1; message.height = 170; message.weight = 63.5; for (int i=0;i<8;i++){ message.array[i]=i/100.0; } - RCLCPP_INFO(this->get_logger(), "Publishing msg: { name: '%s', x: %u, y: %u, z: %u,height: %u cm, weight: %f kg, array: {%f,%f,%f} }", message.name.c_str(), message.vec3.x, message.vec3.y, message.vec3.z, message.height, message.weight, message.array[0], message.array[1], message.array[2]); + RCLCPP_INFO(this->get_logger(), "Publishing msg: { name: '%s', x: %u, y: %u, z: %u,height: %u cm, weight: %f kg, array: {%f,%f,%f} }", message.name.c_str(), message.vec3.vec3.x, message.vec3.vec3.y, message.vec3.vec3.z, message.height, message.weight, message.array[0], message.array[1], message.array[2]); publisher_->publish(message); } rclcpp::TimerBase::SharedPtr timer_; diff --git a/mros2_echoback_mix/src/sub_node.cpp b/mros2_echoback_mix/src/sub_node.cpp index ad12e29..dae9acd 100644 --- a/mros2_echoback_mix/src/sub_node.cpp +++ b/mros2_echoback_mix/src/sub_node.cpp @@ -19,7 +19,7 @@ class Subscriber : public rclcpp::Node private: void topic_callback(const mix_msgs::msg::Mix::SharedPtr message) const { - RCLCPP_INFO(this->get_logger(), "Subscribed msg: { name: '%s', x: %u, y: %u, z: %u, height: %d cm, weight: %f kg, array: {%f,%f,%f} }", message->name.c_str(), message->vec3.x, message->vec3.y, message->vec3.z, message->height, message->weight, message->array[0], message->array[1], message->array[2]); + RCLCPP_INFO(this->get_logger(), "Subscribed msg: { name: '%s', x: %u, y: %u, z: %u, height: %d cm, weight: %f kg, array: {%f,%f,%f} }", message->name.c_str(), message->vec3.vec3.x, message->vec3.vec3.y, message->vec3.vec3.z, message->height, message->weight, message->array[0], message->array[1], message->array[2]); } rclcpp::Subscription::SharedPtr subscriber_; }; diff --git a/mros2_echoback_string/src/pub_node.cpp b/mros2_echoback_string/src/pub_node.cpp index 9c288bf..49fa857 100644 --- a/mros2_echoback_string/src/pub_node.cpp +++ b/mros2_echoback_string/src/pub_node.cpp @@ -25,7 +25,7 @@ class Publisher : public rclcpp::Node void timer_callback() { auto message = std_msgs::msg::String(); - message.data = "Hello, world! " + std::to_string(count_++); + message.data = "Hello, world!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + std::to_string(count_++); RCLCPP_INFO(this->get_logger(), "Publishing msg: '%s'", message.data.c_str()); publisher_->publish(message); } diff --git a/mros2_echoback_twist _calc_time/CMakeLists.txt b/mros2_echoback_twist _calc_time/CMakeLists.txt new file mode 100644 index 0000000..8599482 --- /dev/null +++ b/mros2_echoback_twist _calc_time/CMakeLists.txt @@ -0,0 +1,62 @@ +cmake_minimum_required(VERSION 3.5) +project(mros2_echoback_twist_calc_time) + + +# Default to C99 +if(NOT CMAKE_C_STANDARD) + set(CMAKE_C_STANDARD 99) +endif() + +# Default to C++14 +if(NOT CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 14) +endif() + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +# find dependencies +find_package(ament_cmake REQUIRED) +find_package(rclcpp REQUIRED) +find_package(geometry_msgs REQUIRED) +# uncomment the following section in order to fill in +# further dependencies manually. +# find_package( REQUIRED) + +add_executable(pub_node src/pub_node.cpp) +ament_target_dependencies(pub_node rclcpp geometry_msgs) + +add_executable(sub_node src/sub_node.cpp) +ament_target_dependencies(sub_node rclcpp geometry_msgs) + +target_include_directories(pub_node PUBLIC + $ + $) + +target_include_directories(sub_node PUBLIC + $ + $) + +install(TARGETS pub_node + DESTINATION lib/${PROJECT_NAME}) +install(TARGETS sub_node + DESTINATION lib/${PROJECT_NAME}) + +install(DIRECTORY + launch + DESTINATION share/${PROJECT_NAME} +) + +if(BUILD_TESTING) + find_package(ament_lint_auto REQUIRED) + # the following line skips the linter which checks for copyrights + # uncomment the line when a copyright and license is not present in all source files + #set(ament_cmake_copyright_FOUND TRUE) + # the following line skips cpplint (only works in a git repo) + # uncomment the line when this package is not in a git repo + #set(ament_cmake_cpplint_FOUND TRUE) + ament_lint_auto_find_test_dependencies() +endif() + +ament_package() \ No newline at end of file diff --git a/mros2_echoback_twist _calc_time/launch/launch_pubsub.py b/mros2_echoback_twist _calc_time/launch/launch_pubsub.py new file mode 100644 index 0000000..4408431 --- /dev/null +++ b/mros2_echoback_twist _calc_time/launch/launch_pubsub.py @@ -0,0 +1,21 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +# Note: `node_`, `prefix` and `output` will be removed on Foxy +def generate_launch_description(): + return LaunchDescription([ + Node( + package='mros2_echoback_twist_calc_time', + node_executable='pub_node', + node_name='pub_mros2', + prefix=['stdbuf -o L'], + output="screen" + ), + Node( + package='mros2_echoback_twist_calc_time', + node_executable='sub_node', + node_name='mros2_sub', + prefix=['stdbuf -o L'], + output="screen" + ) + ]) \ No newline at end of file diff --git a/mros2_echoback_twist _calc_time/package.xml b/mros2_echoback_twist _calc_time/package.xml new file mode 100644 index 0000000..5031a0f --- /dev/null +++ b/mros2_echoback_twist _calc_time/package.xml @@ -0,0 +1,21 @@ + + + + mros2_echoback_twist_calc_time + 0.0.0 + TODO: Package description + uden + TODO: License declaration + + ament_cmake +rclcpp +geometry_msgs +rclcpp +geometry_msgs + ament_lint_auto + ament_lint_common + + + ament_cmake + + \ No newline at end of file diff --git a/mros2_echoback_twist _calc_time/src/pub_node.cpp b/mros2_echoback_twist _calc_time/src/pub_node.cpp new file mode 100644 index 0000000..95a6840 --- /dev/null +++ b/mros2_echoback_twist _calc_time/src/pub_node.cpp @@ -0,0 +1,61 @@ +#include +#include +#include +#include +#include + +#include "rclcpp/rclcpp.hpp" +#include "geometry_msgs/msg/twist.hpp" + +using namespace std::chrono_literals; + +/* This example creates a subclass of Node and uses std::bind() to register a +* member function as a callback from the timer. */ + +class Publisher : public rclcpp::Node +{ +public: + Publisher() + : Node("pub_mros2"), count_(0) + { + publisher_ = this->create_publisher("to_stm", 10); + timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); + } + +private: + std::array publogs; + void timer_callback() + { + if (count_ < 200){ + auto message = geometry_msgs::msg::Twist(); + publogs[count_] = this->get_clock()->now(); + message.linear.x = count_++/10.0; + message.linear.y = count_/10.0; + message.linear.z = count_/10.0; + message.angular.x = count_/50.0; + message.angular.y = count_/50.0; + message.angular.z = count_/50.0; + publisher_->publish(message); + } else if (count_ == 200) { + RCLCPP_INFO(this->get_logger(),"Finished 200 messages!!"); + std::ofstream writing_file; + std::string filename = "twist_publog.txt"; + writing_file.open(filename, std::ios::out); + for (int i=0; i<200; i++){ + const std::string writing_text = std::to_string(publogs[i].nanoseconds()); + writing_file << writing_text << std::endl; + } + } + } + rclcpp::TimerBase::SharedPtr timer_; + rclcpp::Publisher::SharedPtr publisher_; + size_t count_; +}; + +int main(int argc, char *argv[]) +{ + rclcpp::init(argc, argv); + rclcpp::spin(std::make_shared()); + rclcpp::shutdown(); + return 0; +} \ No newline at end of file diff --git a/mros2_echoback_twist _calc_time/src/sub_node.cpp b/mros2_echoback_twist _calc_time/src/sub_node.cpp new file mode 100644 index 0000000..08e2050 --- /dev/null +++ b/mros2_echoback_twist _calc_time/src/sub_node.cpp @@ -0,0 +1,43 @@ +#include +#include +#include +#include +#include + +#include "rclcpp/rclcpp.hpp" +#include "geometry_msgs/msg/twist.hpp" + +using std::placeholders::_1; + +class Subscriber : public rclcpp::Node +{ +public: + Subscriber() : Node("mros2_sub") + { + subscriber_ = this->create_subscription("to_linux", rclcpp::QoS(10).best_effort(), std::bind(&Subscriber::topic_callback, this, _1)); + } + +private: + void topic_callback(const geometry_msgs::msg::Twist::SharedPtr message) + { + auto subscribed_message = geometry_msgs::msg::Twist(); + subscribed_message = *message; + + rclcpp::Time now = this->get_clock()->now(); + std::ofstream writing_file; + std::string filename = "twist_sublog.txt"; + writing_file.open(filename, std::ios::app); + const std::string writing_text = std::to_string(now.nanoseconds()); + writing_file << writing_text << std::endl; + } + rclcpp::Subscription::SharedPtr subscriber_; +}; + + +int main(int argc, char *argv[]) +{ + rclcpp::init(argc, argv); + rclcpp::spin(std::make_shared()); + rclcpp::shutdown(); + return 0; +} \ No newline at end of file diff --git a/mros2_echoback_twist_string_calc_time/CMakeLists.txt b/mros2_echoback_twist_string_calc_time/CMakeLists.txt new file mode 100644 index 0000000..08089a7 --- /dev/null +++ b/mros2_echoback_twist_string_calc_time/CMakeLists.txt @@ -0,0 +1,63 @@ +cmake_minimum_required(VERSION 3.5) +project(mros2_echoback_twist_string_calc_time) + + +# Default to C99 +if(NOT CMAKE_C_STANDARD) + set(CMAKE_C_STANDARD 99) +endif() + +# Default to C++14 +if(NOT CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 14) +endif() + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +# find dependencies +find_package(ament_cmake REQUIRED) +find_package(rclcpp REQUIRED) +find_package(geometry_msgs REQUIRED) +find_package(std_msgs REQUIRED) +# uncomment the following section in order to fill in +# further dependencies manually. +# find_package( REQUIRED) + +add_executable(pub_node src/pub_node.cpp) +ament_target_dependencies(pub_node rclcpp geometry_msgs std_msgs) + +add_executable(sub_node src/sub_node.cpp) +ament_target_dependencies(sub_node rclcpp geometry_msgs std_msgs) + +target_include_directories(pub_node PUBLIC + $ + $) + +target_include_directories(sub_node PUBLIC + $ + $) + +install(TARGETS pub_node + DESTINATION lib/${PROJECT_NAME}) +install(TARGETS sub_node + DESTINATION lib/${PROJECT_NAME}) + +install(DIRECTORY + launch + DESTINATION share/${PROJECT_NAME} +) + +if(BUILD_TESTING) + find_package(ament_lint_auto REQUIRED) + # the following line skips the linter which checks for copyrights + # uncomment the line when a copyright and license is not present in all source files + #set(ament_cmake_copyright_FOUND TRUE) + # the following line skips cpplint (only works in a git repo) + # uncomment the line when this package is not in a git repo + #set(ament_cmake_cpplint_FOUND TRUE) + ament_lint_auto_find_test_dependencies() +endif() + +ament_package() \ No newline at end of file diff --git a/mros2_echoback_twist_string_calc_time/launch/launch_pubsub.py b/mros2_echoback_twist_string_calc_time/launch/launch_pubsub.py new file mode 100644 index 0000000..b345aba --- /dev/null +++ b/mros2_echoback_twist_string_calc_time/launch/launch_pubsub.py @@ -0,0 +1,21 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +# Note: `node_`, `prefix` and `output` will be removed on Foxy +def generate_launch_description(): + return LaunchDescription([ + Node( + package='mros2_echoback_twist_string_calc_time', + node_executable='pub_node', + node_name='pub_mros2', + prefix=['stdbuf -o L'], + output="screen" + ), + Node( + package='mros2_echoback_twist_string_calc_time', + node_executable='sub_node', + node_name='mros2_sub', + prefix=['stdbuf -o L'], + output="screen" + ) + ]) \ No newline at end of file diff --git a/mros2_echoback_twist_string_calc_time/package.xml b/mros2_echoback_twist_string_calc_time/package.xml new file mode 100644 index 0000000..aa815e0 --- /dev/null +++ b/mros2_echoback_twist_string_calc_time/package.xml @@ -0,0 +1,23 @@ + + + + mros2_echoback_twist_string_calc_time + 0.0.0 + TODO: Package description + uden + TODO: License declaration + + ament_cmake +rclcpp +geometry_msgs +std_msgs +rclcpp +geometry_msgs +std_msgs + ament_lint_auto + ament_lint_common + + + ament_cmake + + \ No newline at end of file diff --git a/mros2_echoback_twist_string_calc_time/src/pub_node.cpp b/mros2_echoback_twist_string_calc_time/src/pub_node.cpp new file mode 100644 index 0000000..4c1c25a --- /dev/null +++ b/mros2_echoback_twist_string_calc_time/src/pub_node.cpp @@ -0,0 +1,64 @@ +#include +#include +#include +#include +#include + +#include "rclcpp/rclcpp.hpp" +#include "geometry_msgs/msg/twist.hpp" +#include "std_msgs/msg/string.hpp" + +using namespace std::chrono_literals; + +/* This example creates a subclass of Node and uses std::bind() to register a +* member function as a callback from the timer. */ + +class Publisher : public rclcpp::Node +{ +public: + Publisher() + : Node("pub_mros2"), count_(0) + { + publisher_ = this->create_publisher("to_stm", 10); + timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); + } + +private: + std::array publogs; + void timer_callback() + { + if (count_ < 200){ + auto message = geometry_msgs::msg::Twist(); + auto converted_message = std_msgs::msg::String(); + publogs[count_] = this->get_clock()->now(); + message.linear.x = count_++/10.0; + message.linear.y = count_/10.0; + message.linear.z = count_/10.0; + message.angular.x = count_/50.0; + message.angular.y = count_/50.0; + message.angular.z = count_/50.0; + converted_message.data = std::to_string(message.linear.x) + std::to_string(message.linear.y) + std::to_string(message.linear.z) + std::to_string(message.angular.x) + std::to_string(message.angular.y) + std::to_string(message.angular.z); + publisher_->publish(converted_message); + } else if (count_ == 200) { + RCLCPP_INFO(this->get_logger(),"Finished 200 messages!!"); + std::ofstream writing_file; + std::string filename = "twist_string_publog.txt"; + writing_file.open(filename, std::ios::out); + for (int i=0; i<200; i++){ + const std::string writing_text = std::to_string(publogs[i].nanoseconds()); + writing_file << writing_text << std::endl; + } + } + } + rclcpp::TimerBase::SharedPtr timer_; + rclcpp::Publisher::SharedPtr publisher_; + size_t count_; +}; + +int main(int argc, char *argv[]) +{ + rclcpp::init(argc, argv); + rclcpp::spin(std::make_shared()); + rclcpp::shutdown(); + return 0; +} \ No newline at end of file diff --git a/mros2_echoback_twist_string_calc_time/src/sub_node.cpp b/mros2_echoback_twist_string_calc_time/src/sub_node.cpp new file mode 100644 index 0000000..3523264 --- /dev/null +++ b/mros2_echoback_twist_string_calc_time/src/sub_node.cpp @@ -0,0 +1,52 @@ +#include +#include +#include +#include +#include + +#include "rclcpp/rclcpp.hpp" +#include "geometry_msgs/msg/twist.hpp" +#include "std_msgs/msg/string.hpp" + + +using std::placeholders::_1; + + +class Subscriber : public rclcpp::Node +{ +public: + Subscriber() : Node("mros2_sub") + { + subscriber_ = this->create_subscription("to_linux", rclcpp::QoS(10).best_effort(), std::bind(&Subscriber::topic_callback, this, _1)); + } + +private: + std::array sublogs; + void topic_callback(const std_msgs::msg::String::SharedPtr message) + { + auto reconverted_message = geometry_msgs::msg::Twist(); + reconverted_message.linear.x = std::stod(message->data.substr(0,8)); + reconverted_message.linear.y = std::stod(message->data.substr(8,8)); + reconverted_message.linear.z = std::stod(message->data.substr(16,8)); + reconverted_message.angular.x = std::stod(message->data.substr(24,8)); + reconverted_message.angular.y = std::stod(message->data.substr(32,8)); + reconverted_message.angular.z = std::stod(message->data.substr(40,8)); + + rclcpp::Time now = this->get_clock()->now(); + std::ofstream writing_file; + std::string filename = "twist_string_sublog.txt"; + writing_file.open(filename, std::ios::app); + const std::string writing_text = std::to_string(now.nanoseconds()); + writing_file << writing_text << std::endl; + } + rclcpp::Subscription::SharedPtr subscriber_; +}; + + +int main(int argc, char *argv[]) +{ + rclcpp::init(argc, argv); + rclcpp::spin(std::make_shared()); + rclcpp::shutdown(); + return 0; +} \ No newline at end of file diff --git a/twist_publog.txt b/twist_publog.txt new file mode 100644 index 0000000..7d04c74 --- /dev/null +++ b/twist_publog.txt @@ -0,0 +1,200 @@ +1642001496771276214 +1642001497771403052 +1642001498771221779 +1642001499771206147 +1642001500771276931 +1642001501771152708 +1642001502771194482 +1642001503771231067 +1642001504770827635 +1642001505771099665 +1642001506770936294 +1642001507770940636 +1642001508770895089 +1642001509770858962 +1642001510770828752 +1642001511770799940 +1642001512770645458 +1642001513770733984 +1642001514770684191 +1642001515770580712 +1642001516770621195 +1642001517770487132 +1642001518770648568 +1642001519770546087 +1642001520770378154 +1642001521770615495 +1642001522770584811 +1642001523770416263 +1642001524770219219 +1642001525770229769 +1642001526770295396 +1642001527770199273 +1642001528770248396 +1642001529770134004 +1642001530770101789 +1642001531769925329 +1642001532769864129 +1642001533769981899 +1642001534769834308 +1642001535769927992 +1642001536769904331 +1642001537769872149 +1642001538769824041 +1642001539769788754 +1642001540769817168 +1642001541769679667 +1642001542769631673 +1642001543769652095 +1642001544769499593 +1642001545769582482 +1642001546769555030 +1642001547769556277 +1642001548769516030 +1642001549769433991 +1642001550769353523 +1642001551769324086 +1642001552769302858 +1642001553769221612 +1642001554769538670 +1642001555769271664 +1642001556769223196 +1642001557769292483 +1642001558769176508 +1642001559769139189 +1642001560769342933 +1642001561769199042 +1642001562769146383 +1642001563769150881 +1642001564768923473 +1642001565768968019 +1642001566768952364 +1642001567768986884 +1642001568768972760 +1642001569768947859 +1642001570768904549 +1642001571768960922 +1642001572768818315 +1642001573768943595 +1642001574768742927 +1642001575768690217 +1642001576768644564 +1642001577768664754 +1642001578768643313 +1642001579768663796 +1642001580768637892 +1642001581768532311 +1642001582768616687 +1642001583768467468 +1642001584768283433 +1642001585768207926 +1642001586768317781 +1642001587768164765 +1642001588768172609 +1642001589768216866 +1642001590768017627 +1642001591768199252 +1642001592768166953 +1642001593768128820 +1642001594768099961 +1642001595767945559 +1642001596768030558 +1642001597767969883 +1642001598767853252 +1642001599767906025 +1642001600767904728 +1642001601767673027 +1642001602767953673 +1642001603767795502 +1642001604767760493 +1642001605767686859 +1642001606767599832 +1642001607767673022 +1642001608767733612 +1642001609767577027 +1642001610767547529 +1642001611767535995 +1642001612767503122 +1642001613767467312 +1642001614767444583 +1642001615767398281 +1642001616767363006 +1642001617767317279 +1642001618767311492 +1642001619767239451 +1642001620767140582 +1642001621767206983 +1642001622767177555 +1642001623767088072 +1642001624767227288 +1642001625767232141 +1642001626766935831 +1642001627766847008 +1642001628766965675 +1642001629766925321 +1642001630766905009 +1642001631766870739 +1642001632766858394 +1642001633766778645 +1642001634766678009 +1642001635766739399 +1642001636766797278 +1642001637766804427 +1642001638766767929 +1642001639766759967 +1642001640766557468 +1642001641766436734 +1642001642766662899 +1642001643766465871 +1642001644766448259 +1642001645766496115 +1642001646766276047 +1642001647766330548 +1642001648766237330 +1642001649766203451 +1642001650766169754 +1642001651766196417 +1642001652766091981 +1642001653766069517 +1642001654766195163 +1642001655766008728 +1642001656766003128 +1642001657766013865 +1642001658766072321 +1642001659765857734 +1642001660766044812 +1642001661766016984 +1642001662765999141 +1642001663765983602 +1642001664765779438 +1642001665765871935 +1642001666765623801 +1642001667765580103 +1642001668765742137 +1642001669765556642 +1642001670765576696 +1642001671765385995 +1642001672765412221 +1642001673765623326 +1642001674765564250 +1642001675765250151 +1642001676765225377 +1642001677765190236 +1642001678765498209 +1642001679765453869 +1642001680765205623 +1642001681765182655 +1642001682765187514 +1642001683765297304 +1642001684765021532 +1642001685765135976 +1642001686765123486 +1642001687764963028 +1642001688764918763 +1642001689765014246 +1642001690765036153 +1642001691765032288 +1642001692765006988 +1642001693764969692 +1642001694764981267 +1642001695764623741 diff --git a/twist_string_publog.txt b/twist_string_publog.txt new file mode 100644 index 0000000..73adaeb --- /dev/null +++ b/twist_string_publog.txt @@ -0,0 +1,200 @@ +1642039522157315026 +1642039523157268443 +1642039524156957259 +1642039525156952105 +1642039526156964118 +1642039527156925434 +1642039528156900634 +1642039529156839366 +1642039530156833667 +1642039531156708340 +1642039532156767298 +1642039533156704672 +1642039534156699025 +1642039535156620988 +1642039536156619098 +1642039537156564077 +1642039538156522478 +1642039539156463467 +1642039540156370685 +1642039541156440948 +1642039542156682926 +1642039543156344535 +1642039544156253957 +1642039545156275536 +1642039546156361226 +1642039547156254313 +1642039548156325036 +1642039549156201898 +1642039550156168402 +1642039551156045289 +1642039552156013215 +1642039553156303792 +1642039554156246791 +1642039555155985948 +1642039556155975799 +1642039557156160059 +1642039558156152970 +1642039559155995917 +1642039560156036111 +1642039561156049866 +1642039562155982136 +1642039563156030172 +1642039564155908275 +1642039565155657378 +1642039566155553234 +1642039567155704913 +1642039568155660392 +1642039569155769577 +1642039570155625028 +1642039571155574606 +1642039572155663099 +1642039573155550825 +1642039574155589982 +1642039575155348627 +1642039576155513152 +1642039577155125550 +1642039578155234363 +1642039579155420894 +1642039580155383368 +1642039581155396037 +1642039582155336573 +1642039583155278303 +1642039584155154441 +1642039585155251747 +1642039586154965916 +1642039587155135631 +1642039588155009527 +1642039589154866527 +1642039590154958463 +1642039591154794977 +1642039592154887141 +1642039593154768421 +1642039594154821561 +1642039595154795981 +1642039596154761650 +1642039597154646815 +1642039598154504650 +1642039599154647207 +1642039600154595600 +1642039601154479560 +1642039602154531223 +1642039603154506722 +1642039604154635673 +1642039605154609604 +1642039606154255828 +1642039607154216120 +1642039608154344563 +1642039609154322686 +1642039610154233250 +1642039611154258093 +1642039612154207968 +1642039613154104158 +1642039614154261046 +1642039615154275173 +1642039616154103142 +1642039617154168981 +1642039618154038808 +1642039619154104047 +1642039620154145076 +1642039621153934199 +1642039622153878462 +1642039623154020918 +1642039624153824683 +1642039625153903065 +1642039626153662083 +1642039627153610946 +1642039628153602695 +1642039629153660826 +1642039630153631977 +1642039631153731301 +1642039632153482143 +1642039633153533910 +1642039634153503744 +1642039635153596254 +1642039636153340291 +1642039637153261395 +1642039638153273249 +1642039639153446801 +1642039640153424247 +1642039641153410829 +1642039642153255092 +1642039643153087442 +1642039644153346062 +1642039645153285769 +1642039646153252737 +1642039647152948896 +1642039648152954462 +1642039649152926056 +1642039650152890413 +1642039651153066206 +1642039652152888636 +1642039653153021714 +1642039654152782549 +1642039655152731992 +1642039656152661592 +1642039657152622621 +1642039658152851960 +1642039659152660766 +1642039660152577217 +1642039661152508748 +1642039662152511322 +1642039663152683496 +1642039664152401117 +1642039665152392174 +1642039666152642196 +1642039667152332408 +1642039668152271652 +1642039669152175330 +1642039670152459070 +1642039671152114407 +1642039672152150484 +1642039673152082852 +1642039674152036457 +1642039675152279834 +1642039676151943415 +1642039677151972237 +1642039678152002313 +1642039679151857767 +1642039680151868159 +1642039681151863276 +1642039682151758882 +1642039683151778507 +1642039684151769750 +1642039685151853487 +1642039686151610622 +1642039687151522712 +1642039688151586081 +1642039689151569020 +1642039690151548671 +1642039691151642878 +1642039692151754895 +1642039693151743160 +1642039694151545712 +1642039695151511796 +1642039696151591005 +1642039697151460976 +1642039698151530051 +1642039699151467097 +1642039700151353289 +1642039701151092101 +1642039702151111004 +1642039703151178823 +1642039704151025879 +1642039705150983541 +1642039706151075435 +1642039707150926945 +1642039708150944281 +1642039709150861301 +1642039710150902180 +1642039711150972064 +1642039712150818127 +1642039713150713760 +1642039714150735010 +1642039715150634866 +1642039716150567750 +1642039717150547496 +1642039718150624218 +1642039719150510793 +1642039720150487068 +1642039721150433452 diff --git a/twist_string_sublog.txt b/twist_string_sublog.txt new file mode 100644 index 0000000..55014f4 --- /dev/null +++ b/twist_string_sublog.txt @@ -0,0 +1,200 @@ +1642039522158898790 +1642039523158293251 +1642039524158003701 +1642039525158066607 +1642039526158046240 +1642039527158107065 +1642039528158091748 +1642039529158238837 +1642039530158022161 +1642039531157890996 +1642039532157951332 +1642039533158103013 +1642039534157902346 +1642039535158012246 +1642039536157819785 +1642039537157754513 +1642039538157929787 +1642039539157648797 +1642039540157229969 +1642039541157665832 +1642039542157890996 +1642039543157326492 +1642039544157005362 +1642039545156776435 +1642039546157627634 +1642039547157345125 +1642039548157345743 +1642039549157410983 +1642039550157378865 +1642039551157253041 +1642039552157257552 +1642039553157512231 +1642039554157535611 +1642039555157192011 +1642039556157216812 +1642039557157549364 +1642039558157385636 +1642039559157263754 +1642039560157235749 +1642039561157438190 +1642039562157372451 +1642039563157427026 +1642039564157042436 +1642039565156704691 +1642039566156774239 +1642039567156809425 +1642039568157064183 +1642039569156730048 +1642039570156883115 +1642039571156716332 +1642039572156914565 +1642039573156567967 +1642039574156982331 +1642039575156599519 +1642039576156781859 +1642039577155649078 +1642039578156140418 +1642039579156710918 +1642039580156622463 +1642039581156633304 +1642039582156565615 +1642039583156637164 +1642039584156170795 +1642039585156311269 +1642039586156025663 +1642039587156515296 +1642039588156236811 +1642039589156074387 +1642039590156170198 +1642039591155880794 +1642039592156280728 +1642039593156114563 +1642039594155933740 +1642039595155882662 +1642039596155836205 +1642039597155450900 +1642039598155873204 +1642039599155875084 +1642039600155850396 +1642039601155587968 +1642039602155731461 +1642039603155625364 +1642039604155883743 +1642039605155744279 +1642039606155515324 +1642039607155385001 +1642039608155586855 +1642039609155779192 +1642039610155291284 +1642039611155535042 +1642039612155447827 +1642039613155373467 +1642039614155590401 +1642039615155411960 +1642039616155471005 +1642039617155494195 +1642039618155179066 +1642039619155350285 +1642039620155409713 +1642039621155021791 +1642039622155236387 +1642039623155449654 +1642039624154995323 +1642039625154963682 +1642039626154638326 +1642039627154169499 +1642039628154922072 +1642039629154830737 +1642039630154782305 +1642039631154907578 +1642039632154690839 +1642039633154727819 +1642039634154878176 +1642039635154778880 +1642039636154679042 +1642039637154464223 +1642039638154195973 +1642039639154617768 +1642039640154788843 +1642039641154785970 +1642039642154414178 +1642039643154307859 +1642039644154832584 +1642039645154441347 +1642039646154340175 +1642039647153884725 +1642039648154282108 +1642039649154142761 +1642039650154260796 +1642039651154423011 +1642039652154059838 +1642039653154051591 +1642039654154117946 +1642039655154075265 +1642039656154026492 +1642039657153523064 +1642039658154214973 +1642039659153888338 +1642039660153599738 +1642039661153731642 +1642039662153685195 +1642039663153891543 +1642039664153802127 +1642039665153794427 +1642039666153754408 +1642039667153326349 +1642039668153609266 +1642039669153467611 +1642039670153546950 +1642039671153293108 +1642039672153368767 +1642039673153389209 +1642039674153309564 +1642039675153966787 +1642039676153259455 +1642039677153199403 +1642039678153224756 +1642039679152764083 +1642039680152834903 +1642039681152748010 +1642039682152525846 +1642039683152791866 +1642039684152579091 +1642039685153150873 +1642039686152455468 +1642039687152126683 +1642039688152396239 +1642039689152402433 +1642039690152367376 +1642039691152981542 +1642039692153192693 +1642039693153180158 +1642039694152809334 +1642039695152630130 +1642039696153026132 +1642039697152810243 +1642039698152889641 +1642039699152954822 +1642039700152845305 +1642039701151777923 +1642039702151869205 +1642039703152182200 +1642039704152029853 +1642039705151750390 +1642039706151900373 +1642039707151840235 +1642039708151975571 +1642039709151921438 +1642039710151894093 +1642039711152189568 +1642039712151624841 +1642039713151388247 +1642039714151769781 +1642039715151504451 +1642039716151208360 +1642039717151089634 +1642039718151520863 +1642039719151498378 +1642039720151401239 +1642039721151266089 diff --git a/twist_sublog.txt b/twist_sublog.txt new file mode 100644 index 0000000..e179a63 --- /dev/null +++ b/twist_sublog.txt @@ -0,0 +1,200 @@ +1642001496772341563 +1642001497772346948 +1642001498772131974 +1642001499772118509 +1642001500772164652 +1642001501772099312 +1642001502772460458 +1642001503772110936 +1642001504771637865 +1642001505772004929 +1642001506771672089 +1642001507771883464 +1642001508771816265 +1642001509771753216 +1642001510771814375 +1642001511771732712 +1642001512771445767 +1642001513771601832 +1642001514771630120 +1642001515771507172 +1642001516771554859 +1642001517771401496 +1642001518771547187 +1642001519771534232 +1642001520771094423 +1642001521771538875 +1642001522771588906 +1642001523771440277 +1642001524771187056 +1642001525771132426 +1642001526771340943 +1642001527771177305 +1642001528771223253 +1642001529771121728 +1642001530771079342 +1642001531770383040 +1642001532770211786 +1642001533770691556 +1642001534770278353 +1642001535771019981 +1642001536770913209 +1642001537770913239 +1642001538770865693 +1642001539770654203 +1642001540770810485 +1642001541770382148 +1642001542770234713 +1642001543770494849 +1642001544770042132 +1642001545770489487 +1642001546770531780 +1642001547770374390 +1642001548770460977 +1642001549770373716 +1642001550770401641 +1642001551770307659 +1642001552770297265 +1642001553769709185 +1642001554770529734 +1642001555770250947 +1642001556770202800 +1642001557770281599 +1642001558770114542 +1642001559770125521 +1642001560770334937 +1642001561770181838 +1642001562770041508 +1642001563770186008 +1642001564770087289 +1642001565769882309 +1642001566769865679 +1642001567769953805 +1642001568769840758 +1642001569769921497 +1642001570769849625 +1642001571770010890 +1642001572769835051 +1642001573769889146 +1642001574769720131 +1642001575769679204 +1642001576769649083 +1642001577769687173 +1642001578769636987 +1642001579769683132 +1642001580769595530 +1642001581769501361 +1642001582769615868 +1642001583769459596 +1642001584769192731 +1642001585769083460 +1642001586769169856 +1642001587769032568 +1642001588769186078 +1642001589769209411 +1642001590768507997 +1642001591769108879 +1642001592769264815 +1642001593769075768 +1642001594769092339 +1642001595768998497 +1642001596769045001 +1642001597768970619 +1642001598768944552 +1642001599768862755 +1642001600768956917 +1642001601768707454 +1642001602769033557 +1642001603768846137 +1642001604768666099 +1642001605768590389 +1642001606768515100 +1642001607768605547 +1642001608768723353 +1642001609768485070 +1642001610768536874 +1642001611768499141 +1642001612768442694 +1642001613768401933 +1642001614768442049 +1642001615768393875 +1642001616768319770 +1642001617768277427 +1642001618768236609 +1642001619768522542 +1642001620768138823 +1642001621768151381 +1642001622768146587 +1642001623767805560 +1642001624768123309 +1642001625768158306 +1642001626767844120 +1642001627767758405 +1642001628767832372 +1642001629767886020 +1642001630767843271 +1642001631767874200 +1642001632767841457 +1642001633767699690 +1642001634767640493 +1642001635767715002 +1642001636767719399 +1642001637767810380 +1642001638767759124 +1642001639767743457 +1642001640767440881 +1642001641767434458 +1642001642767648193 +1642001643767431660 +1642001644767419373 +1642001645767474520 +1642001646767303675 +1642001647767354320 +1642001648767226600 +1642001649767240940 +1642001650767144908 +1642001651767185108 +1642001652767186402 +1642001653767110427 +1642001654767220299 +1642001655767065682 +1642001656766948861 +1642001657767077888 +1642001658767126231 +1642001659766851374 +1642001660767155802 +1642001661767078993 +1642001662766899022 +1642001663766944636 +1642001664766771082 +1642001665766831634 +1642001666766527413 +1642001667766549370 +1642001668766781500 +1642001669766554103 +1642001670766576944 +1642001671766384327 +1642001672766448183 +1642001673766615366 +1642001674766558987 +1642001675766201231 +1642001676766218180 +1642001677766178769 +1642001678766568109 +1642001679766449958 +1642001680766261625 +1642001681766236473 +1642001682766219128 +1642001683766295515 +1642001684766014738 +1642001685766201572 +1642001686766070394 +1642001687766061324 +1642001688766277255 +1642001689765896121 +1642001690766117426 +1642001691766390226 +1642001692766374905 +1642001693766339163 +1642001694766355896 +1642001695766043069 From f402f4d0164eb1e5512230ffaeba42c2b8fbca8f Mon Sep 17 00:00:00 2001 From: MEIP-users Date: Fri, 14 Jan 2022 00:39:32 +0900 Subject: [PATCH 48/56] prepared the environment for latency measurement --- mros2_echoback_string_eval/CMakeLists.txt | 62 +++ .../launch/launch_pubsub.py | 21 + mros2_echoback_string_eval/package.xml | 21 + mros2_echoback_string_eval/src/pub_node.cpp | 54 +++ mros2_echoback_string_eval/src/sub_node.cpp | 51 +++ .../src/pub_node.cpp | 7 +- .../src/sub_node.cpp | 25 +- .../src/pub_node.cpp | 7 +- .../src/sub_node.cpp | 34 +- twist_publog.txt | 400 +++++++++--------- twist_string_publog.txt | 400 +++++++++--------- twist_string_sublog.txt | 400 +++++++++--------- twist_sublog.txt | 400 +++++++++--------- 13 files changed, 1051 insertions(+), 831 deletions(-) create mode 100644 mros2_echoback_string_eval/CMakeLists.txt create mode 100644 mros2_echoback_string_eval/launch/launch_pubsub.py create mode 100644 mros2_echoback_string_eval/package.xml create mode 100644 mros2_echoback_string_eval/src/pub_node.cpp create mode 100644 mros2_echoback_string_eval/src/sub_node.cpp diff --git a/mros2_echoback_string_eval/CMakeLists.txt b/mros2_echoback_string_eval/CMakeLists.txt new file mode 100644 index 0000000..224572e --- /dev/null +++ b/mros2_echoback_string_eval/CMakeLists.txt @@ -0,0 +1,62 @@ +cmake_minimum_required(VERSION 3.5) +project(mros2_echoback_string) + + +# Default to C99 +if(NOT CMAKE_C_STANDARD) + set(CMAKE_C_STANDARD 99) +endif() + +# Default to C++14 +if(NOT CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 14) +endif() + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +# find dependencies +find_package(ament_cmake REQUIRED) +find_package(rclcpp REQUIRED) +find_package(std_msgs REQUIRED) +# uncomment the following section in order to fill in +# further dependencies manually. +# find_package( REQUIRED) + +add_executable(pub_node src/pub_node.cpp) +ament_target_dependencies(pub_node rclcpp std_msgs) + +add_executable(sub_node src/sub_node.cpp) +ament_target_dependencies(sub_node rclcpp std_msgs) + +target_include_directories(pub_node PUBLIC + $ + $) + +target_include_directories(sub_node PUBLIC + $ + $) + +install(TARGETS pub_node + DESTINATION lib/${PROJECT_NAME}) +install(TARGETS sub_node + DESTINATION lib/${PROJECT_NAME}) + +install(DIRECTORY + launch + DESTINATION share/${PROJECT_NAME} +) + +if(BUILD_TESTING) + find_package(ament_lint_auto REQUIRED) + # the following line skips the linter which checks for copyrights + # uncomment the line when a copyright and license is not present in all source files + #set(ament_cmake_copyright_FOUND TRUE) + # the following line skips cpplint (only works in a git repo) + # uncomment the line when this package is not in a git repo + #set(ament_cmake_cpplint_FOUND TRUE) + ament_lint_auto_find_test_dependencies() +endif() + +ament_package() diff --git a/mros2_echoback_string_eval/launch/launch_pubsub.py b/mros2_echoback_string_eval/launch/launch_pubsub.py new file mode 100644 index 0000000..a7564f2 --- /dev/null +++ b/mros2_echoback_string_eval/launch/launch_pubsub.py @@ -0,0 +1,21 @@ +from launch import LaunchDescription +from launch_ros.actions import Node + +# Note: `node_`, `prefix` and `output` will be removed on Foxy +def generate_launch_description(): + return LaunchDescription([ + Node( + package='mros2_echoback_string', + node_executable='pub_node', + node_name='pub_mros2', + prefix=['stdbuf -o L'], + output="screen" + ), + Node( + package='mros2_echoback_string', + node_executable='sub_node', + node_name='mros2_sub', + prefix=['stdbuf -o L'], + output="screen" + ) + ]) diff --git a/mros2_echoback_string_eval/package.xml b/mros2_echoback_string_eval/package.xml new file mode 100644 index 0000000..bf58925 --- /dev/null +++ b/mros2_echoback_string_eval/package.xml @@ -0,0 +1,21 @@ + + + + mros2_echoback_string + 0.0.0 + TODO: Package description + uden + TODO: License declaration + + ament_cmake +rclcpp +std_msgs +rclcpp +std_msgs + ament_lint_auto + ament_lint_common + + + ament_cmake + + diff --git a/mros2_echoback_string_eval/src/pub_node.cpp b/mros2_echoback_string_eval/src/pub_node.cpp new file mode 100644 index 0000000..b26f7df --- /dev/null +++ b/mros2_echoback_string_eval/src/pub_node.cpp @@ -0,0 +1,54 @@ +#include +#include +#include +#include +#include + +#include "rclcpp/rclcpp.hpp" +#include "std_msgs/msg/string.hpp" + +using namespace std::chrono_literals; + +/* This example creates a subclass of Node and uses std::bind() to register a +* member function as a callback from the timer. */ + +class Publisher : public rclcpp::Node +{ +public: + Publisher() + : Node("pub_mros2"), count_(0) + { + publisher_ = this->create_publisher("to_stm", 10); + timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); + } + +private: + void timer_callback() + { + if(count_ < 200){ + auto message = std_msgs::msg::String(); + message.data = "!"; + publogs[count_] = this->get_clock()->now(); + publisher_->publish(message); + } else if (count_ == 200){ + std::ofstream writing_file; + std::string filename = "string_publog.txt"; + writing_file.open(filename, std::ios::out); + for (int i=0; i<200; i++){ + const std::string writing_text = std::to_string(publogs[i].nanoseconds()); + writing_file << writing_text << std::endl; + } + } + } + rclcpp::TimerBase::SharedPtr timer_; + rclcpp::Publisher::SharedPtr publisher_; + size_t count_; +}; + +int main(int argc, char * argv[]) +{ + rclcpp::init(argc, argv); + rclcpp::spin(std::make_shared()); + rclcpp::shutdown(); + return 0; +} diff --git a/mros2_echoback_string_eval/src/sub_node.cpp b/mros2_echoback_string_eval/src/sub_node.cpp new file mode 100644 index 0000000..6c4ff86 --- /dev/null +++ b/mros2_echoback_string_eval/src/sub_node.cpp @@ -0,0 +1,51 @@ +#include +#include +#include +#include +#include + +#include "rclcpp/rclcpp.hpp" +#include "std_msgs/msg/string.hpp" + +using std::placeholders::_1; + +class Subscriber : public rclcpp::Node +{ +public: + uint32_t count_ = 0; + Subscriber() : Node("mros2_sub") + { + subscriber_ = this->create_subscription("to_linux", rclcpp::QoS(10).best_effort(), std::bind(&Subscriber::topic_callback, this, _1)); + } + +private: + std::array sublogs; + void topic_callback(const std_msgs::msg::String::SharedPtr msg) const + { + rclcpp::Time now = this->get_clock()->now(); + if (count_ < 200){ + sublogs[count_] = now; + auto subscribed_message = std_msgs::msg::String(); + subscribed_message = *msg; + count_++; + } else { + std::ofstream writing_file; + std::string filename = "string_sublog.txt"; + writing_file.open(filename, std::ios::out); + for (int i=0; i<200; i++){ + const std::string writing_text = std::to_string(sublogs[i].nanoseconds()); + writing_file << writing_text << std::endl; + } + } + } + rclcpp::Subscription::SharedPtr subscriber_; +}; + + +int main(int argc, char *argv[]) +{ + rclcpp::init(argc, argv); + rclcpp::spin(std::make_shared()); + rclcpp::shutdown(); + return 0; +} \ No newline at end of file diff --git a/mros2_echoback_twist _calc_time/src/pub_node.cpp b/mros2_echoback_twist _calc_time/src/pub_node.cpp index 95a6840..3ad1c27 100644 --- a/mros2_echoback_twist _calc_time/src/pub_node.cpp +++ b/mros2_echoback_twist _calc_time/src/pub_node.cpp @@ -23,10 +23,10 @@ class Publisher : public rclcpp::Node } private: - std::array publogs; + std::array publogs; void timer_callback() { - if (count_ < 200){ + if (count_ < 201){ auto message = geometry_msgs::msg::Twist(); publogs[count_] = this->get_clock()->now(); message.linear.x = count_++/10.0; @@ -36,8 +36,7 @@ class Publisher : public rclcpp::Node message.angular.y = count_/50.0; message.angular.z = count_/50.0; publisher_->publish(message); - } else if (count_ == 200) { - RCLCPP_INFO(this->get_logger(),"Finished 200 messages!!"); + } else if (count_ == 201) { std::ofstream writing_file; std::string filename = "twist_publog.txt"; writing_file.open(filename, std::ios::out); diff --git a/mros2_echoback_twist _calc_time/src/sub_node.cpp b/mros2_echoback_twist _calc_time/src/sub_node.cpp index 08e2050..e40b472 100644 --- a/mros2_echoback_twist _calc_time/src/sub_node.cpp +++ b/mros2_echoback_twist _calc_time/src/sub_node.cpp @@ -12,23 +12,30 @@ using std::placeholders::_1; class Subscriber : public rclcpp::Node { public: + uint32_t count_ = 0; Subscriber() : Node("mros2_sub") { subscriber_ = this->create_subscription("to_linux", rclcpp::QoS(10).best_effort(), std::bind(&Subscriber::topic_callback, this, _1)); } private: + std::array sublogs; void topic_callback(const geometry_msgs::msg::Twist::SharedPtr message) { - auto subscribed_message = geometry_msgs::msg::Twist(); - subscribed_message = *message; - - rclcpp::Time now = this->get_clock()->now(); - std::ofstream writing_file; - std::string filename = "twist_sublog.txt"; - writing_file.open(filename, std::ios::app); - const std::string writing_text = std::to_string(now.nanoseconds()); - writing_file << writing_text << std::endl; + if (count_ < 200){ + auto subscribed_message = geometry_msgs::msg::Twist(); + subscribed_message = *message; + sublogs[count_] = this->get_clock()->now(); + count_++; + } else { + std::ofstream writing_file; + std::string filename = "twist_sublog.txt"; + writing_file.open(filename, std::ios::out); + for (int i=0; i<200; i++){ + const std::string writing_text = std::to_string(sublogs[i].nanoseconds()); + writing_file << writing_text << std::endl; + } + } } rclcpp::Subscription::SharedPtr subscriber_; }; diff --git a/mros2_echoback_twist_string_calc_time/src/pub_node.cpp b/mros2_echoback_twist_string_calc_time/src/pub_node.cpp index 4c1c25a..ea32f60 100644 --- a/mros2_echoback_twist_string_calc_time/src/pub_node.cpp +++ b/mros2_echoback_twist_string_calc_time/src/pub_node.cpp @@ -24,10 +24,10 @@ class Publisher : public rclcpp::Node } private: - std::array publogs; + std::array publogs; void timer_callback() { - if (count_ < 200){ + if (count_ < 201){ auto message = geometry_msgs::msg::Twist(); auto converted_message = std_msgs::msg::String(); publogs[count_] = this->get_clock()->now(); @@ -39,8 +39,7 @@ class Publisher : public rclcpp::Node message.angular.z = count_/50.0; converted_message.data = std::to_string(message.linear.x) + std::to_string(message.linear.y) + std::to_string(message.linear.z) + std::to_string(message.angular.x) + std::to_string(message.angular.y) + std::to_string(message.angular.z); publisher_->publish(converted_message); - } else if (count_ == 200) { - RCLCPP_INFO(this->get_logger(),"Finished 200 messages!!"); + } else if (count_ == 201) { std::ofstream writing_file; std::string filename = "twist_string_publog.txt"; writing_file.open(filename, std::ios::out); diff --git a/mros2_echoback_twist_string_calc_time/src/sub_node.cpp b/mros2_echoback_twist_string_calc_time/src/sub_node.cpp index 3523264..7b5dea6 100644 --- a/mros2_echoback_twist_string_calc_time/src/sub_node.cpp +++ b/mros2_echoback_twist_string_calc_time/src/sub_node.cpp @@ -15,6 +15,7 @@ using std::placeholders::_1; class Subscriber : public rclcpp::Node { public: + uint32_t count_ = 0; Subscriber() : Node("mros2_sub") { subscriber_ = this->create_subscription("to_linux", rclcpp::QoS(10).best_effort(), std::bind(&Subscriber::topic_callback, this, _1)); @@ -24,20 +25,25 @@ class Subscriber : public rclcpp::Node std::array sublogs; void topic_callback(const std_msgs::msg::String::SharedPtr message) { - auto reconverted_message = geometry_msgs::msg::Twist(); - reconverted_message.linear.x = std::stod(message->data.substr(0,8)); - reconverted_message.linear.y = std::stod(message->data.substr(8,8)); - reconverted_message.linear.z = std::stod(message->data.substr(16,8)); - reconverted_message.angular.x = std::stod(message->data.substr(24,8)); - reconverted_message.angular.y = std::stod(message->data.substr(32,8)); - reconverted_message.angular.z = std::stod(message->data.substr(40,8)); - - rclcpp::Time now = this->get_clock()->now(); - std::ofstream writing_file; - std::string filename = "twist_string_sublog.txt"; - writing_file.open(filename, std::ios::app); - const std::string writing_text = std::to_string(now.nanoseconds()); - writing_file << writing_text << std::endl; + if (count_ < 200){ + auto reconverted_message = geometry_msgs::msg::Twist(); + reconverted_message.linear.x = std::stod(message->data.substr(0,8)); + reconverted_message.linear.y = std::stod(message->data.substr(8,8)); + reconverted_message.linear.z = std::stod(message->data.substr(16,8)); + reconverted_message.angular.x = std::stod(message->data.substr(24,8)); + reconverted_message.angular.y = std::stod(message->data.substr(32,8)); + reconverted_message.angular.z = std::stod(message->data.substr(40,8)); + sublogs[count_] = this->get_clock()->now(); + count_++; + } else { + std::ofstream writing_file; + std::string filename = "twist_string_sublog.txt"; + writing_file.open(filename, std::ios::out); + for (int i=0; i<200; i++){ + const std::string writing_text = std::to_string(sublogs[i].nanoseconds()); + writing_file << writing_text << std::endl; + } + } } rclcpp::Subscription::SharedPtr subscriber_; }; diff --git a/twist_publog.txt b/twist_publog.txt index 7d04c74..da49b7f 100644 --- a/twist_publog.txt +++ b/twist_publog.txt @@ -1,200 +1,200 @@ -1642001496771276214 -1642001497771403052 -1642001498771221779 -1642001499771206147 -1642001500771276931 -1642001501771152708 -1642001502771194482 -1642001503771231067 -1642001504770827635 -1642001505771099665 -1642001506770936294 -1642001507770940636 -1642001508770895089 -1642001509770858962 -1642001510770828752 -1642001511770799940 -1642001512770645458 -1642001513770733984 -1642001514770684191 -1642001515770580712 -1642001516770621195 -1642001517770487132 -1642001518770648568 -1642001519770546087 -1642001520770378154 -1642001521770615495 -1642001522770584811 -1642001523770416263 -1642001524770219219 -1642001525770229769 -1642001526770295396 -1642001527770199273 -1642001528770248396 -1642001529770134004 -1642001530770101789 -1642001531769925329 -1642001532769864129 -1642001533769981899 -1642001534769834308 -1642001535769927992 -1642001536769904331 -1642001537769872149 -1642001538769824041 -1642001539769788754 -1642001540769817168 -1642001541769679667 -1642001542769631673 -1642001543769652095 -1642001544769499593 -1642001545769582482 -1642001546769555030 -1642001547769556277 -1642001548769516030 -1642001549769433991 -1642001550769353523 -1642001551769324086 -1642001552769302858 -1642001553769221612 -1642001554769538670 -1642001555769271664 -1642001556769223196 -1642001557769292483 -1642001558769176508 -1642001559769139189 -1642001560769342933 -1642001561769199042 -1642001562769146383 -1642001563769150881 -1642001564768923473 -1642001565768968019 -1642001566768952364 -1642001567768986884 -1642001568768972760 -1642001569768947859 -1642001570768904549 -1642001571768960922 -1642001572768818315 -1642001573768943595 -1642001574768742927 -1642001575768690217 -1642001576768644564 -1642001577768664754 -1642001578768643313 -1642001579768663796 -1642001580768637892 -1642001581768532311 -1642001582768616687 -1642001583768467468 -1642001584768283433 -1642001585768207926 -1642001586768317781 -1642001587768164765 -1642001588768172609 -1642001589768216866 -1642001590768017627 -1642001591768199252 -1642001592768166953 -1642001593768128820 -1642001594768099961 -1642001595767945559 -1642001596768030558 -1642001597767969883 -1642001598767853252 -1642001599767906025 -1642001600767904728 -1642001601767673027 -1642001602767953673 -1642001603767795502 -1642001604767760493 -1642001605767686859 -1642001606767599832 -1642001607767673022 -1642001608767733612 -1642001609767577027 -1642001610767547529 -1642001611767535995 -1642001612767503122 -1642001613767467312 -1642001614767444583 -1642001615767398281 -1642001616767363006 -1642001617767317279 -1642001618767311492 -1642001619767239451 -1642001620767140582 -1642001621767206983 -1642001622767177555 -1642001623767088072 -1642001624767227288 -1642001625767232141 -1642001626766935831 -1642001627766847008 -1642001628766965675 -1642001629766925321 -1642001630766905009 -1642001631766870739 -1642001632766858394 -1642001633766778645 -1642001634766678009 -1642001635766739399 -1642001636766797278 -1642001637766804427 -1642001638766767929 -1642001639766759967 -1642001640766557468 -1642001641766436734 -1642001642766662899 -1642001643766465871 -1642001644766448259 -1642001645766496115 -1642001646766276047 -1642001647766330548 -1642001648766237330 -1642001649766203451 -1642001650766169754 -1642001651766196417 -1642001652766091981 -1642001653766069517 -1642001654766195163 -1642001655766008728 -1642001656766003128 -1642001657766013865 -1642001658766072321 -1642001659765857734 -1642001660766044812 -1642001661766016984 -1642001662765999141 -1642001663765983602 -1642001664765779438 -1642001665765871935 -1642001666765623801 -1642001667765580103 -1642001668765742137 -1642001669765556642 -1642001670765576696 -1642001671765385995 -1642001672765412221 -1642001673765623326 -1642001674765564250 -1642001675765250151 -1642001676765225377 -1642001677765190236 -1642001678765498209 -1642001679765453869 -1642001680765205623 -1642001681765182655 -1642001682765187514 -1642001683765297304 -1642001684765021532 -1642001685765135976 -1642001686765123486 -1642001687764963028 -1642001688764918763 -1642001689765014246 -1642001690765036153 -1642001691765032288 -1642001692765006988 -1642001693764969692 -1642001694764981267 -1642001695764623741 +1642086629580083377 +1642086630580071656 +1642086631579940352 +1642086632579650592 +1642086633579784626 +1642086634579727504 +1642086635579886210 +1642086636579820991 +1642086637579643110 +1642086638579845142 +1642086639579874883 +1642086640579735256 +1642086641579835049 +1642086642579932453 +1642086643579922051 +1642086644579794219 +1642086645579794372 +1642086646579878825 +1642086647579614089 +1642086648579596002 +1642086649579784823 +1642086650579760181 +1642086651579746486 +1642086652579719307 +1642086653579563115 +1642086654579603899 +1642086655579601147 +1642086656579711003 +1642086657579488154 +1642086658579692377 +1642086659579661044 +1642086660579651971 +1642086661579736818 +1642086662579657217 +1642086663579541415 +1642086664579638430 +1642086665579559401 +1642086666579609197 +1642086667579513526 +1642086668579593953 +1642086669579452617 +1642086670579434967 +1642086671579755094 +1642086672579472408 +1642086673579478403 +1642086674579452830 +1642086675579542068 +1642086676579550458 +1642086677579540476 +1642086678579530203 +1642086679579528521 +1642086680579522855 +1642086681579526922 +1642086682579495125 +1642086683579479965 +1642086684579485654 +1642086685579579940 +1642086686579619671 +1642086687579424419 +1642086688579476678 +1642086689579361820 +1642086690579572738 +1642086691579591264 +1642086692579570209 +1642086693579506993 +1642086694579250464 +1642086695579374606 +1642086696579296868 +1642086697579374245 +1642086698579361143 +1642086699579326301 +1642086700579240203 +1642086701579346858 +1642086702579331342 +1642086703579455900 +1642086704579233879 +1642086705579238447 +1642086706579105182 +1642086707579192685 +1642086708579437050 +1642086709579256733 +1642086710579178764 +1642086711579260080 +1642086712579359552 +1642086713579396730 +1642086714579063753 +1642086715579115224 +1642086716579213439 +1642086717579228775 +1642086718579141803 +1642086719579120587 +1642086720579181855 +1642086721579062269 +1642086722579089378 +1642086723579161881 +1642086724579290910 +1642086725579133556 +1642086726579320315 +1642086727579218060 +1642086728579052620 +1642086729579123116 +1642086730579203762 +1642086731579023653 +1642086732579006765 +1642086733579079646 +1642086734578987567 +1642086735578924932 +1642086736578956804 +1642086737579052695 +1642086738578898708 +1642086739578903540 +1642086740579038893 +1642086741578917135 +1642086742578929690 +1642086743578924423 +1642086744579154038 +1642086745578910305 +1642086746579134279 +1642086747578858208 +1642086748579016659 +1642086749578827166 +1642086750578774293 +1642086751578746329 +1642086752578817454 +1642086753578779769 +1642086754578775852 +1642086755578716663 +1642086756578744042 +1642086757578814507 +1642086758578801643 +1642086759578811666 +1642086760578768995 +1642086761578775191 +1642086762578738275 +1642086763578987679 +1642086764578927666 +1642086765578729917 +1642086766578939970 +1642086767578679936 +1642086768578671793 +1642086769578552399 +1642086770578659409 +1642086771578603381 +1642086772578644496 +1642086773578644183 +1642086774578631281 +1642086775578531189 +1642086776578575836 +1642086777578578115 +1642086778578615010 +1642086779578629926 +1642086780578636700 +1642086781578614721 +1642086782578557777 +1642086783578661207 +1642086784578822326 +1642086785578497366 +1642086786578804407 +1642086787578497131 +1642086788578791269 +1642086789578736686 +1642086790578771034 +1642086791578788554 +1642086792578727116 +1642086793578736776 +1642086794578721322 +1642086795578472255 +1642086796578387357 +1642086797578369775 +1642086798578416796 +1642086799578487251 +1642086800578365757 +1642086801578642879 +1642086802578316461 +1642086803578448420 +1642086804578356402 +1642086805578350533 +1642086806578380337 +1642086807578226506 +1642086808578299134 +1642086809578264760 +1642086810578265775 +1642086811578194110 +1642086812578230351 +1642086813578245421 +1642086814578245870 +1642086815578253137 +1642086816578245577 +1642086817578266544 +1642086818578219618 +1642086819578232719 +1642086820578175103 +1642086821578240023 +1642086822578172016 +1642086823578185735 +1642086824578135708 +1642086825578487155 +1642086826578123278 +1642086827578119067 +1642086828578111843 diff --git a/twist_string_publog.txt b/twist_string_publog.txt index 73adaeb..cc32212 100644 --- a/twist_string_publog.txt +++ b/twist_string_publog.txt @@ -1,200 +1,200 @@ -1642039522157315026 -1642039523157268443 -1642039524156957259 -1642039525156952105 -1642039526156964118 -1642039527156925434 -1642039528156900634 -1642039529156839366 -1642039530156833667 -1642039531156708340 -1642039532156767298 -1642039533156704672 -1642039534156699025 -1642039535156620988 -1642039536156619098 -1642039537156564077 -1642039538156522478 -1642039539156463467 -1642039540156370685 -1642039541156440948 -1642039542156682926 -1642039543156344535 -1642039544156253957 -1642039545156275536 -1642039546156361226 -1642039547156254313 -1642039548156325036 -1642039549156201898 -1642039550156168402 -1642039551156045289 -1642039552156013215 -1642039553156303792 -1642039554156246791 -1642039555155985948 -1642039556155975799 -1642039557156160059 -1642039558156152970 -1642039559155995917 -1642039560156036111 -1642039561156049866 -1642039562155982136 -1642039563156030172 -1642039564155908275 -1642039565155657378 -1642039566155553234 -1642039567155704913 -1642039568155660392 -1642039569155769577 -1642039570155625028 -1642039571155574606 -1642039572155663099 -1642039573155550825 -1642039574155589982 -1642039575155348627 -1642039576155513152 -1642039577155125550 -1642039578155234363 -1642039579155420894 -1642039580155383368 -1642039581155396037 -1642039582155336573 -1642039583155278303 -1642039584155154441 -1642039585155251747 -1642039586154965916 -1642039587155135631 -1642039588155009527 -1642039589154866527 -1642039590154958463 -1642039591154794977 -1642039592154887141 -1642039593154768421 -1642039594154821561 -1642039595154795981 -1642039596154761650 -1642039597154646815 -1642039598154504650 -1642039599154647207 -1642039600154595600 -1642039601154479560 -1642039602154531223 -1642039603154506722 -1642039604154635673 -1642039605154609604 -1642039606154255828 -1642039607154216120 -1642039608154344563 -1642039609154322686 -1642039610154233250 -1642039611154258093 -1642039612154207968 -1642039613154104158 -1642039614154261046 -1642039615154275173 -1642039616154103142 -1642039617154168981 -1642039618154038808 -1642039619154104047 -1642039620154145076 -1642039621153934199 -1642039622153878462 -1642039623154020918 -1642039624153824683 -1642039625153903065 -1642039626153662083 -1642039627153610946 -1642039628153602695 -1642039629153660826 -1642039630153631977 -1642039631153731301 -1642039632153482143 -1642039633153533910 -1642039634153503744 -1642039635153596254 -1642039636153340291 -1642039637153261395 -1642039638153273249 -1642039639153446801 -1642039640153424247 -1642039641153410829 -1642039642153255092 -1642039643153087442 -1642039644153346062 -1642039645153285769 -1642039646153252737 -1642039647152948896 -1642039648152954462 -1642039649152926056 -1642039650152890413 -1642039651153066206 -1642039652152888636 -1642039653153021714 -1642039654152782549 -1642039655152731992 -1642039656152661592 -1642039657152622621 -1642039658152851960 -1642039659152660766 -1642039660152577217 -1642039661152508748 -1642039662152511322 -1642039663152683496 -1642039664152401117 -1642039665152392174 -1642039666152642196 -1642039667152332408 -1642039668152271652 -1642039669152175330 -1642039670152459070 -1642039671152114407 -1642039672152150484 -1642039673152082852 -1642039674152036457 -1642039675152279834 -1642039676151943415 -1642039677151972237 -1642039678152002313 -1642039679151857767 -1642039680151868159 -1642039681151863276 -1642039682151758882 -1642039683151778507 -1642039684151769750 -1642039685151853487 -1642039686151610622 -1642039687151522712 -1642039688151586081 -1642039689151569020 -1642039690151548671 -1642039691151642878 -1642039692151754895 -1642039693151743160 -1642039694151545712 -1642039695151511796 -1642039696151591005 -1642039697151460976 -1642039698151530051 -1642039699151467097 -1642039700151353289 -1642039701151092101 -1642039702151111004 -1642039703151178823 -1642039704151025879 -1642039705150983541 -1642039706151075435 -1642039707150926945 -1642039708150944281 -1642039709150861301 -1642039710150902180 -1642039711150972064 -1642039712150818127 -1642039713150713760 -1642039714150735010 -1642039715150634866 -1642039716150567750 -1642039717150547496 -1642039718150624218 -1642039719150510793 -1642039720150487068 -1642039721150433452 +1642086275756968173 +1642086276756954128 +1642086277757022962 +1642086278756916323 +1642086279757006626 +1642086280757008151 +1642086281757000155 +1642086282757000284 +1642086283756995748 +1642086284756977934 +1642086285756960347 +1642086286757051533 +1642086287756842399 +1642086288756852300 +1642086289757076755 +1642086290756932671 +1642086291756930606 +1642086292757042803 +1642086293756886310 +1642086294756896650 +1642086295756893007 +1642086296756982770 +1642086297757014706 +1642086298756711872 +1642086299756771413 +1642086300756789105 +1642086301756846537 +1642086302756812721 +1642086303756819396 +1642086304756771196 +1642086305756817660 +1642086306756687262 +1642086307756805414 +1642086308756735238 +1642086309756901849 +1642086310756882433 +1642086311756753783 +1642086312756736243 +1642086313756590185 +1642086314756873567 +1642086315756736986 +1642086316756707910 +1642086317756857606 +1642086318756535967 +1642086319756576808 +1642086320756784108 +1642086321756648516 +1642086322756566399 +1642086323756638563 +1642086324756663140 +1642086325756643193 +1642086326756628954 +1642086327756519837 +1642086328756629276 +1642086329756599758 +1642086330756753872 +1642086331756671076 +1642086332756725845 +1642086333756549203 +1642086334756721783 +1642086335756506084 +1642086336756568359 +1642086337756652938 +1642086338756512283 +1642086339756395364 +1642086340756512608 +1642086341756511946 +1642086342756504867 +1642086343756385479 +1642086344756504087 +1642086345756591893 +1642086346756484065 +1642086347756585201 +1642086348756476846 +1642086349756397098 +1642086350756536832 +1642086351756556281 +1642086352756438705 +1642086353756420205 +1642086354756446470 +1642086355756404388 +1642086356756194981 +1642086357756194106 +1642086358756178833 +1642086359756223264 +1642086360756177815 +1642086361756155282 +1642086362756250471 +1642086363756141514 +1642086364756152939 +1642086365756133828 +1642086366756150937 +1642086367756141788 +1642086368756109689 +1642086369756038794 +1642086370756176803 +1642086371756421686 +1642086372756089766 +1642086373756237088 +1642086374756127153 +1642086375756088153 +1642086376756377651 +1642086377756060551 +1642086378756054491 +1642086379755985989 +1642086380756071768 +1642086381756161286 +1642086382756063547 +1642086383756007685 +1642086384756184723 +1642086385755975527 +1642086386756046253 +1642086387756019922 +1642086388756138030 +1642086389756018742 +1642086390756008731 +1642086391755882925 +1642086392755911151 +1642086393755896493 +1642086394755897389 +1642086395755928922 +1642086396755895438 +1642086397756038692 +1642086398755869098 +1642086399756081362 +1642086400755927534 +1642086401755932327 +1642086402755832860 +1642086403755982036 +1642086404755986635 +1642086405755838105 +1642086406755984327 +1642086407755843690 +1642086408755880729 +1642086409755967223 +1642086410756111727 +1642086411755825746 +1642086412755698119 +1642086413755699855 +1642086414755792433 +1642086415755925692 +1642086416755895152 +1642086417755789678 +1642086418755646668 +1642086419755734504 +1642086420755744050 +1642086421755731443 +1642086422755766156 +1642086423755722042 +1642086424755712213 +1642086425755693571 +1642086426755818479 +1642086427755625379 +1642086428755692199 +1642086429755785957 +1642086430755642249 +1642086431755548262 +1642086432755778994 +1642086433755607441 +1642086434755687527 +1642086435755741742 +1642086436755743180 +1642086437755750073 +1642086438755830577 +1642086439755847113 +1642086440755663028 +1642086441755594936 +1642086442755703271 +1642086443755680393 +1642086444755683250 +1642086445755698262 +1642086446755681998 +1642086447755541503 +1642086448755638932 +1642086449755767791 +1642086450755641762 +1642086451755624417 +1642086452755511871 +1642086453755593011 +1642086454755598091 +1642086455755520545 +1642086456755587172 +1642086457755483437 +1642086458755584063 +1642086459755584514 +1642086460755560893 +1642086461755362079 +1642086462755416149 +1642086463755398797 +1642086464755521955 +1642086465755402604 +1642086466755390404 +1642086467755441605 +1642086468755492884 +1642086469755466409 +1642086470755382190 +1642086471755389353 +1642086472755317425 +1642086473755362920 +1642086474755368099 diff --git a/twist_string_sublog.txt b/twist_string_sublog.txt index 55014f4..9874b67 100644 --- a/twist_string_sublog.txt +++ b/twist_string_sublog.txt @@ -1,200 +1,200 @@ -1642039522158898790 -1642039523158293251 -1642039524158003701 -1642039525158066607 -1642039526158046240 -1642039527158107065 -1642039528158091748 -1642039529158238837 -1642039530158022161 -1642039531157890996 -1642039532157951332 -1642039533158103013 -1642039534157902346 -1642039535158012246 -1642039536157819785 -1642039537157754513 -1642039538157929787 -1642039539157648797 -1642039540157229969 -1642039541157665832 -1642039542157890996 -1642039543157326492 -1642039544157005362 -1642039545156776435 -1642039546157627634 -1642039547157345125 -1642039548157345743 -1642039549157410983 -1642039550157378865 -1642039551157253041 -1642039552157257552 -1642039553157512231 -1642039554157535611 -1642039555157192011 -1642039556157216812 -1642039557157549364 -1642039558157385636 -1642039559157263754 -1642039560157235749 -1642039561157438190 -1642039562157372451 -1642039563157427026 -1642039564157042436 -1642039565156704691 -1642039566156774239 -1642039567156809425 -1642039568157064183 -1642039569156730048 -1642039570156883115 -1642039571156716332 -1642039572156914565 -1642039573156567967 -1642039574156982331 -1642039575156599519 -1642039576156781859 -1642039577155649078 -1642039578156140418 -1642039579156710918 -1642039580156622463 -1642039581156633304 -1642039582156565615 -1642039583156637164 -1642039584156170795 -1642039585156311269 -1642039586156025663 -1642039587156515296 -1642039588156236811 -1642039589156074387 -1642039590156170198 -1642039591155880794 -1642039592156280728 -1642039593156114563 -1642039594155933740 -1642039595155882662 -1642039596155836205 -1642039597155450900 -1642039598155873204 -1642039599155875084 -1642039600155850396 -1642039601155587968 -1642039602155731461 -1642039603155625364 -1642039604155883743 -1642039605155744279 -1642039606155515324 -1642039607155385001 -1642039608155586855 -1642039609155779192 -1642039610155291284 -1642039611155535042 -1642039612155447827 -1642039613155373467 -1642039614155590401 -1642039615155411960 -1642039616155471005 -1642039617155494195 -1642039618155179066 -1642039619155350285 -1642039620155409713 -1642039621155021791 -1642039622155236387 -1642039623155449654 -1642039624154995323 -1642039625154963682 -1642039626154638326 -1642039627154169499 -1642039628154922072 -1642039629154830737 -1642039630154782305 -1642039631154907578 -1642039632154690839 -1642039633154727819 -1642039634154878176 -1642039635154778880 -1642039636154679042 -1642039637154464223 -1642039638154195973 -1642039639154617768 -1642039640154788843 -1642039641154785970 -1642039642154414178 -1642039643154307859 -1642039644154832584 -1642039645154441347 -1642039646154340175 -1642039647153884725 -1642039648154282108 -1642039649154142761 -1642039650154260796 -1642039651154423011 -1642039652154059838 -1642039653154051591 -1642039654154117946 -1642039655154075265 -1642039656154026492 -1642039657153523064 -1642039658154214973 -1642039659153888338 -1642039660153599738 -1642039661153731642 -1642039662153685195 -1642039663153891543 -1642039664153802127 -1642039665153794427 -1642039666153754408 -1642039667153326349 -1642039668153609266 -1642039669153467611 -1642039670153546950 -1642039671153293108 -1642039672153368767 -1642039673153389209 -1642039674153309564 -1642039675153966787 -1642039676153259455 -1642039677153199403 -1642039678153224756 -1642039679152764083 -1642039680152834903 -1642039681152748010 -1642039682152525846 -1642039683152791866 -1642039684152579091 -1642039685153150873 -1642039686152455468 -1642039687152126683 -1642039688152396239 -1642039689152402433 -1642039690152367376 -1642039691152981542 -1642039692153192693 -1642039693153180158 -1642039694152809334 -1642039695152630130 -1642039696153026132 -1642039697152810243 -1642039698152889641 -1642039699152954822 -1642039700152845305 -1642039701151777923 -1642039702151869205 -1642039703152182200 -1642039704152029853 -1642039705151750390 -1642039706151900373 -1642039707151840235 -1642039708151975571 -1642039709151921438 -1642039710151894093 -1642039711152189568 -1642039712151624841 -1642039713151388247 -1642039714151769781 -1642039715151504451 -1642039716151208360 -1642039717151089634 -1642039718151520863 -1642039719151498378 -1642039720151401239 -1642039721151266089 +1642086275758222672 +1642086276758062163 +1642086277758063593 +1642086278758355570 +1642086279758169290 +1642086280758125757 +1642086281758089845 +1642086282758160069 +1642086283758180291 +1642086284758195085 +1642086285758060132 +1642086286758244310 +1642086287758262737 +1642086288758106063 +1642086289758379323 +1642086290758027339 +1642086291758391548 +1642086292758145051 +1642086293758220660 +1642086294758122415 +1642086295758198819 +1642086296758442533 +1642086297758134427 +1642086298757932528 +1642086299758059243 +1642086300758055768 +1642086301758094431 +1642086302758022156 +1642086303757902191 +1642086304757842147 +1642086305757965995 +1642086306758113833 +1642086307758072296 +1642086308757499884 +1642086309758135500 +1642086310757903544 +1642086311758050803 +1642086312758041179 +1642086313757638762 +1642086314758181152 +1642086315758212768 +1642086316758017470 +1642086317758020833 +1642086318757643385 +1642086319757889658 +1642086320758024455 +1642086321757934905 +1642086322757913671 +1642086323757938895 +1642086324757932412 +1642086325757928040 +1642086326757813573 +1642086327757869862 +1642086328757914627 +1642086329757644296 +1642086330758197895 +1642086331758117730 +1642086332758001643 +1642086333757911752 +1642086334758051663 +1642086335757383369 +1642086336758087709 +1642086337757679973 +1642086338757587830 +1642086339757573825 +1642086340757818268 +1642086341757836614 +1642086342757545736 +1642086343757641371 +1642086344757812984 +1642086345758072072 +1642086346757927753 +1642086347757904777 +1642086348757798601 +1642086349757516184 +1642086350757878682 +1642086351758045374 +1642086352757943088 +1642086353757488400 +1642086354757674072 +1642086355757633193 +1642086356757097966 +1642086357757170296 +1642086358757068348 +1642086359757156265 +1642086360756975607 +1642086361757037617 +1642086362756771541 +1642086363757039551 +1642086364757063809 +1642086365757073669 +1642086366757043817 +1642086367757178866 +1642086368756968866 +1642086369756628086 +1642086370757626665 +1642086371757580363 +1642086372756854339 +1642086373757371332 +1642086374756926154 +1642086375756910542 +1642086376757893543 +1642086377757105675 +1642086378757005467 +1642086379756585278 +1642086380757000126 +1642086381757191925 +1642086382757032427 +1642086383756812953 +1642086384757444274 +1642086385756757713 +1642086386756862294 +1642086387756948308 +1642086388757367260 +1642086389756847623 +1642086390756821864 +1642086391756402441 +1642086392756873137 +1642086393756784135 +1642086394756935103 +1642086395756723350 +1642086396756730933 +1642086397757133412 +1642086398756617207 +1642086399757228502 +1642086400757311018 +1642086401756993594 +1642086402756664656 +1642086403757189190 +1642086404757153527 +1642086405756900123 +1642086406757217078 +1642086407756836658 +1642086408756956352 +1642086409757168926 +1642086410757274095 +1642086411756958721 +1642086412756191803 +1642086413756410930 +1642086414756772153 +1642086415757019252 +1642086416757061561 +1642086417756949189 +1642086418756180519 +1642086419756673475 +1642086420756746582 +1642086421756716882 +1642086422756803539 +1642086423756896512 +1642086424756724493 +1642086425756648154 +1642086426757110134 +1642086427756485388 +1642086428756540061 +1642086429757049013 +1642086430756691785 +1642086431756195815 +1642086432757213386 +1642086433756660409 +1642086434756569002 +1642086435757015091 +1642086436757022099 +1642086437757040987 +1642086438757009388 +1642086439757025007 +1642086440756733330 +1642086441756748487 +1642086442756928456 +1642086443757148137 +1642086444756946705 +1642086445757148352 +1642086446756907419 +1642086447756746250 +1642086448756861351 +1642086449756862744 +1642086450756731264 +1642086451756862773 +1642086452756948238 +1642086453756778162 +1642086454756839632 +1642086455756662739 +1642086456756743581 +1642086457756639764 +1642086458756807090 +1642086459756708633 +1642086460756665246 +1642086461756502844 +1642086462756550099 +1642086463756587197 +1642086464756649049 +1642086465756830033 +1642086466756626610 +1642086467756042103 +1642086468756706239 +1642086469756616129 +1642086470756607463 +1642086471756780599 +1642086472756465890 +1642086473756569404 +1642086474756578259 diff --git a/twist_sublog.txt b/twist_sublog.txt index e179a63..e31a671 100644 --- a/twist_sublog.txt +++ b/twist_sublog.txt @@ -1,200 +1,200 @@ -1642001496772341563 -1642001497772346948 -1642001498772131974 -1642001499772118509 -1642001500772164652 -1642001501772099312 -1642001502772460458 -1642001503772110936 -1642001504771637865 -1642001505772004929 -1642001506771672089 -1642001507771883464 -1642001508771816265 -1642001509771753216 -1642001510771814375 -1642001511771732712 -1642001512771445767 -1642001513771601832 -1642001514771630120 -1642001515771507172 -1642001516771554859 -1642001517771401496 -1642001518771547187 -1642001519771534232 -1642001520771094423 -1642001521771538875 -1642001522771588906 -1642001523771440277 -1642001524771187056 -1642001525771132426 -1642001526771340943 -1642001527771177305 -1642001528771223253 -1642001529771121728 -1642001530771079342 -1642001531770383040 -1642001532770211786 -1642001533770691556 -1642001534770278353 -1642001535771019981 -1642001536770913209 -1642001537770913239 -1642001538770865693 -1642001539770654203 -1642001540770810485 -1642001541770382148 -1642001542770234713 -1642001543770494849 -1642001544770042132 -1642001545770489487 -1642001546770531780 -1642001547770374390 -1642001548770460977 -1642001549770373716 -1642001550770401641 -1642001551770307659 -1642001552770297265 -1642001553769709185 -1642001554770529734 -1642001555770250947 -1642001556770202800 -1642001557770281599 -1642001558770114542 -1642001559770125521 -1642001560770334937 -1642001561770181838 -1642001562770041508 -1642001563770186008 -1642001564770087289 -1642001565769882309 -1642001566769865679 -1642001567769953805 -1642001568769840758 -1642001569769921497 -1642001570769849625 -1642001571770010890 -1642001572769835051 -1642001573769889146 -1642001574769720131 -1642001575769679204 -1642001576769649083 -1642001577769687173 -1642001578769636987 -1642001579769683132 -1642001580769595530 -1642001581769501361 -1642001582769615868 -1642001583769459596 -1642001584769192731 -1642001585769083460 -1642001586769169856 -1642001587769032568 -1642001588769186078 -1642001589769209411 -1642001590768507997 -1642001591769108879 -1642001592769264815 -1642001593769075768 -1642001594769092339 -1642001595768998497 -1642001596769045001 -1642001597768970619 -1642001598768944552 -1642001599768862755 -1642001600768956917 -1642001601768707454 -1642001602769033557 -1642001603768846137 -1642001604768666099 -1642001605768590389 -1642001606768515100 -1642001607768605547 -1642001608768723353 -1642001609768485070 -1642001610768536874 -1642001611768499141 -1642001612768442694 -1642001613768401933 -1642001614768442049 -1642001615768393875 -1642001616768319770 -1642001617768277427 -1642001618768236609 -1642001619768522542 -1642001620768138823 -1642001621768151381 -1642001622768146587 -1642001623767805560 -1642001624768123309 -1642001625768158306 -1642001626767844120 -1642001627767758405 -1642001628767832372 -1642001629767886020 -1642001630767843271 -1642001631767874200 -1642001632767841457 -1642001633767699690 -1642001634767640493 -1642001635767715002 -1642001636767719399 -1642001637767810380 -1642001638767759124 -1642001639767743457 -1642001640767440881 -1642001641767434458 -1642001642767648193 -1642001643767431660 -1642001644767419373 -1642001645767474520 -1642001646767303675 -1642001647767354320 -1642001648767226600 -1642001649767240940 -1642001650767144908 -1642001651767185108 -1642001652767186402 -1642001653767110427 -1642001654767220299 -1642001655767065682 -1642001656766948861 -1642001657767077888 -1642001658767126231 -1642001659766851374 -1642001660767155802 -1642001661767078993 -1642001662766899022 -1642001663766944636 -1642001664766771082 -1642001665766831634 -1642001666766527413 -1642001667766549370 -1642001668766781500 -1642001669766554103 -1642001670766576944 -1642001671766384327 -1642001672766448183 -1642001673766615366 -1642001674766558987 -1642001675766201231 -1642001676766218180 -1642001677766178769 -1642001678766568109 -1642001679766449958 -1642001680766261625 -1642001681766236473 -1642001682766219128 -1642001683766295515 -1642001684766014738 -1642001685766201572 -1642001686766070394 -1642001687766061324 -1642001688766277255 -1642001689765896121 -1642001690766117426 -1642001691766390226 -1642001692766374905 -1642001693766339163 -1642001694766355896 -1642001695766043069 +1642086629581145980 +1642086630581061521 +1642086631580981334 +1642086632580089547 +1642086633580724909 +1642086634580746989 +1642086635580880808 +1642086636580499482 +1642086637580109875 +1642086638580923857 +1642086639580985222 +1642086640580750929 +1642086641580935326 +1642086642581038151 +1642086643581024958 +1642086644580849891 +1642086645580801854 +1642086646580893578 +1642086647580600234 +1642086648580535137 +1642086649580735947 +1642086650580879116 +1642086651580716551 +1642086652580669371 +1642086653580528269 +1642086654580611988 +1642086655580595334 +1642086656580732943 +1642086657579906550 +1642086658580841295 +1642086659580541091 +1642086660580534012 +1642086661580668533 +1642086662580653407 +1642086663580547867 +1642086664580654910 +1642086665580565175 +1642086666580596766 +1642086667580518032 +1642086668580594534 +1642086669580146506 +1642086670580440370 +1642086671580703605 +1642086672580408282 +1642086673580395077 +1642086674580332299 +1642086675580471925 +1642086676580505817 +1642086677580543158 +1642086678580535758 +1642086679580537365 +1642086680580508437 +1642086681580495073 +1642086682580486357 +1642086683580484137 +1642086684580449140 +1642086685580579634 +1642086686580566978 +1642086687580344982 +1642086688580489243 +1642086689580295785 +1642086690580639149 +1642086691580641012 +1642086692580669170 +1642086693580468003 +1642086694580282692 +1642086695580429692 +1642086696580306674 +1642086697580399972 +1642086698580383062 +1642086699580387054 +1642086700580283440 +1642086701580507573 +1642086702580364565 +1642086703580839626 +1642086704580377068 +1642086705580397131 +1642086706579645113 +1642086707580548365 +1642086708580592590 +1642086709580324356 +1642086710580334508 +1642086711580428532 +1642086712580763847 +1642086713580412899 +1642086714580024281 +1642086715580128942 +1642086716580357649 +1642086717580376602 +1642086718580300251 +1642086719580251707 +1642086720580345751 +1642086721580447732 +1642086722580231388 +1642086723580170250 +1642086724580342497 +1642086725580191167 +1642086726580257274 +1642086727580217600 +1642086728580023835 +1642086729580258827 +1642086730580251590 +1642086731580044173 +1642086732580065101 +1642086733580130561 +1642086734579904580 +1642086735579842494 +1642086736579867012 +1642086737580034189 +1642086738579895519 +1642086739579757495 +1642086740580013817 +1642086741579870572 +1642086742579846598 +1642086743579930113 +1642086744580104158 +1642086745579902332 +1642086746580130232 +1642086747579839961 +1642086748579967516 +1642086749579275385 +1642086750579223699 +1642086751579478216 +1642086752579540790 +1642086753579589300 +1642086754579623360 +1642086755579263172 +1642086756579360985 +1642086757579800702 +1642086758579786684 +1642086759579798315 +1642086760579810067 +1642086761579769277 +1642086762579733579 +1642086763579977482 +1642086764579932498 +1642086765579692453 +1642086766579919401 +1642086767579517246 +1642086768579400610 +1642086769578998679 +1642086770579382115 +1642086771579332403 +1642086772579336667 +1642086773579378027 +1642086774579352173 +1642086775579392222 +1642086776579305935 +1642086777579252595 +1642086778579392235 +1642086779579662763 +1642086780579629920 +1642086781579642078 +1642086782579430522 +1642086783579597803 +1642086784579841779 +1642086785579282655 +1642086786579785515 +1642086787579354390 +1642086788579841495 +1642086789579795136 +1642086790579809344 +1642086791579824637 +1642086792579787464 +1642086793579783353 +1642086794579695746 +1642086795579203813 +1642086796579121063 +1642086797579094829 +1642086798579286107 +1642086799579435105 +1642086800579223469 +1642086801579654842 +1642086802579001957 +1642086803579433272 +1642086804579051965 +1642086805579106640 +1642086806579082864 +1642086807578649527 +1642086808579076245 +1642086809579034461 +1642086810579005374 +1642086811578686641 +1642086812579011075 +1642086813579052083 +1642086814579043726 +1642086815578729195 +1642086816579110886 +1642086817579168656 +1642086818578944077 +1642086819579051131 +1642086820579053578 +1642086821579141837 +1642086822579122552 +1642086823578928282 +1642086824578869752 +1642086825579547052 +1642086826578850995 +1642086827578927881 +1642086828578866187 From f84eb6ee89acd6790c7cf7ccae2e2b43b4806aa5 Mon Sep 17 00:00:00 2001 From: MEIP-users Date: Fri, 14 Jan 2022 00:44:28 +0900 Subject: [PATCH 49/56] prepared the environment for latency measurement --- mros2_echoback_string_eval/src/pub_node.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mros2_echoback_string_eval/src/pub_node.cpp b/mros2_echoback_string_eval/src/pub_node.cpp index b26f7df..2af6a59 100644 --- a/mros2_echoback_string_eval/src/pub_node.cpp +++ b/mros2_echoback_string_eval/src/pub_node.cpp @@ -23,14 +23,15 @@ class Publisher : public rclcpp::Node } private: + std::array publogs; void timer_callback() { - if(count_ < 200){ + if(count_ < 201){ auto message = std_msgs::msg::String(); message.data = "!"; publogs[count_] = this->get_clock()->now(); publisher_->publish(message); - } else if (count_ == 200){ + } else if (count_ == 201){ std::ofstream writing_file; std::string filename = "string_publog.txt"; writing_file.open(filename, std::ios::out); From 0ad0defda9786320bd03eb244e71c4651705a637 Mon Sep 17 00:00:00 2001 From: MEIP-users Date: Sun, 13 Feb 2022 16:53:37 +0900 Subject: [PATCH 50/56] prepared for example apps for mros2:v0.2.4 --- custom_msgs/health_msgs/CMakeLists.txt | 37 ---- custom_msgs/health_msgs/msg/Health.msg | 3 - custom_msgs/health_msgs/package.xml | 23 -- custom_msgs/mix_msgs/CMakeLists.txt | 39 ---- custom_msgs/mix_msgs/msg/IntVector3.msg | 1 - custom_msgs/mix_msgs/msg/Mix.msg | 5 - custom_msgs/mix_msgs/msg/Vector3.msg | 3 - custom_msgs/mix_msgs/package.xml | 23 -- mros2_echoback_health/CMakeLists.txt | 62 ------ mros2_echoback_health/launch/launch_pubsub.py | 21 -- mros2_echoback_health/package.xml | 21 -- mros2_echoback_health/src/pub_node.cpp | 45 ---- mros2_echoback_health/src/sub_node.cpp | 34 --- mros2_echoback_mesh/CMakeLists.txt | 63 ------ mros2_echoback_mesh/launch/launch_pubsub.py | 21 -- mros2_echoback_mesh/package.xml | 23 -- mros2_echoback_mesh/src/pub_node.cpp | 56 ----- mros2_echoback_mesh/src/sub_node.cpp | 34 --- mros2_echoback_mix/CMakeLists.txt | 62 ------ mros2_echoback_mix/launch/launch_pubsub.py | 21 -- mros2_echoback_mix/package.xml | 21 -- mros2_echoback_mix/src/pub_node.cpp | 51 ----- mros2_echoback_mix/src/sub_node.cpp | 34 --- mros2_echoback_string_eval/CMakeLists.txt | 62 ------ .../launch/launch_pubsub.py | 21 -- mros2_echoback_string_eval/package.xml | 21 -- mros2_echoback_string_eval/src/pub_node.cpp | 55 ----- mros2_echoback_string_eval/src/sub_node.cpp | 51 ----- .../CMakeLists.txt | 62 ------ .../launch/launch_pubsub.py | 21 -- mros2_echoback_twist _calc_time/package.xml | 21 -- .../src/pub_node.cpp | 60 ------ .../src/sub_node.cpp | 50 ----- mros2_echoback_twist_string/CMakeLists.txt | 63 ------ .../launch/launch_pubsub.py | 21 -- mros2_echoback_twist_string/package.xml | 23 -- mros2_echoback_twist_string/src/pub_node.cpp | 52 ----- mros2_echoback_twist_string/src/sub_node.cpp | 44 ---- .../CMakeLists.txt | 63 ------ .../launch/launch_pubsub.py | 21 -- .../package.xml | 23 -- .../src/pub_node.cpp | 63 ------ .../src/sub_node.cpp | 58 ----- twist_publog.txt | 200 ------------------ twist_string_publog.txt | 200 ------------------ twist_string_sublog.txt | 200 ------------------ twist_sublog.txt | 200 ------------------ 47 files changed, 2358 deletions(-) delete mode 100644 custom_msgs/health_msgs/CMakeLists.txt delete mode 100644 custom_msgs/health_msgs/msg/Health.msg delete mode 100644 custom_msgs/health_msgs/package.xml delete mode 100644 custom_msgs/mix_msgs/CMakeLists.txt delete mode 100644 custom_msgs/mix_msgs/msg/IntVector3.msg delete mode 100644 custom_msgs/mix_msgs/msg/Mix.msg delete mode 100644 custom_msgs/mix_msgs/msg/Vector3.msg delete mode 100644 custom_msgs/mix_msgs/package.xml delete mode 100644 mros2_echoback_health/CMakeLists.txt delete mode 100644 mros2_echoback_health/launch/launch_pubsub.py delete mode 100644 mros2_echoback_health/package.xml delete mode 100644 mros2_echoback_health/src/pub_node.cpp delete mode 100644 mros2_echoback_health/src/sub_node.cpp delete mode 100644 mros2_echoback_mesh/CMakeLists.txt delete mode 100644 mros2_echoback_mesh/launch/launch_pubsub.py delete mode 100644 mros2_echoback_mesh/package.xml delete mode 100644 mros2_echoback_mesh/src/pub_node.cpp delete mode 100644 mros2_echoback_mesh/src/sub_node.cpp delete mode 100644 mros2_echoback_mix/CMakeLists.txt delete mode 100644 mros2_echoback_mix/launch/launch_pubsub.py delete mode 100644 mros2_echoback_mix/package.xml delete mode 100644 mros2_echoback_mix/src/pub_node.cpp delete mode 100644 mros2_echoback_mix/src/sub_node.cpp delete mode 100644 mros2_echoback_string_eval/CMakeLists.txt delete mode 100644 mros2_echoback_string_eval/launch/launch_pubsub.py delete mode 100644 mros2_echoback_string_eval/package.xml delete mode 100644 mros2_echoback_string_eval/src/pub_node.cpp delete mode 100644 mros2_echoback_string_eval/src/sub_node.cpp delete mode 100644 mros2_echoback_twist _calc_time/CMakeLists.txt delete mode 100644 mros2_echoback_twist _calc_time/launch/launch_pubsub.py delete mode 100644 mros2_echoback_twist _calc_time/package.xml delete mode 100644 mros2_echoback_twist _calc_time/src/pub_node.cpp delete mode 100644 mros2_echoback_twist _calc_time/src/sub_node.cpp delete mode 100644 mros2_echoback_twist_string/CMakeLists.txt delete mode 100644 mros2_echoback_twist_string/launch/launch_pubsub.py delete mode 100644 mros2_echoback_twist_string/package.xml delete mode 100644 mros2_echoback_twist_string/src/pub_node.cpp delete mode 100644 mros2_echoback_twist_string/src/sub_node.cpp delete mode 100644 mros2_echoback_twist_string_calc_time/CMakeLists.txt delete mode 100644 mros2_echoback_twist_string_calc_time/launch/launch_pubsub.py delete mode 100644 mros2_echoback_twist_string_calc_time/package.xml delete mode 100644 mros2_echoback_twist_string_calc_time/src/pub_node.cpp delete mode 100644 mros2_echoback_twist_string_calc_time/src/sub_node.cpp delete mode 100644 twist_publog.txt delete mode 100644 twist_string_publog.txt delete mode 100644 twist_string_sublog.txt delete mode 100644 twist_sublog.txt diff --git a/custom_msgs/health_msgs/CMakeLists.txt b/custom_msgs/health_msgs/CMakeLists.txt deleted file mode 100644 index c1e4fc9..0000000 --- a/custom_msgs/health_msgs/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -cmake_minimum_required(VERSION 3.5) -project(health_msgs) - -# Default to C99 -if(NOT CMAKE_C_STANDARD) - set(CMAKE_C_STANDARD 99) -endif() - -# Default to C++14 -if(NOT CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 14) -endif() - -if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_compile_options(-Wall -Wextra -Wpedantic) -endif() - -# find dependencies -find_package(ament_cmake REQUIRED) -find_package(rosidl_default_generators REQUIRED) - -rosidl_generate_interfaces(${PROJECT_NAME} - "msg/Health.msg" -) - -if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - # the following line skips the linter which checks for copyrights - # uncomment the line when a copyright and license is not present in all source files - #set(ament_cmake_copyright_FOUND TRUE) - # the following line skips cpplint (only works in a git repo) - # uncomment the line when this package is not in a git repo - #set(ament_cmake_cpplint_FOUND TRUE) - ament_lint_auto_find_test_dependencies() -endif() - -ament_package() \ No newline at end of file diff --git a/custom_msgs/health_msgs/msg/Health.msg b/custom_msgs/health_msgs/msg/Health.msg deleted file mode 100644 index b22ff81..0000000 --- a/custom_msgs/health_msgs/msg/Health.msg +++ /dev/null @@ -1,3 +0,0 @@ -string name -uint16 height -float32 weight \ No newline at end of file diff --git a/custom_msgs/health_msgs/package.xml b/custom_msgs/health_msgs/package.xml deleted file mode 100644 index 53eed87..0000000 --- a/custom_msgs/health_msgs/package.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - health_msgs - 0.0.0 - TODO: Package description - uden - TODO: License declaration - - ament_cmake - - rosidl_default_generators - rosidl_default_runtime - - rosidl_interface_packages - - ament_lint_auto - ament_lint_common - - - ament_cmake - - \ No newline at end of file diff --git a/custom_msgs/mix_msgs/CMakeLists.txt b/custom_msgs/mix_msgs/CMakeLists.txt deleted file mode 100644 index 07b9916..0000000 --- a/custom_msgs/mix_msgs/CMakeLists.txt +++ /dev/null @@ -1,39 +0,0 @@ -cmake_minimum_required(VERSION 3.5) -project(mix_msgs) - -# Default to C99 -if(NOT CMAKE_C_STANDARD) - set(CMAKE_C_STANDARD 99) -endif() - -# Default to C++14 -if(NOT CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 14) -endif() - -if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_compile_options(-Wall -Wextra -Wpedantic) -endif() - -# find dependencies -find_package(ament_cmake REQUIRED) -find_package(rosidl_default_generators REQUIRED) - -rosidl_generate_interfaces(${PROJECT_NAME} - "msg/Vector3.msg" - "msg/IntVector3.msg" - "msg/Mix.msg" -) - -if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - # the following line skips the linter which checks for copyrights - # uncomment the line when a copyright and license is not present in all source files - #set(ament_cmake_copyright_FOUND TRUE) - # the following line skips cpplint (only works in a git repo) - # uncomment the line when this package is not in a git repo - #set(ament_cmake_cpplint_FOUND TRUE) - ament_lint_auto_find_test_dependencies() -endif() - -ament_package() \ No newline at end of file diff --git a/custom_msgs/mix_msgs/msg/IntVector3.msg b/custom_msgs/mix_msgs/msg/IntVector3.msg deleted file mode 100644 index 703e430..0000000 --- a/custom_msgs/mix_msgs/msg/IntVector3.msg +++ /dev/null @@ -1 +0,0 @@ -Vector3 vec3 diff --git a/custom_msgs/mix_msgs/msg/Mix.msg b/custom_msgs/mix_msgs/msg/Mix.msg deleted file mode 100644 index da24ec0..0000000 --- a/custom_msgs/mix_msgs/msg/Mix.msg +++ /dev/null @@ -1,5 +0,0 @@ -string name -IntVector3 vec3 -uint16 height -float32 weight -float64[8] array \ No newline at end of file diff --git a/custom_msgs/mix_msgs/msg/Vector3.msg b/custom_msgs/mix_msgs/msg/Vector3.msg deleted file mode 100644 index 99a4d40..0000000 --- a/custom_msgs/mix_msgs/msg/Vector3.msg +++ /dev/null @@ -1,3 +0,0 @@ -uint16 x -uint16 y -uint16 z diff --git a/custom_msgs/mix_msgs/package.xml b/custom_msgs/mix_msgs/package.xml deleted file mode 100644 index 8ebe014..0000000 --- a/custom_msgs/mix_msgs/package.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - mix_msgs - 0.0.0 - TODO: Package description - uden - TODO: License declaration - - ament_cmake - - rosidl_default_generators - rosidl_default_runtime - - rosidl_interface_packages - - ament_lint_auto - ament_lint_common - - - ament_cmake - - \ No newline at end of file diff --git a/mros2_echoback_health/CMakeLists.txt b/mros2_echoback_health/CMakeLists.txt deleted file mode 100644 index 059206a..0000000 --- a/mros2_echoback_health/CMakeLists.txt +++ /dev/null @@ -1,62 +0,0 @@ -cmake_minimum_required(VERSION 3.5) -project(mros2_echoback_health) - - -# Default to C99 -if(NOT CMAKE_C_STANDARD) - set(CMAKE_C_STANDARD 99) -endif() - -# Default to C++14 -if(NOT CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 14) -endif() - -if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_compile_options(-Wall -Wextra -Wpedantic) -endif() - -# find dependencies -find_package(ament_cmake REQUIRED) -find_package(rclcpp REQUIRED) -find_package(health_msgs REQUIRED) -# uncomment the following section in order to fill in -# further dependencies manually. -# find_package( REQUIRED) - -add_executable(pub_node src/pub_node.cpp) -ament_target_dependencies(pub_node rclcpp health_msgs) - -add_executable(sub_node src/sub_node.cpp) -ament_target_dependencies(sub_node rclcpp health_msgs) - -target_include_directories(pub_node PUBLIC - $ - $) - -target_include_directories(sub_node PUBLIC - $ - $) - -install(TARGETS pub_node - DESTINATION lib/${PROJECT_NAME}) -install(TARGETS sub_node - DESTINATION lib/${PROJECT_NAME}) - -install(DIRECTORY - launch - DESTINATION share/${PROJECT_NAME} -) - -if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - # the following line skips the linter which checks for copyrights - # uncomment the line when a copyright and license is not present in all source files - #set(ament_cmake_copyright_FOUND TRUE) - # the following line skips cpplint (only works in a git repo) - # uncomment the line when this package is not in a git repo - #set(ament_cmake_cpplint_FOUND TRUE) - ament_lint_auto_find_test_dependencies() -endif() - -ament_package() \ No newline at end of file diff --git a/mros2_echoback_health/launch/launch_pubsub.py b/mros2_echoback_health/launch/launch_pubsub.py deleted file mode 100644 index 2d9e8b1..0000000 --- a/mros2_echoback_health/launch/launch_pubsub.py +++ /dev/null @@ -1,21 +0,0 @@ -from launch import LaunchDescription -from launch_ros.actions import Node - -# Note: `node_`, `prefix` and `output` will be removed on Foxy -def generate_launch_description(): - return LaunchDescription([ - Node( - package='mros2_echoback_health', - node_executable='pub_node', - node_name='pub_mros2', - prefix=['stdbuf -o L'], - output="screen" - ), - Node( - package='mros2_echoback_health', - node_executable='sub_node', - node_name='mros2_sub', - prefix=['stdbuf -o L'], - output="screen" - ) - ]) \ No newline at end of file diff --git a/mros2_echoback_health/package.xml b/mros2_echoback_health/package.xml deleted file mode 100644 index ca5b112..0000000 --- a/mros2_echoback_health/package.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - mros2_echoback_health - 0.0.0 - TODO: Package description - uden - TODO: License declaration - - ament_cmake -rclcpp -health_msgs -rclcpp -health_msgs - ament_lint_auto - ament_lint_common - - - ament_cmake - - \ No newline at end of file diff --git a/mros2_echoback_health/src/pub_node.cpp b/mros2_echoback_health/src/pub_node.cpp deleted file mode 100644 index 50c8039..0000000 --- a/mros2_echoback_health/src/pub_node.cpp +++ /dev/null @@ -1,45 +0,0 @@ -#include -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "health_msgs/msg/health.hpp" - -using namespace std::chrono_literals; - -/* This example creates a subclass of Node and uses std::bind() to register a -* member function as a callback from the timer. */ - -class Publisher : public rclcpp::Node -{ -public: - Publisher() - : Node("pub_mros2"), count_(0) - { - publisher_ = this->create_publisher("to_stm", 10); - timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); - } - -private: - void timer_callback() - { - auto message = health_msgs::msg::Health(); - message.name = std::to_string(count_++); - message.height = 170; - message.weight = 63.5; - RCLCPP_INFO(this->get_logger(), "Publishing msg: { name: '%s', height: %u cm, weight: %f kg }", message.name.c_str(), message.height, message.weight); - publisher_->publish(message); - } - rclcpp::TimerBase::SharedPtr timer_; - rclcpp::Publisher::SharedPtr publisher_; - size_t count_; -}; - -int main(int argc, char * argv[]) -{ - rclcpp::init(argc, argv); - rclcpp::spin(std::make_shared()); - rclcpp::shutdown(); - return 0; -} diff --git a/mros2_echoback_health/src/sub_node.cpp b/mros2_echoback_health/src/sub_node.cpp deleted file mode 100644 index b42cc36..0000000 --- a/mros2_echoback_health/src/sub_node.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "health_msgs/msg/health.hpp" - -using std::placeholders::_1; - -class Subscriber : public rclcpp::Node -{ -public: - Subscriber() : Node("mros2_sub") - { - subscriber_ = this->create_subscription("to_linux", rclcpp::QoS(10).best_effort(), std::bind(&Subscriber::topic_callback, this, _1)); - } - -private: - void topic_callback(const health_msgs::msg::Health::SharedPtr message) const - { - RCLCPP_INFO(this->get_logger(), "Subscribed msg: { name: '%s', height: %d cm, weight: %f kg }", message->name.c_str(), message->height, message->weight); - } - rclcpp::Subscription::SharedPtr subscriber_; -}; - - -int main(int argc, char *argv[]) -{ - rclcpp::init(argc, argv); - rclcpp::spin(std::make_shared()); - rclcpp::shutdown(); - return 0; -} \ No newline at end of file diff --git a/mros2_echoback_mesh/CMakeLists.txt b/mros2_echoback_mesh/CMakeLists.txt deleted file mode 100644 index b8a97aa..0000000 --- a/mros2_echoback_mesh/CMakeLists.txt +++ /dev/null @@ -1,63 +0,0 @@ -cmake_minimum_required(VERSION 3.5) -project(mros2_echoback_mesh) - - -# Default to C99 -if(NOT CMAKE_C_STANDARD) - set(CMAKE_C_STANDARD 99) -endif() - -# Default to C++14 -if(NOT CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 14) -endif() - -if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_compile_options(-Wall -Wextra -Wpedantic) -endif() - -# find dependencies -find_package(ament_cmake REQUIRED) -find_package(rclcpp REQUIRED) -find_package(geometry_msgs REQUIRED) -find_package(shape_msgs REQUIRED) -# uncomment the following section in order to fill in -# further dependencies manually. -# find_package( REQUIRED) - -add_executable(pub_node src/pub_node.cpp) -ament_target_dependencies(pub_node rclcpp geometry_msgs shape_msgs) - -add_executable(sub_node src/sub_node.cpp) -ament_target_dependencies(sub_node rclcpp geometry_msgs shape_msgs) - -target_include_directories(pub_node PUBLIC - $ - $) - -target_include_directories(sub_node PUBLIC - $ - $) - -install(TARGETS pub_node - DESTINATION lib/${PROJECT_NAME}) -install(TARGETS sub_node - DESTINATION lib/${PROJECT_NAME}) - -install(DIRECTORY - launch - DESTINATION share/${PROJECT_NAME} -) - -if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - # the following line skips the linter which checks for copyrights - # uncomment the line when a copyright and license is not present in all source files - #set(ament_cmake_copyright_FOUND TRUE) - # the following line skips cpplint (only works in a git repo) - # uncomment the line when this package is not in a git repo - #set(ament_cmake_cpplint_FOUND TRUE) - ament_lint_auto_find_test_dependencies() -endif() - -ament_package() \ No newline at end of file diff --git a/mros2_echoback_mesh/launch/launch_pubsub.py b/mros2_echoback_mesh/launch/launch_pubsub.py deleted file mode 100644 index 6351c51..0000000 --- a/mros2_echoback_mesh/launch/launch_pubsub.py +++ /dev/null @@ -1,21 +0,0 @@ -from launch import LaunchDescription -from launch_ros.actions import Node - -# Note: `node_`, `prefix` and `output` will be removed on Foxy -def generate_launch_description(): - return LaunchDescription([ - Node( - package='mros2_echoback_mesh', - node_executable='pub_node', - node_name='pub_mros2', - prefix=['stdbuf -o L'], - output="screen" - ), - Node( - package='mros2_echoback_mesh', - node_executable='sub_node', - node_name='mros2_sub', - prefix=['stdbuf -o L'], - output="screen" - ) - ]) \ No newline at end of file diff --git a/mros2_echoback_mesh/package.xml b/mros2_echoback_mesh/package.xml deleted file mode 100644 index 1e69b09..0000000 --- a/mros2_echoback_mesh/package.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - mros2_echoback_mesh - 0.0.0 - TODO: Package description - uden - TODO: License declaration - - ament_cmake -rclcpp -geometry_msgs -shape_msgs -rclcpp -geometry_msgs -shape_msgs - ament_lint_auto - ament_lint_common - - - ament_cmake - - \ No newline at end of file diff --git a/mros2_echoback_mesh/src/pub_node.cpp b/mros2_echoback_mesh/src/pub_node.cpp deleted file mode 100644 index be801e7..0000000 --- a/mros2_echoback_mesh/src/pub_node.cpp +++ /dev/null @@ -1,56 +0,0 @@ -#include -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "shape_msgs/msg/mesh.hpp" - -using namespace std::chrono_literals; - -/* This example creates a subclass of Node and uses std::bind() to register a -* member function as a callback from the timer. */ - -class Publisher : public rclcpp::Node -{ -public: - Publisher() - : Node("pub_mros2"), count_(0) - { - publisher_ = this->create_publisher("to_stm", 10); - timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); - } - -private: - void timer_callback() - { - auto message = shape_msgs::msg::Mesh(); - message.triangles.reserve(2); - message.vertices.reserve(2); - for (int i=0;i<2;i++){ - for (int j=0;j<3;j++){ - message.triangles[i].vertex_indices[j]=count_++; - } - } - for (int i=0;i<2;i++){ - for (int j=0;j<3;j++){ - message.vertices[i].x=count_++; - message.vertices[i].y=count_++; - message.vertices[i].z=count_++; - } - } - RCLCPP_INFO(this->get_logger(), "Publishing msg: { triangles: {{ %lu, %lu, %lu }, { %lu, %lu, %lu }}, vertices: {{ %f, %f, %f }, { %f, %f, %f }}}", message.triangles[0].vertex_indices[0], message.triangles[0].vertex_indices[1], message.triangles[0].vertex_indices[2], message.triangles[1].vertex_indices[0], message.triangles[1].vertex_indices[1], message.triangles[1].vertex_indices[2], message.vertices[0].x, message.vertices[0].y, message.vertices[0].z, message.vertices[1].x, message.vertices[1].y, message.vertices[1].z); - publisher_->publish(message); - } - rclcpp::TimerBase::SharedPtr timer_; - rclcpp::Publisher::SharedPtr publisher_; - size_t count_; -}; - -int main(int argc, char *argv[]) -{ - rclcpp::init(argc, argv); - rclcpp::spin(std::make_shared()); - rclcpp::shutdown(); - return 0; -} \ No newline at end of file diff --git a/mros2_echoback_mesh/src/sub_node.cpp b/mros2_echoback_mesh/src/sub_node.cpp deleted file mode 100644 index 097165a..0000000 --- a/mros2_echoback_mesh/src/sub_node.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "shape_msgs/msg/mesh.hpp" - -using std::placeholders::_1; - -class Subscriber : public rclcpp::Node -{ -public: - Subscriber() : Node("mros2_sub") - { - subscriber_ = this->create_subscription("to_linux", rclcpp::QoS(10).best_effort(), std::bind(&Subscriber::topic_callback, this, _1)); - } - -private: - void topic_callback(const shape_msgs::msg::Mesh::SharedPtr message) const - { - RCLCPP_INFO(this->get_logger(), "Subscribed msg: { triangles: {{ %lu, %lu, %lu }, { %lu, %lu, %lu }}, vertices: {{ %f, %f, %f }, { %f, %f, %f }}}", message->triangles[0].vertex_indices[0], message->triangles[0].vertex_indices[1], message->triangles[0].vertex_indices[2], message->triangles[1].vertex_indices[0], message->triangles[1].vertex_indices[1], message->triangles[1].vertex_indices[2], message->vertices[0].x, message->vertices[0].y, message->vertices[0].z, message->vertices[1].x, message->vertices[1].y, message->vertices[1].z); - } - rclcpp::Subscription::SharedPtr subscriber_; -}; - - -int main(int argc, char *argv[]) -{ - rclcpp::init(argc, argv); - rclcpp::spin(std::make_shared()); - rclcpp::shutdown(); - return 0; -} \ No newline at end of file diff --git a/mros2_echoback_mix/CMakeLists.txt b/mros2_echoback_mix/CMakeLists.txt deleted file mode 100644 index f61e790..0000000 --- a/mros2_echoback_mix/CMakeLists.txt +++ /dev/null @@ -1,62 +0,0 @@ -cmake_minimum_required(VERSION 3.5) -project(mros2_echoback_mix) - - -# Default to C99 -if(NOT CMAKE_C_STANDARD) - set(CMAKE_C_STANDARD 99) -endif() - -# Default to C++14 -if(NOT CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 14) -endif() - -if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_compile_options(-Wall -Wextra -Wpedantic) -endif() - -# find dependencies -find_package(ament_cmake REQUIRED) -find_package(rclcpp REQUIRED) -find_package(mix_msgs REQUIRED) -# uncomment the following section in order to fill in -# further dependencies manually. -# find_package( REQUIRED) - -add_executable(pub_node src/pub_node.cpp) -ament_target_dependencies(pub_node rclcpp mix_msgs) - -add_executable(sub_node src/sub_node.cpp) -ament_target_dependencies(sub_node rclcpp mix_msgs) - -target_include_directories(pub_node PUBLIC - $ - $) - -target_include_directories(sub_node PUBLIC - $ - $) - -install(TARGETS pub_node - DESTINATION lib/${PROJECT_NAME}) -install(TARGETS sub_node - DESTINATION lib/${PROJECT_NAME}) - -install(DIRECTORY - launch - DESTINATION share/${PROJECT_NAME} -) - -if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - # the following line skips the linter which checks for copyrights - # uncomment the line when a copyright and license is not present in all source files - #set(ament_cmake_copyright_FOUND TRUE) - # the following line skips cpplint (only works in a git repo) - # uncomment the line when this package is not in a git repo - #set(ament_cmake_cpplint_FOUND TRUE) - ament_lint_auto_find_test_dependencies() -endif() - -ament_package() \ No newline at end of file diff --git a/mros2_echoback_mix/launch/launch_pubsub.py b/mros2_echoback_mix/launch/launch_pubsub.py deleted file mode 100644 index dc56c29..0000000 --- a/mros2_echoback_mix/launch/launch_pubsub.py +++ /dev/null @@ -1,21 +0,0 @@ -from launch import LaunchDescription -from launch_ros.actions import Node - -# Note: `node_`, `prefix` and `output` will be removed on Foxy -def generate_launch_description(): - return LaunchDescription([ - Node( - package='mros2_echoback_mix', - node_executable='pub_node', - node_name='pub_mros2', - prefix=['stdbuf -o L'], - output="screen" - ), - Node( - package='mros2_echoback_mix', - node_executable='sub_node', - node_name='mros2_sub', - prefix=['stdbuf -o L'], - output="screen" - ) - ]) \ No newline at end of file diff --git a/mros2_echoback_mix/package.xml b/mros2_echoback_mix/package.xml deleted file mode 100644 index 2a71f50..0000000 --- a/mros2_echoback_mix/package.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - mros2_echoback_mix - 0.0.0 - TODO: Package description - uden - TODO: License declaration - - ament_cmake -rclcpp -mix_msgs -rclcpp -mix_msgs - ament_lint_auto - ament_lint_common - - - ament_cmake - - \ No newline at end of file diff --git a/mros2_echoback_mix/src/pub_node.cpp b/mros2_echoback_mix/src/pub_node.cpp deleted file mode 100644 index fd9eddc..0000000 --- a/mros2_echoback_mix/src/pub_node.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "mix_msgs/msg/mix.hpp" - -using namespace std::chrono_literals; - -/* This example creates a subclass of Node and uses std::bind() to register a -* member function as a callback from the timer. */ - -class Publisher : public rclcpp::Node -{ -public: - Publisher() - : Node("pub_mros2"), count_(0) - { - publisher_ = this->create_publisher("to_stm", 10); - timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); - } - -private: - void timer_callback() - { - auto message = mix_msgs::msg::Mix(); - message.name = std::to_string(count_++); - message.vec3.vec3.x = 1; - message.vec3.vec3.y = 1; - message.vec3.vec3.z = 1; - message.height = 170; - message.weight = 63.5; - for (int i=0;i<8;i++){ - message.array[i]=i/100.0; - } - RCLCPP_INFO(this->get_logger(), "Publishing msg: { name: '%s', x: %u, y: %u, z: %u,height: %u cm, weight: %f kg, array: {%f,%f,%f} }", message.name.c_str(), message.vec3.vec3.x, message.vec3.vec3.y, message.vec3.vec3.z, message.height, message.weight, message.array[0], message.array[1], message.array[2]); - publisher_->publish(message); - } - rclcpp::TimerBase::SharedPtr timer_; - rclcpp::Publisher::SharedPtr publisher_; - size_t count_; -}; - -int main(int argc, char * argv[]) -{ - rclcpp::init(argc, argv); - rclcpp::spin(std::make_shared()); - rclcpp::shutdown(); - return 0; -} diff --git a/mros2_echoback_mix/src/sub_node.cpp b/mros2_echoback_mix/src/sub_node.cpp deleted file mode 100644 index dae9acd..0000000 --- a/mros2_echoback_mix/src/sub_node.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "mix_msgs/msg/mix.hpp" - -using std::placeholders::_1; - -class Subscriber : public rclcpp::Node -{ -public: - Subscriber() : Node("mros2_sub") - { - subscriber_ = this->create_subscription("to_linux", rclcpp::QoS(10).best_effort(), std::bind(&Subscriber::topic_callback, this, _1)); - } - -private: - void topic_callback(const mix_msgs::msg::Mix::SharedPtr message) const - { - RCLCPP_INFO(this->get_logger(), "Subscribed msg: { name: '%s', x: %u, y: %u, z: %u, height: %d cm, weight: %f kg, array: {%f,%f,%f} }", message->name.c_str(), message->vec3.vec3.x, message->vec3.vec3.y, message->vec3.vec3.z, message->height, message->weight, message->array[0], message->array[1], message->array[2]); - } - rclcpp::Subscription::SharedPtr subscriber_; -}; - - -int main(int argc, char *argv[]) -{ - rclcpp::init(argc, argv); - rclcpp::spin(std::make_shared()); - rclcpp::shutdown(); - return 0; -} \ No newline at end of file diff --git a/mros2_echoback_string_eval/CMakeLists.txt b/mros2_echoback_string_eval/CMakeLists.txt deleted file mode 100644 index 224572e..0000000 --- a/mros2_echoback_string_eval/CMakeLists.txt +++ /dev/null @@ -1,62 +0,0 @@ -cmake_minimum_required(VERSION 3.5) -project(mros2_echoback_string) - - -# Default to C99 -if(NOT CMAKE_C_STANDARD) - set(CMAKE_C_STANDARD 99) -endif() - -# Default to C++14 -if(NOT CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 14) -endif() - -if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_compile_options(-Wall -Wextra -Wpedantic) -endif() - -# find dependencies -find_package(ament_cmake REQUIRED) -find_package(rclcpp REQUIRED) -find_package(std_msgs REQUIRED) -# uncomment the following section in order to fill in -# further dependencies manually. -# find_package( REQUIRED) - -add_executable(pub_node src/pub_node.cpp) -ament_target_dependencies(pub_node rclcpp std_msgs) - -add_executable(sub_node src/sub_node.cpp) -ament_target_dependencies(sub_node rclcpp std_msgs) - -target_include_directories(pub_node PUBLIC - $ - $) - -target_include_directories(sub_node PUBLIC - $ - $) - -install(TARGETS pub_node - DESTINATION lib/${PROJECT_NAME}) -install(TARGETS sub_node - DESTINATION lib/${PROJECT_NAME}) - -install(DIRECTORY - launch - DESTINATION share/${PROJECT_NAME} -) - -if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - # the following line skips the linter which checks for copyrights - # uncomment the line when a copyright and license is not present in all source files - #set(ament_cmake_copyright_FOUND TRUE) - # the following line skips cpplint (only works in a git repo) - # uncomment the line when this package is not in a git repo - #set(ament_cmake_cpplint_FOUND TRUE) - ament_lint_auto_find_test_dependencies() -endif() - -ament_package() diff --git a/mros2_echoback_string_eval/launch/launch_pubsub.py b/mros2_echoback_string_eval/launch/launch_pubsub.py deleted file mode 100644 index a7564f2..0000000 --- a/mros2_echoback_string_eval/launch/launch_pubsub.py +++ /dev/null @@ -1,21 +0,0 @@ -from launch import LaunchDescription -from launch_ros.actions import Node - -# Note: `node_`, `prefix` and `output` will be removed on Foxy -def generate_launch_description(): - return LaunchDescription([ - Node( - package='mros2_echoback_string', - node_executable='pub_node', - node_name='pub_mros2', - prefix=['stdbuf -o L'], - output="screen" - ), - Node( - package='mros2_echoback_string', - node_executable='sub_node', - node_name='mros2_sub', - prefix=['stdbuf -o L'], - output="screen" - ) - ]) diff --git a/mros2_echoback_string_eval/package.xml b/mros2_echoback_string_eval/package.xml deleted file mode 100644 index bf58925..0000000 --- a/mros2_echoback_string_eval/package.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - mros2_echoback_string - 0.0.0 - TODO: Package description - uden - TODO: License declaration - - ament_cmake -rclcpp -std_msgs -rclcpp -std_msgs - ament_lint_auto - ament_lint_common - - - ament_cmake - - diff --git a/mros2_echoback_string_eval/src/pub_node.cpp b/mros2_echoback_string_eval/src/pub_node.cpp deleted file mode 100644 index 2af6a59..0000000 --- a/mros2_echoback_string_eval/src/pub_node.cpp +++ /dev/null @@ -1,55 +0,0 @@ -#include -#include -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "std_msgs/msg/string.hpp" - -using namespace std::chrono_literals; - -/* This example creates a subclass of Node and uses std::bind() to register a -* member function as a callback from the timer. */ - -class Publisher : public rclcpp::Node -{ -public: - Publisher() - : Node("pub_mros2"), count_(0) - { - publisher_ = this->create_publisher("to_stm", 10); - timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); - } - -private: - std::array publogs; - void timer_callback() - { - if(count_ < 201){ - auto message = std_msgs::msg::String(); - message.data = "!"; - publogs[count_] = this->get_clock()->now(); - publisher_->publish(message); - } else if (count_ == 201){ - std::ofstream writing_file; - std::string filename = "string_publog.txt"; - writing_file.open(filename, std::ios::out); - for (int i=0; i<200; i++){ - const std::string writing_text = std::to_string(publogs[i].nanoseconds()); - writing_file << writing_text << std::endl; - } - } - } - rclcpp::TimerBase::SharedPtr timer_; - rclcpp::Publisher::SharedPtr publisher_; - size_t count_; -}; - -int main(int argc, char * argv[]) -{ - rclcpp::init(argc, argv); - rclcpp::spin(std::make_shared()); - rclcpp::shutdown(); - return 0; -} diff --git a/mros2_echoback_string_eval/src/sub_node.cpp b/mros2_echoback_string_eval/src/sub_node.cpp deleted file mode 100644 index 6c4ff86..0000000 --- a/mros2_echoback_string_eval/src/sub_node.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include -#include -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "std_msgs/msg/string.hpp" - -using std::placeholders::_1; - -class Subscriber : public rclcpp::Node -{ -public: - uint32_t count_ = 0; - Subscriber() : Node("mros2_sub") - { - subscriber_ = this->create_subscription("to_linux", rclcpp::QoS(10).best_effort(), std::bind(&Subscriber::topic_callback, this, _1)); - } - -private: - std::array sublogs; - void topic_callback(const std_msgs::msg::String::SharedPtr msg) const - { - rclcpp::Time now = this->get_clock()->now(); - if (count_ < 200){ - sublogs[count_] = now; - auto subscribed_message = std_msgs::msg::String(); - subscribed_message = *msg; - count_++; - } else { - std::ofstream writing_file; - std::string filename = "string_sublog.txt"; - writing_file.open(filename, std::ios::out); - for (int i=0; i<200; i++){ - const std::string writing_text = std::to_string(sublogs[i].nanoseconds()); - writing_file << writing_text << std::endl; - } - } - } - rclcpp::Subscription::SharedPtr subscriber_; -}; - - -int main(int argc, char *argv[]) -{ - rclcpp::init(argc, argv); - rclcpp::spin(std::make_shared()); - rclcpp::shutdown(); - return 0; -} \ No newline at end of file diff --git a/mros2_echoback_twist _calc_time/CMakeLists.txt b/mros2_echoback_twist _calc_time/CMakeLists.txt deleted file mode 100644 index 8599482..0000000 --- a/mros2_echoback_twist _calc_time/CMakeLists.txt +++ /dev/null @@ -1,62 +0,0 @@ -cmake_minimum_required(VERSION 3.5) -project(mros2_echoback_twist_calc_time) - - -# Default to C99 -if(NOT CMAKE_C_STANDARD) - set(CMAKE_C_STANDARD 99) -endif() - -# Default to C++14 -if(NOT CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 14) -endif() - -if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_compile_options(-Wall -Wextra -Wpedantic) -endif() - -# find dependencies -find_package(ament_cmake REQUIRED) -find_package(rclcpp REQUIRED) -find_package(geometry_msgs REQUIRED) -# uncomment the following section in order to fill in -# further dependencies manually. -# find_package( REQUIRED) - -add_executable(pub_node src/pub_node.cpp) -ament_target_dependencies(pub_node rclcpp geometry_msgs) - -add_executable(sub_node src/sub_node.cpp) -ament_target_dependencies(sub_node rclcpp geometry_msgs) - -target_include_directories(pub_node PUBLIC - $ - $) - -target_include_directories(sub_node PUBLIC - $ - $) - -install(TARGETS pub_node - DESTINATION lib/${PROJECT_NAME}) -install(TARGETS sub_node - DESTINATION lib/${PROJECT_NAME}) - -install(DIRECTORY - launch - DESTINATION share/${PROJECT_NAME} -) - -if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - # the following line skips the linter which checks for copyrights - # uncomment the line when a copyright and license is not present in all source files - #set(ament_cmake_copyright_FOUND TRUE) - # the following line skips cpplint (only works in a git repo) - # uncomment the line when this package is not in a git repo - #set(ament_cmake_cpplint_FOUND TRUE) - ament_lint_auto_find_test_dependencies() -endif() - -ament_package() \ No newline at end of file diff --git a/mros2_echoback_twist _calc_time/launch/launch_pubsub.py b/mros2_echoback_twist _calc_time/launch/launch_pubsub.py deleted file mode 100644 index 4408431..0000000 --- a/mros2_echoback_twist _calc_time/launch/launch_pubsub.py +++ /dev/null @@ -1,21 +0,0 @@ -from launch import LaunchDescription -from launch_ros.actions import Node - -# Note: `node_`, `prefix` and `output` will be removed on Foxy -def generate_launch_description(): - return LaunchDescription([ - Node( - package='mros2_echoback_twist_calc_time', - node_executable='pub_node', - node_name='pub_mros2', - prefix=['stdbuf -o L'], - output="screen" - ), - Node( - package='mros2_echoback_twist_calc_time', - node_executable='sub_node', - node_name='mros2_sub', - prefix=['stdbuf -o L'], - output="screen" - ) - ]) \ No newline at end of file diff --git a/mros2_echoback_twist _calc_time/package.xml b/mros2_echoback_twist _calc_time/package.xml deleted file mode 100644 index 5031a0f..0000000 --- a/mros2_echoback_twist _calc_time/package.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - mros2_echoback_twist_calc_time - 0.0.0 - TODO: Package description - uden - TODO: License declaration - - ament_cmake -rclcpp -geometry_msgs -rclcpp -geometry_msgs - ament_lint_auto - ament_lint_common - - - ament_cmake - - \ No newline at end of file diff --git a/mros2_echoback_twist _calc_time/src/pub_node.cpp b/mros2_echoback_twist _calc_time/src/pub_node.cpp deleted file mode 100644 index 3ad1c27..0000000 --- a/mros2_echoback_twist _calc_time/src/pub_node.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include -#include -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "geometry_msgs/msg/twist.hpp" - -using namespace std::chrono_literals; - -/* This example creates a subclass of Node and uses std::bind() to register a -* member function as a callback from the timer. */ - -class Publisher : public rclcpp::Node -{ -public: - Publisher() - : Node("pub_mros2"), count_(0) - { - publisher_ = this->create_publisher("to_stm", 10); - timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); - } - -private: - std::array publogs; - void timer_callback() - { - if (count_ < 201){ - auto message = geometry_msgs::msg::Twist(); - publogs[count_] = this->get_clock()->now(); - message.linear.x = count_++/10.0; - message.linear.y = count_/10.0; - message.linear.z = count_/10.0; - message.angular.x = count_/50.0; - message.angular.y = count_/50.0; - message.angular.z = count_/50.0; - publisher_->publish(message); - } else if (count_ == 201) { - std::ofstream writing_file; - std::string filename = "twist_publog.txt"; - writing_file.open(filename, std::ios::out); - for (int i=0; i<200; i++){ - const std::string writing_text = std::to_string(publogs[i].nanoseconds()); - writing_file << writing_text << std::endl; - } - } - } - rclcpp::TimerBase::SharedPtr timer_; - rclcpp::Publisher::SharedPtr publisher_; - size_t count_; -}; - -int main(int argc, char *argv[]) -{ - rclcpp::init(argc, argv); - rclcpp::spin(std::make_shared()); - rclcpp::shutdown(); - return 0; -} \ No newline at end of file diff --git a/mros2_echoback_twist _calc_time/src/sub_node.cpp b/mros2_echoback_twist _calc_time/src/sub_node.cpp deleted file mode 100644 index e40b472..0000000 --- a/mros2_echoback_twist _calc_time/src/sub_node.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include -#include -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "geometry_msgs/msg/twist.hpp" - -using std::placeholders::_1; - -class Subscriber : public rclcpp::Node -{ -public: - uint32_t count_ = 0; - Subscriber() : Node("mros2_sub") - { - subscriber_ = this->create_subscription("to_linux", rclcpp::QoS(10).best_effort(), std::bind(&Subscriber::topic_callback, this, _1)); - } - -private: - std::array sublogs; - void topic_callback(const geometry_msgs::msg::Twist::SharedPtr message) - { - if (count_ < 200){ - auto subscribed_message = geometry_msgs::msg::Twist(); - subscribed_message = *message; - sublogs[count_] = this->get_clock()->now(); - count_++; - } else { - std::ofstream writing_file; - std::string filename = "twist_sublog.txt"; - writing_file.open(filename, std::ios::out); - for (int i=0; i<200; i++){ - const std::string writing_text = std::to_string(sublogs[i].nanoseconds()); - writing_file << writing_text << std::endl; - } - } - } - rclcpp::Subscription::SharedPtr subscriber_; -}; - - -int main(int argc, char *argv[]) -{ - rclcpp::init(argc, argv); - rclcpp::spin(std::make_shared()); - rclcpp::shutdown(); - return 0; -} \ No newline at end of file diff --git a/mros2_echoback_twist_string/CMakeLists.txt b/mros2_echoback_twist_string/CMakeLists.txt deleted file mode 100644 index 2308c67..0000000 --- a/mros2_echoback_twist_string/CMakeLists.txt +++ /dev/null @@ -1,63 +0,0 @@ -cmake_minimum_required(VERSION 3.5) -project(mros2_echoback_twist_string) - - -# Default to C99 -if(NOT CMAKE_C_STANDARD) - set(CMAKE_C_STANDARD 99) -endif() - -# Default to C++14 -if(NOT CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 14) -endif() - -if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_compile_options(-Wall -Wextra -Wpedantic) -endif() - -# find dependencies -find_package(ament_cmake REQUIRED) -find_package(rclcpp REQUIRED) -find_package(geometry_msgs REQUIRED) -find_package(std_msgs REQUIRED) -# uncomment the following section in order to fill in -# further dependencies manually. -# find_package( REQUIRED) - -add_executable(pub_node src/pub_node.cpp) -ament_target_dependencies(pub_node rclcpp geometry_msgs std_msgs) - -add_executable(sub_node src/sub_node.cpp) -ament_target_dependencies(sub_node rclcpp geometry_msgs std_msgs) - -target_include_directories(pub_node PUBLIC - $ - $) - -target_include_directories(sub_node PUBLIC - $ - $) - -install(TARGETS pub_node - DESTINATION lib/${PROJECT_NAME}) -install(TARGETS sub_node - DESTINATION lib/${PROJECT_NAME}) - -install(DIRECTORY - launch - DESTINATION share/${PROJECT_NAME} -) - -if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - # the following line skips the linter which checks for copyrights - # uncomment the line when a copyright and license is not present in all source files - #set(ament_cmake_copyright_FOUND TRUE) - # the following line skips cpplint (only works in a git repo) - # uncomment the line when this package is not in a git repo - #set(ament_cmake_cpplint_FOUND TRUE) - ament_lint_auto_find_test_dependencies() -endif() - -ament_package() \ No newline at end of file diff --git a/mros2_echoback_twist_string/launch/launch_pubsub.py b/mros2_echoback_twist_string/launch/launch_pubsub.py deleted file mode 100644 index bbb9b10..0000000 --- a/mros2_echoback_twist_string/launch/launch_pubsub.py +++ /dev/null @@ -1,21 +0,0 @@ -from launch import LaunchDescription -from launch_ros.actions import Node - -# Note: `node_`, `prefix` and `output` will be removed on Foxy -def generate_launch_description(): - return LaunchDescription([ - Node( - package='mros2_echoback_twist_string', - node_executable='pub_node', - node_name='pub_mros2', - prefix=['stdbuf -o L'], - output="screen" - ), - Node( - package='mros2_echoback_twist_string', - node_executable='sub_node', - node_name='mros2_sub', - prefix=['stdbuf -o L'], - output="screen" - ) - ]) \ No newline at end of file diff --git a/mros2_echoback_twist_string/package.xml b/mros2_echoback_twist_string/package.xml deleted file mode 100644 index 6695201..0000000 --- a/mros2_echoback_twist_string/package.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - mros2_echoback_twist_string - 0.0.0 - TODO: Package description - uden - TODO: License declaration - - ament_cmake -rclcpp -geometry_msgs -std_msgs -rclcpp -geometry_msgs -std_msgs - ament_lint_auto - ament_lint_common - - - ament_cmake - - \ No newline at end of file diff --git a/mros2_echoback_twist_string/src/pub_node.cpp b/mros2_echoback_twist_string/src/pub_node.cpp deleted file mode 100644 index 925e441..0000000 --- a/mros2_echoback_twist_string/src/pub_node.cpp +++ /dev/null @@ -1,52 +0,0 @@ -#include -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "geometry_msgs/msg/twist.hpp" -#include "std_msgs/msg/string.hpp" - -using namespace std::chrono_literals; - -/* This example creates a subclass of Node and uses std::bind() to register a -* member function as a callback from the timer. */ - -class Publisher : public rclcpp::Node -{ -public: - Publisher() - : Node("pub_mros2"), count_(0) - { - publisher_ = this->create_publisher("to_stm", 10); - timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); - } - -private: - void timer_callback() - { - auto message = geometry_msgs::msg::Twist(); - message.linear.x = count_++/10.0; - message.linear.y = count_++/10.0; - message.linear.z = count_++/10.0; - message.angular.x = count_++/50.0; - message.angular.y = count_++/50.0; - message.angular.z = count_++/50.0; - RCLCPP_INFO(this->get_logger(), "Publishing msg: { linear: { x: %f, y: %f, z: %f }, angular: { x: %f, y: %f, z: %f } }", message.linear.x, message.linear.y, message.linear.z, message.angular.x, message.angular.y, message.angular.z); - auto converted_message = std_msgs::msg::String(); - converted_message.data = std::to_string(message.linear.x) + std::to_string(message.linear.y) + std::to_string(message.linear.z) + std::to_string(message.angular.x) + std::to_string(message.angular.y) + std::to_string(message.angular.z); - - publisher_->publish(converted_message); - } - rclcpp::TimerBase::SharedPtr timer_; - rclcpp::Publisher::SharedPtr publisher_; - size_t count_; -}; - -int main(int argc, char *argv[]) -{ - rclcpp::init(argc, argv); - rclcpp::spin(std::make_shared()); - rclcpp::shutdown(); - return 0; -} \ No newline at end of file diff --git a/mros2_echoback_twist_string/src/sub_node.cpp b/mros2_echoback_twist_string/src/sub_node.cpp deleted file mode 100644 index 63ee554..0000000 --- a/mros2_echoback_twist_string/src/sub_node.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "geometry_msgs/msg/twist.hpp" -#include "std_msgs/msg/string.hpp" - - -using std::placeholders::_1; - -class Subscriber : public rclcpp::Node -{ -public: - Subscriber() : Node("mros2_sub") - { - subscriber_ = this->create_subscription("to_linux", rclcpp::QoS(10).best_effort(), std::bind(&Subscriber::topic_callback, this, _1)); - } - -private: - void topic_callback(const std_msgs::msg::String::SharedPtr message) const - { - auto reconverted_message = geometry_msgs::msg::Twist(); - reconverted_message.linear.x = std::stod(message->data.substr(0,8)); - reconverted_message.linear.y = std::stod(message->data.substr(8,8)); - reconverted_message.linear.z = std::stod(message->data.substr(16,8)); - reconverted_message.angular.x = std::stod(message->data.substr(24,8)); - reconverted_message.angular.y = std::stod(message->data.substr(32,8)); - reconverted_message.angular.z = std::stod(message->data.substr(40,8)); - - RCLCPP_INFO(this->get_logger(), "Subscribed msg: { linear: { x: %f, y: %f, z: %f }, angular: { x: %f, y: %f, z: %f } }", reconverted_message.linear.x, reconverted_message.linear.y, reconverted_message.linear.z, reconverted_message.angular.x, reconverted_message.angular.y, reconverted_message.angular.z); - } - rclcpp::Subscription::SharedPtr subscriber_; -}; - - -int main(int argc, char *argv[]) -{ - rclcpp::init(argc, argv); - rclcpp::spin(std::make_shared()); - rclcpp::shutdown(); - return 0; -} \ No newline at end of file diff --git a/mros2_echoback_twist_string_calc_time/CMakeLists.txt b/mros2_echoback_twist_string_calc_time/CMakeLists.txt deleted file mode 100644 index 08089a7..0000000 --- a/mros2_echoback_twist_string_calc_time/CMakeLists.txt +++ /dev/null @@ -1,63 +0,0 @@ -cmake_minimum_required(VERSION 3.5) -project(mros2_echoback_twist_string_calc_time) - - -# Default to C99 -if(NOT CMAKE_C_STANDARD) - set(CMAKE_C_STANDARD 99) -endif() - -# Default to C++14 -if(NOT CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 14) -endif() - -if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_compile_options(-Wall -Wextra -Wpedantic) -endif() - -# find dependencies -find_package(ament_cmake REQUIRED) -find_package(rclcpp REQUIRED) -find_package(geometry_msgs REQUIRED) -find_package(std_msgs REQUIRED) -# uncomment the following section in order to fill in -# further dependencies manually. -# find_package( REQUIRED) - -add_executable(pub_node src/pub_node.cpp) -ament_target_dependencies(pub_node rclcpp geometry_msgs std_msgs) - -add_executable(sub_node src/sub_node.cpp) -ament_target_dependencies(sub_node rclcpp geometry_msgs std_msgs) - -target_include_directories(pub_node PUBLIC - $ - $) - -target_include_directories(sub_node PUBLIC - $ - $) - -install(TARGETS pub_node - DESTINATION lib/${PROJECT_NAME}) -install(TARGETS sub_node - DESTINATION lib/${PROJECT_NAME}) - -install(DIRECTORY - launch - DESTINATION share/${PROJECT_NAME} -) - -if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - # the following line skips the linter which checks for copyrights - # uncomment the line when a copyright and license is not present in all source files - #set(ament_cmake_copyright_FOUND TRUE) - # the following line skips cpplint (only works in a git repo) - # uncomment the line when this package is not in a git repo - #set(ament_cmake_cpplint_FOUND TRUE) - ament_lint_auto_find_test_dependencies() -endif() - -ament_package() \ No newline at end of file diff --git a/mros2_echoback_twist_string_calc_time/launch/launch_pubsub.py b/mros2_echoback_twist_string_calc_time/launch/launch_pubsub.py deleted file mode 100644 index b345aba..0000000 --- a/mros2_echoback_twist_string_calc_time/launch/launch_pubsub.py +++ /dev/null @@ -1,21 +0,0 @@ -from launch import LaunchDescription -from launch_ros.actions import Node - -# Note: `node_`, `prefix` and `output` will be removed on Foxy -def generate_launch_description(): - return LaunchDescription([ - Node( - package='mros2_echoback_twist_string_calc_time', - node_executable='pub_node', - node_name='pub_mros2', - prefix=['stdbuf -o L'], - output="screen" - ), - Node( - package='mros2_echoback_twist_string_calc_time', - node_executable='sub_node', - node_name='mros2_sub', - prefix=['stdbuf -o L'], - output="screen" - ) - ]) \ No newline at end of file diff --git a/mros2_echoback_twist_string_calc_time/package.xml b/mros2_echoback_twist_string_calc_time/package.xml deleted file mode 100644 index aa815e0..0000000 --- a/mros2_echoback_twist_string_calc_time/package.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - mros2_echoback_twist_string_calc_time - 0.0.0 - TODO: Package description - uden - TODO: License declaration - - ament_cmake -rclcpp -geometry_msgs -std_msgs -rclcpp -geometry_msgs -std_msgs - ament_lint_auto - ament_lint_common - - - ament_cmake - - \ No newline at end of file diff --git a/mros2_echoback_twist_string_calc_time/src/pub_node.cpp b/mros2_echoback_twist_string_calc_time/src/pub_node.cpp deleted file mode 100644 index ea32f60..0000000 --- a/mros2_echoback_twist_string_calc_time/src/pub_node.cpp +++ /dev/null @@ -1,63 +0,0 @@ -#include -#include -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "geometry_msgs/msg/twist.hpp" -#include "std_msgs/msg/string.hpp" - -using namespace std::chrono_literals; - -/* This example creates a subclass of Node and uses std::bind() to register a -* member function as a callback from the timer. */ - -class Publisher : public rclcpp::Node -{ -public: - Publisher() - : Node("pub_mros2"), count_(0) - { - publisher_ = this->create_publisher("to_stm", 10); - timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); - } - -private: - std::array publogs; - void timer_callback() - { - if (count_ < 201){ - auto message = geometry_msgs::msg::Twist(); - auto converted_message = std_msgs::msg::String(); - publogs[count_] = this->get_clock()->now(); - message.linear.x = count_++/10.0; - message.linear.y = count_/10.0; - message.linear.z = count_/10.0; - message.angular.x = count_/50.0; - message.angular.y = count_/50.0; - message.angular.z = count_/50.0; - converted_message.data = std::to_string(message.linear.x) + std::to_string(message.linear.y) + std::to_string(message.linear.z) + std::to_string(message.angular.x) + std::to_string(message.angular.y) + std::to_string(message.angular.z); - publisher_->publish(converted_message); - } else if (count_ == 201) { - std::ofstream writing_file; - std::string filename = "twist_string_publog.txt"; - writing_file.open(filename, std::ios::out); - for (int i=0; i<200; i++){ - const std::string writing_text = std::to_string(publogs[i].nanoseconds()); - writing_file << writing_text << std::endl; - } - } - } - rclcpp::TimerBase::SharedPtr timer_; - rclcpp::Publisher::SharedPtr publisher_; - size_t count_; -}; - -int main(int argc, char *argv[]) -{ - rclcpp::init(argc, argv); - rclcpp::spin(std::make_shared()); - rclcpp::shutdown(); - return 0; -} \ No newline at end of file diff --git a/mros2_echoback_twist_string_calc_time/src/sub_node.cpp b/mros2_echoback_twist_string_calc_time/src/sub_node.cpp deleted file mode 100644 index 7b5dea6..0000000 --- a/mros2_echoback_twist_string_calc_time/src/sub_node.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#include -#include -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "geometry_msgs/msg/twist.hpp" -#include "std_msgs/msg/string.hpp" - - -using std::placeholders::_1; - - -class Subscriber : public rclcpp::Node -{ -public: - uint32_t count_ = 0; - Subscriber() : Node("mros2_sub") - { - subscriber_ = this->create_subscription("to_linux", rclcpp::QoS(10).best_effort(), std::bind(&Subscriber::topic_callback, this, _1)); - } - -private: - std::array sublogs; - void topic_callback(const std_msgs::msg::String::SharedPtr message) - { - if (count_ < 200){ - auto reconverted_message = geometry_msgs::msg::Twist(); - reconverted_message.linear.x = std::stod(message->data.substr(0,8)); - reconverted_message.linear.y = std::stod(message->data.substr(8,8)); - reconverted_message.linear.z = std::stod(message->data.substr(16,8)); - reconverted_message.angular.x = std::stod(message->data.substr(24,8)); - reconverted_message.angular.y = std::stod(message->data.substr(32,8)); - reconverted_message.angular.z = std::stod(message->data.substr(40,8)); - sublogs[count_] = this->get_clock()->now(); - count_++; - } else { - std::ofstream writing_file; - std::string filename = "twist_string_sublog.txt"; - writing_file.open(filename, std::ios::out); - for (int i=0; i<200; i++){ - const std::string writing_text = std::to_string(sublogs[i].nanoseconds()); - writing_file << writing_text << std::endl; - } - } - } - rclcpp::Subscription::SharedPtr subscriber_; -}; - - -int main(int argc, char *argv[]) -{ - rclcpp::init(argc, argv); - rclcpp::spin(std::make_shared()); - rclcpp::shutdown(); - return 0; -} \ No newline at end of file diff --git a/twist_publog.txt b/twist_publog.txt deleted file mode 100644 index da49b7f..0000000 --- a/twist_publog.txt +++ /dev/null @@ -1,200 +0,0 @@ -1642086629580083377 -1642086630580071656 -1642086631579940352 -1642086632579650592 -1642086633579784626 -1642086634579727504 -1642086635579886210 -1642086636579820991 -1642086637579643110 -1642086638579845142 -1642086639579874883 -1642086640579735256 -1642086641579835049 -1642086642579932453 -1642086643579922051 -1642086644579794219 -1642086645579794372 -1642086646579878825 -1642086647579614089 -1642086648579596002 -1642086649579784823 -1642086650579760181 -1642086651579746486 -1642086652579719307 -1642086653579563115 -1642086654579603899 -1642086655579601147 -1642086656579711003 -1642086657579488154 -1642086658579692377 -1642086659579661044 -1642086660579651971 -1642086661579736818 -1642086662579657217 -1642086663579541415 -1642086664579638430 -1642086665579559401 -1642086666579609197 -1642086667579513526 -1642086668579593953 -1642086669579452617 -1642086670579434967 -1642086671579755094 -1642086672579472408 -1642086673579478403 -1642086674579452830 -1642086675579542068 -1642086676579550458 -1642086677579540476 -1642086678579530203 -1642086679579528521 -1642086680579522855 -1642086681579526922 -1642086682579495125 -1642086683579479965 -1642086684579485654 -1642086685579579940 -1642086686579619671 -1642086687579424419 -1642086688579476678 -1642086689579361820 -1642086690579572738 -1642086691579591264 -1642086692579570209 -1642086693579506993 -1642086694579250464 -1642086695579374606 -1642086696579296868 -1642086697579374245 -1642086698579361143 -1642086699579326301 -1642086700579240203 -1642086701579346858 -1642086702579331342 -1642086703579455900 -1642086704579233879 -1642086705579238447 -1642086706579105182 -1642086707579192685 -1642086708579437050 -1642086709579256733 -1642086710579178764 -1642086711579260080 -1642086712579359552 -1642086713579396730 -1642086714579063753 -1642086715579115224 -1642086716579213439 -1642086717579228775 -1642086718579141803 -1642086719579120587 -1642086720579181855 -1642086721579062269 -1642086722579089378 -1642086723579161881 -1642086724579290910 -1642086725579133556 -1642086726579320315 -1642086727579218060 -1642086728579052620 -1642086729579123116 -1642086730579203762 -1642086731579023653 -1642086732579006765 -1642086733579079646 -1642086734578987567 -1642086735578924932 -1642086736578956804 -1642086737579052695 -1642086738578898708 -1642086739578903540 -1642086740579038893 -1642086741578917135 -1642086742578929690 -1642086743578924423 -1642086744579154038 -1642086745578910305 -1642086746579134279 -1642086747578858208 -1642086748579016659 -1642086749578827166 -1642086750578774293 -1642086751578746329 -1642086752578817454 -1642086753578779769 -1642086754578775852 -1642086755578716663 -1642086756578744042 -1642086757578814507 -1642086758578801643 -1642086759578811666 -1642086760578768995 -1642086761578775191 -1642086762578738275 -1642086763578987679 -1642086764578927666 -1642086765578729917 -1642086766578939970 -1642086767578679936 -1642086768578671793 -1642086769578552399 -1642086770578659409 -1642086771578603381 -1642086772578644496 -1642086773578644183 -1642086774578631281 -1642086775578531189 -1642086776578575836 -1642086777578578115 -1642086778578615010 -1642086779578629926 -1642086780578636700 -1642086781578614721 -1642086782578557777 -1642086783578661207 -1642086784578822326 -1642086785578497366 -1642086786578804407 -1642086787578497131 -1642086788578791269 -1642086789578736686 -1642086790578771034 -1642086791578788554 -1642086792578727116 -1642086793578736776 -1642086794578721322 -1642086795578472255 -1642086796578387357 -1642086797578369775 -1642086798578416796 -1642086799578487251 -1642086800578365757 -1642086801578642879 -1642086802578316461 -1642086803578448420 -1642086804578356402 -1642086805578350533 -1642086806578380337 -1642086807578226506 -1642086808578299134 -1642086809578264760 -1642086810578265775 -1642086811578194110 -1642086812578230351 -1642086813578245421 -1642086814578245870 -1642086815578253137 -1642086816578245577 -1642086817578266544 -1642086818578219618 -1642086819578232719 -1642086820578175103 -1642086821578240023 -1642086822578172016 -1642086823578185735 -1642086824578135708 -1642086825578487155 -1642086826578123278 -1642086827578119067 -1642086828578111843 diff --git a/twist_string_publog.txt b/twist_string_publog.txt deleted file mode 100644 index cc32212..0000000 --- a/twist_string_publog.txt +++ /dev/null @@ -1,200 +0,0 @@ -1642086275756968173 -1642086276756954128 -1642086277757022962 -1642086278756916323 -1642086279757006626 -1642086280757008151 -1642086281757000155 -1642086282757000284 -1642086283756995748 -1642086284756977934 -1642086285756960347 -1642086286757051533 -1642086287756842399 -1642086288756852300 -1642086289757076755 -1642086290756932671 -1642086291756930606 -1642086292757042803 -1642086293756886310 -1642086294756896650 -1642086295756893007 -1642086296756982770 -1642086297757014706 -1642086298756711872 -1642086299756771413 -1642086300756789105 -1642086301756846537 -1642086302756812721 -1642086303756819396 -1642086304756771196 -1642086305756817660 -1642086306756687262 -1642086307756805414 -1642086308756735238 -1642086309756901849 -1642086310756882433 -1642086311756753783 -1642086312756736243 -1642086313756590185 -1642086314756873567 -1642086315756736986 -1642086316756707910 -1642086317756857606 -1642086318756535967 -1642086319756576808 -1642086320756784108 -1642086321756648516 -1642086322756566399 -1642086323756638563 -1642086324756663140 -1642086325756643193 -1642086326756628954 -1642086327756519837 -1642086328756629276 -1642086329756599758 -1642086330756753872 -1642086331756671076 -1642086332756725845 -1642086333756549203 -1642086334756721783 -1642086335756506084 -1642086336756568359 -1642086337756652938 -1642086338756512283 -1642086339756395364 -1642086340756512608 -1642086341756511946 -1642086342756504867 -1642086343756385479 -1642086344756504087 -1642086345756591893 -1642086346756484065 -1642086347756585201 -1642086348756476846 -1642086349756397098 -1642086350756536832 -1642086351756556281 -1642086352756438705 -1642086353756420205 -1642086354756446470 -1642086355756404388 -1642086356756194981 -1642086357756194106 -1642086358756178833 -1642086359756223264 -1642086360756177815 -1642086361756155282 -1642086362756250471 -1642086363756141514 -1642086364756152939 -1642086365756133828 -1642086366756150937 -1642086367756141788 -1642086368756109689 -1642086369756038794 -1642086370756176803 -1642086371756421686 -1642086372756089766 -1642086373756237088 -1642086374756127153 -1642086375756088153 -1642086376756377651 -1642086377756060551 -1642086378756054491 -1642086379755985989 -1642086380756071768 -1642086381756161286 -1642086382756063547 -1642086383756007685 -1642086384756184723 -1642086385755975527 -1642086386756046253 -1642086387756019922 -1642086388756138030 -1642086389756018742 -1642086390756008731 -1642086391755882925 -1642086392755911151 -1642086393755896493 -1642086394755897389 -1642086395755928922 -1642086396755895438 -1642086397756038692 -1642086398755869098 -1642086399756081362 -1642086400755927534 -1642086401755932327 -1642086402755832860 -1642086403755982036 -1642086404755986635 -1642086405755838105 -1642086406755984327 -1642086407755843690 -1642086408755880729 -1642086409755967223 -1642086410756111727 -1642086411755825746 -1642086412755698119 -1642086413755699855 -1642086414755792433 -1642086415755925692 -1642086416755895152 -1642086417755789678 -1642086418755646668 -1642086419755734504 -1642086420755744050 -1642086421755731443 -1642086422755766156 -1642086423755722042 -1642086424755712213 -1642086425755693571 -1642086426755818479 -1642086427755625379 -1642086428755692199 -1642086429755785957 -1642086430755642249 -1642086431755548262 -1642086432755778994 -1642086433755607441 -1642086434755687527 -1642086435755741742 -1642086436755743180 -1642086437755750073 -1642086438755830577 -1642086439755847113 -1642086440755663028 -1642086441755594936 -1642086442755703271 -1642086443755680393 -1642086444755683250 -1642086445755698262 -1642086446755681998 -1642086447755541503 -1642086448755638932 -1642086449755767791 -1642086450755641762 -1642086451755624417 -1642086452755511871 -1642086453755593011 -1642086454755598091 -1642086455755520545 -1642086456755587172 -1642086457755483437 -1642086458755584063 -1642086459755584514 -1642086460755560893 -1642086461755362079 -1642086462755416149 -1642086463755398797 -1642086464755521955 -1642086465755402604 -1642086466755390404 -1642086467755441605 -1642086468755492884 -1642086469755466409 -1642086470755382190 -1642086471755389353 -1642086472755317425 -1642086473755362920 -1642086474755368099 diff --git a/twist_string_sublog.txt b/twist_string_sublog.txt deleted file mode 100644 index 9874b67..0000000 --- a/twist_string_sublog.txt +++ /dev/null @@ -1,200 +0,0 @@ -1642086275758222672 -1642086276758062163 -1642086277758063593 -1642086278758355570 -1642086279758169290 -1642086280758125757 -1642086281758089845 -1642086282758160069 -1642086283758180291 -1642086284758195085 -1642086285758060132 -1642086286758244310 -1642086287758262737 -1642086288758106063 -1642086289758379323 -1642086290758027339 -1642086291758391548 -1642086292758145051 -1642086293758220660 -1642086294758122415 -1642086295758198819 -1642086296758442533 -1642086297758134427 -1642086298757932528 -1642086299758059243 -1642086300758055768 -1642086301758094431 -1642086302758022156 -1642086303757902191 -1642086304757842147 -1642086305757965995 -1642086306758113833 -1642086307758072296 -1642086308757499884 -1642086309758135500 -1642086310757903544 -1642086311758050803 -1642086312758041179 -1642086313757638762 -1642086314758181152 -1642086315758212768 -1642086316758017470 -1642086317758020833 -1642086318757643385 -1642086319757889658 -1642086320758024455 -1642086321757934905 -1642086322757913671 -1642086323757938895 -1642086324757932412 -1642086325757928040 -1642086326757813573 -1642086327757869862 -1642086328757914627 -1642086329757644296 -1642086330758197895 -1642086331758117730 -1642086332758001643 -1642086333757911752 -1642086334758051663 -1642086335757383369 -1642086336758087709 -1642086337757679973 -1642086338757587830 -1642086339757573825 -1642086340757818268 -1642086341757836614 -1642086342757545736 -1642086343757641371 -1642086344757812984 -1642086345758072072 -1642086346757927753 -1642086347757904777 -1642086348757798601 -1642086349757516184 -1642086350757878682 -1642086351758045374 -1642086352757943088 -1642086353757488400 -1642086354757674072 -1642086355757633193 -1642086356757097966 -1642086357757170296 -1642086358757068348 -1642086359757156265 -1642086360756975607 -1642086361757037617 -1642086362756771541 -1642086363757039551 -1642086364757063809 -1642086365757073669 -1642086366757043817 -1642086367757178866 -1642086368756968866 -1642086369756628086 -1642086370757626665 -1642086371757580363 -1642086372756854339 -1642086373757371332 -1642086374756926154 -1642086375756910542 -1642086376757893543 -1642086377757105675 -1642086378757005467 -1642086379756585278 -1642086380757000126 -1642086381757191925 -1642086382757032427 -1642086383756812953 -1642086384757444274 -1642086385756757713 -1642086386756862294 -1642086387756948308 -1642086388757367260 -1642086389756847623 -1642086390756821864 -1642086391756402441 -1642086392756873137 -1642086393756784135 -1642086394756935103 -1642086395756723350 -1642086396756730933 -1642086397757133412 -1642086398756617207 -1642086399757228502 -1642086400757311018 -1642086401756993594 -1642086402756664656 -1642086403757189190 -1642086404757153527 -1642086405756900123 -1642086406757217078 -1642086407756836658 -1642086408756956352 -1642086409757168926 -1642086410757274095 -1642086411756958721 -1642086412756191803 -1642086413756410930 -1642086414756772153 -1642086415757019252 -1642086416757061561 -1642086417756949189 -1642086418756180519 -1642086419756673475 -1642086420756746582 -1642086421756716882 -1642086422756803539 -1642086423756896512 -1642086424756724493 -1642086425756648154 -1642086426757110134 -1642086427756485388 -1642086428756540061 -1642086429757049013 -1642086430756691785 -1642086431756195815 -1642086432757213386 -1642086433756660409 -1642086434756569002 -1642086435757015091 -1642086436757022099 -1642086437757040987 -1642086438757009388 -1642086439757025007 -1642086440756733330 -1642086441756748487 -1642086442756928456 -1642086443757148137 -1642086444756946705 -1642086445757148352 -1642086446756907419 -1642086447756746250 -1642086448756861351 -1642086449756862744 -1642086450756731264 -1642086451756862773 -1642086452756948238 -1642086453756778162 -1642086454756839632 -1642086455756662739 -1642086456756743581 -1642086457756639764 -1642086458756807090 -1642086459756708633 -1642086460756665246 -1642086461756502844 -1642086462756550099 -1642086463756587197 -1642086464756649049 -1642086465756830033 -1642086466756626610 -1642086467756042103 -1642086468756706239 -1642086469756616129 -1642086470756607463 -1642086471756780599 -1642086472756465890 -1642086473756569404 -1642086474756578259 diff --git a/twist_sublog.txt b/twist_sublog.txt deleted file mode 100644 index e31a671..0000000 --- a/twist_sublog.txt +++ /dev/null @@ -1,200 +0,0 @@ -1642086629581145980 -1642086630581061521 -1642086631580981334 -1642086632580089547 -1642086633580724909 -1642086634580746989 -1642086635580880808 -1642086636580499482 -1642086637580109875 -1642086638580923857 -1642086639580985222 -1642086640580750929 -1642086641580935326 -1642086642581038151 -1642086643581024958 -1642086644580849891 -1642086645580801854 -1642086646580893578 -1642086647580600234 -1642086648580535137 -1642086649580735947 -1642086650580879116 -1642086651580716551 -1642086652580669371 -1642086653580528269 -1642086654580611988 -1642086655580595334 -1642086656580732943 -1642086657579906550 -1642086658580841295 -1642086659580541091 -1642086660580534012 -1642086661580668533 -1642086662580653407 -1642086663580547867 -1642086664580654910 -1642086665580565175 -1642086666580596766 -1642086667580518032 -1642086668580594534 -1642086669580146506 -1642086670580440370 -1642086671580703605 -1642086672580408282 -1642086673580395077 -1642086674580332299 -1642086675580471925 -1642086676580505817 -1642086677580543158 -1642086678580535758 -1642086679580537365 -1642086680580508437 -1642086681580495073 -1642086682580486357 -1642086683580484137 -1642086684580449140 -1642086685580579634 -1642086686580566978 -1642086687580344982 -1642086688580489243 -1642086689580295785 -1642086690580639149 -1642086691580641012 -1642086692580669170 -1642086693580468003 -1642086694580282692 -1642086695580429692 -1642086696580306674 -1642086697580399972 -1642086698580383062 -1642086699580387054 -1642086700580283440 -1642086701580507573 -1642086702580364565 -1642086703580839626 -1642086704580377068 -1642086705580397131 -1642086706579645113 -1642086707580548365 -1642086708580592590 -1642086709580324356 -1642086710580334508 -1642086711580428532 -1642086712580763847 -1642086713580412899 -1642086714580024281 -1642086715580128942 -1642086716580357649 -1642086717580376602 -1642086718580300251 -1642086719580251707 -1642086720580345751 -1642086721580447732 -1642086722580231388 -1642086723580170250 -1642086724580342497 -1642086725580191167 -1642086726580257274 -1642086727580217600 -1642086728580023835 -1642086729580258827 -1642086730580251590 -1642086731580044173 -1642086732580065101 -1642086733580130561 -1642086734579904580 -1642086735579842494 -1642086736579867012 -1642086737580034189 -1642086738579895519 -1642086739579757495 -1642086740580013817 -1642086741579870572 -1642086742579846598 -1642086743579930113 -1642086744580104158 -1642086745579902332 -1642086746580130232 -1642086747579839961 -1642086748579967516 -1642086749579275385 -1642086750579223699 -1642086751579478216 -1642086752579540790 -1642086753579589300 -1642086754579623360 -1642086755579263172 -1642086756579360985 -1642086757579800702 -1642086758579786684 -1642086759579798315 -1642086760579810067 -1642086761579769277 -1642086762579733579 -1642086763579977482 -1642086764579932498 -1642086765579692453 -1642086766579919401 -1642086767579517246 -1642086768579400610 -1642086769578998679 -1642086770579382115 -1642086771579332403 -1642086772579336667 -1642086773579378027 -1642086774579352173 -1642086775579392222 -1642086776579305935 -1642086777579252595 -1642086778579392235 -1642086779579662763 -1642086780579629920 -1642086781579642078 -1642086782579430522 -1642086783579597803 -1642086784579841779 -1642086785579282655 -1642086786579785515 -1642086787579354390 -1642086788579841495 -1642086789579795136 -1642086790579809344 -1642086791579824637 -1642086792579787464 -1642086793579783353 -1642086794579695746 -1642086795579203813 -1642086796579121063 -1642086797579094829 -1642086798579286107 -1642086799579435105 -1642086800579223469 -1642086801579654842 -1642086802579001957 -1642086803579433272 -1642086804579051965 -1642086805579106640 -1642086806579082864 -1642086807578649527 -1642086808579076245 -1642086809579034461 -1642086810579005374 -1642086811578686641 -1642086812579011075 -1642086813579052083 -1642086814579043726 -1642086815578729195 -1642086816579110886 -1642086817579168656 -1642086818578944077 -1642086819579051131 -1642086820579053578 -1642086821579141837 -1642086822579122552 -1642086823578928282 -1642086824578869752 -1642086825579547052 -1642086826578850995 -1642086827578927881 -1642086828578866187 From 67de1e78a10e4a5ea1be6c389657e7d63eac4e0e Mon Sep 17 00:00:00 2001 From: MEIP-users Date: Mon, 14 Feb 2022 21:53:59 +0900 Subject: [PATCH 51/56] clean apps for v0.2.4 --- .gitignore | 4 +- mros2_echoback_float32/src/pub_node.cpp | 43 -------------- mros2_echoback_header/src/pub_node.cpp | 44 --------------- mros2_echoback_header/src/sub_node.cpp | 34 ----------- mros2_echoback_joint_state/src/pub_node.cpp | 29 +++++----- mros2_echoback_joint_state/src/sub_node.cpp | 2 +- mros2_echoback_twist/src/pub_node.cpp | 48 ---------------- mros2_echoback_uint16/src/sub_node.cpp | 34 ----------- .../CMakeLists.txt | 15 +---- .../launch/launch_pubsub.py | 11 +--- .../package.xml | 6 +- mros2_pub_pose/src/pub_node.cpp | 56 +++++++++++++++++++ .../CMakeLists.txt | 11 +--- .../launch/launch_pubsub.py | 9 +-- .../package.xml | 2 +- .../src/pub_node.cpp | 0 .../CMakeLists.txt | 13 +---- .../launch/launch_pubsub.py | 9 +-- .../package.xml | 2 +- .../src/sub_node.cpp | 0 .../CMakeLists.txt | 11 +--- .../launch/launch_pubsub.py | 11 +--- .../package.xml | 2 +- .../src/sub_node.cpp | 4 +- 24 files changed, 96 insertions(+), 304 deletions(-) delete mode 100644 mros2_echoback_float32/src/pub_node.cpp delete mode 100644 mros2_echoback_header/src/pub_node.cpp delete mode 100644 mros2_echoback_header/src/sub_node.cpp delete mode 100644 mros2_echoback_twist/src/pub_node.cpp delete mode 100644 mros2_echoback_uint16/src/sub_node.cpp rename {mros2_echoback_float32 => mros2_pub_pose}/CMakeLists.txt (76%) rename {mros2_echoback_float32 => mros2_pub_pose}/launch/launch_pubsub.py (56%) rename {mros2_echoback_float32 => mros2_pub_pose}/package.xml (84%) create mode 100644 mros2_pub_pose/src/pub_node.cpp rename {mros2_echoback_header => mros2_pub_uint16}/CMakeLists.txt (81%) rename {mros2_echoback_header => mros2_pub_uint16}/launch/launch_pubsub.py (61%) rename {mros2_echoback_header => mros2_pub_uint16}/package.xml (95%) rename {mros2_echoback_uint16 => mros2_pub_uint16}/src/pub_node.cpp (100%) rename {mros2_echoback_uint16 => mros2_sub_float32}/CMakeLists.txt (81%) rename {mros2_echoback_uint16 => mros2_sub_float32}/launch/launch_pubsub.py (61%) rename {mros2_echoback_uint16 => mros2_sub_float32}/package.xml (95%) rename {mros2_echoback_float32 => mros2_sub_float32}/src/sub_node.cpp (100%) rename {mros2_echoback_twist => mros2_sub_twist}/CMakeLists.txt (81%) rename {mros2_echoback_twist => mros2_sub_twist}/launch/launch_pubsub.py (56%) rename {mros2_echoback_twist => mros2_sub_twist}/package.xml (95%) rename {mros2_echoback_twist => mros2_sub_twist}/src/sub_node.cpp (86%) diff --git a/.gitignore b/.gitignore index f2afc7a..0214091 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ log/ .vscode/ build/ -install/ \ No newline at end of file +install/ +git rm --cached -r mros2_echoback_joint_state +git rm --cached -r mros2_echoback_odometry \ No newline at end of file diff --git a/mros2_echoback_float32/src/pub_node.cpp b/mros2_echoback_float32/src/pub_node.cpp deleted file mode 100644 index 2cf6b1a..0000000 --- a/mros2_echoback_float32/src/pub_node.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "std_msgs/msg/float32.hpp" - -using namespace std::chrono_literals; - -/* This example creates a subclass of Node and uses std::bind() to register a -* member function as a callback from the timer. */ - -class Publisher : public rclcpp::Node -{ -public: - Publisher() - : Node("pub_mros2"), count_(-3.50) - { - publisher_ = this->create_publisher("to_stm", 10); - timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); - } - -private: - void timer_callback() - { - auto message = std_msgs::msg::Float32(); - message.data = count_++/10.0; - RCLCPP_INFO(this->get_logger(), "Publishing msg: %f", message.data); - publisher_->publish(message); - } - rclcpp::TimerBase::SharedPtr timer_; - rclcpp::Publisher::SharedPtr publisher_; - float count_; -}; - -int main(int argc, char * argv[]) -{ - rclcpp::init(argc, argv); - rclcpp::spin(std::make_shared()); - rclcpp::shutdown(); - return 0; -} diff --git a/mros2_echoback_header/src/pub_node.cpp b/mros2_echoback_header/src/pub_node.cpp deleted file mode 100644 index f1a3ec0..0000000 --- a/mros2_echoback_header/src/pub_node.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "std_msgs/msg/header.hpp" - -using namespace std::chrono_literals; - -/* This example creates a subclass of Node and uses std::bind() to register a -* member function as a callback from the timer. */ - -class Publisher : public rclcpp::Node -{ -public: - Publisher() - : Node("pub_mros2"), count_(0) - { - publisher_ = this->create_publisher("to_stm", 10); - timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); - } - -private: - void timer_callback() - { - auto message = std_msgs::msg::Header(); - message.frame_id = "Hello, world! " + std::to_string(count_++); - message.stamp = this->get_clock()->now(); - RCLCPP_INFO(this->get_logger(), "Publishing msg: { frame_id: '%s', sec: %d, nanosec: %u } ", message.frame_id.c_str(), message.stamp.sec, message.stamp.nanosec ); - publisher_->publish(message); - } - rclcpp::TimerBase::SharedPtr timer_; - rclcpp::Publisher::SharedPtr publisher_; - size_t count_; -}; - -int main(int argc, char * argv[]) -{ - rclcpp::init(argc, argv); - rclcpp::spin(std::make_shared()); - rclcpp::shutdown(); - return 0; -} diff --git a/mros2_echoback_header/src/sub_node.cpp b/mros2_echoback_header/src/sub_node.cpp deleted file mode 100644 index a4f3044..0000000 --- a/mros2_echoback_header/src/sub_node.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "std_msgs/msg/header.hpp" - -using std::placeholders::_1; - -class Subscriber : public rclcpp::Node -{ -public: - Subscriber() : Node("mros2_sub") - { - subscriber_ = this->create_subscription("to_linux", rclcpp::QoS(10).best_effort(), std::bind(&Subscriber::topic_callback, this, _1)); - } - -private: - void topic_callback(const std_msgs::msg::Header::SharedPtr msg) const - { - RCLCPP_INFO(this->get_logger(), "Subscribed msg: { frame_id: '%s',sec: %d, nanosec: %u }", msg->frame_id.c_str(), msg->stamp.sec, msg->stamp.nanosec ); - } - rclcpp::Subscription::SharedPtr subscriber_; -}; - - -int main(int argc, char *argv[]) -{ - rclcpp::init(argc, argv); - rclcpp::spin(std::make_shared()); - rclcpp::shutdown(); - return 0; -} \ No newline at end of file diff --git a/mros2_echoback_joint_state/src/pub_node.cpp b/mros2_echoback_joint_state/src/pub_node.cpp index 523396a..fb22c13 100644 --- a/mros2_echoback_joint_state/src/pub_node.cpp +++ b/mros2_echoback_joint_state/src/pub_node.cpp @@ -25,21 +25,22 @@ class Publisher : public rclcpp::Node void timer_callback() { auto message = sensor_msgs::msg::JointState(); - message.header.frame_id = "JointState"; + message.header.frame_id = "0"; message.header.stamp = this->get_clock()->now(); - for (int i=0;i<3;i++){ - message.name.push_back(std::to_string(count_++)); - } - for (int i=0;i<3;i++){ - message.position.push_back(count_++/1.0); - } - for (int i=0;i<3;i++){ - message.velocity.push_back(count_++/10.0); - } - for (int i=0;i<3;i++){ - message.effort.push_back(count_++/20.0); - } - RCLCPP_INFO(this->get_logger(), "Publishing msg: { frame_id: '%s', sec: %d, nanosec: %u, name: { %s, %s, %s }, position: { x: %f, y: %f, z: %f }, velocity: { x: %f, y: %f, z: %f }, effort: { x: %f, y: %f, z: %f } }", message.header.frame_id.c_str(), message.header.stamp.sec, message.header.stamp.nanosec, message.name[0].c_str(), message.name[1].c_str(), message.name[2].c_str(), message.position[0], message.position[1], message.position[2], message.velocity[0], message.velocity[1], message.velocity[2], message.effort[0], message.effort[1], message.effort[2] ); + message.name.resize(2); + message.name[0] = "joint1"; + message.name[1] = "joint2"; + message.position.resize(2); + message.position[0] = -1.0*(count_/40.0); + message.position[1] = 2.0*(count_/40.0); + message.velocity.resize(2); + message.velocity[0] = -1.0*(count_/40.0); + message.velocity[1] = 2.0*(count_/40.0); + message.effort.resize(1); + message.effort[0] = -1.0*(count_/40.0); + //message.effort[1] = 2.0*(count_/40.0); + count_++; + RCLCPP_INFO(this->get_logger(), "Publishing msg: { frame_id: '%s', sec: %d, nanosec: %u, name: { %s, %s }, position: { x: %f, y: %f }, velocity: { x: %f, y: %f }, effort: { x: %f, y: %f } }", message.header.frame_id.c_str(), message.header.stamp.sec, message.header.stamp.nanosec, message.name[0].c_str(), message.name[1].c_str(), message.position[0], message.position[1], message.velocity[0], message.velocity[1], message.effort[0], message.effort[1] ); publisher_->publish(message); } rclcpp::TimerBase::SharedPtr timer_; diff --git a/mros2_echoback_joint_state/src/sub_node.cpp b/mros2_echoback_joint_state/src/sub_node.cpp index 837bea3..5c1ec2d 100644 --- a/mros2_echoback_joint_state/src/sub_node.cpp +++ b/mros2_echoback_joint_state/src/sub_node.cpp @@ -19,7 +19,7 @@ class Subscriber : public rclcpp::Node private: void topic_callback(const sensor_msgs::msg::JointState::SharedPtr message) const { - RCLCPP_INFO(this->get_logger(), "Subscribed msg: { frame_id: '%s', sec: %d, nanosec: %u, name: { %s, %s, %s }, position: { x: %f, y: %f, z: %f }, velocity: { x: %f, y: %f, z: %f }, effort: { x: %f, y: %f, z: %f } }", message->header.frame_id.c_str(), message->header.stamp.sec, message->header.stamp.nanosec, message->name[0].c_str(), message->name[1].c_str(), message->name[2].c_str(), message->position[0], message->position[1], message->position[2], message->velocity[0], message->velocity[1], message->velocity[2], message->effort[0], message->effort[1], message->effort[2] ); + RCLCPP_INFO(this->get_logger(), "Subscribed msg: { frame_id: '%s', sec: %d, nanosec: %u, name: { %s, %s }, position: { x: %f, y: %f }, velocity: { x: %f, y: %f }, effort: { x: %f, y: %f } }", message->header.frame_id.c_str(), message->header.stamp.sec, message->header.stamp.nanosec, message->name[0].c_str(), message->name[1].c_str(), message->position[0], message->position[1], message->velocity[0], message->velocity[1], message->effort[0], message->effort[1] ); } rclcpp::Subscription::SharedPtr subscriber_; }; diff --git a/mros2_echoback_twist/src/pub_node.cpp b/mros2_echoback_twist/src/pub_node.cpp deleted file mode 100644 index 22f678b..0000000 --- a/mros2_echoback_twist/src/pub_node.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "geometry_msgs/msg/twist.hpp" - -using namespace std::chrono_literals; - -/* This example creates a subclass of Node and uses std::bind() to register a -* member function as a callback from the timer. */ - -class Publisher : public rclcpp::Node -{ -public: - Publisher() - : Node("pub_mros2"), count_(0) - { - publisher_ = this->create_publisher("to_stm", 10); - timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); - } - -private: - void timer_callback() - { - auto message = geometry_msgs::msg::Twist(); - message.linear.x = count_++/10.0; - message.linear.y = count_++/10.0; - message.linear.z = count_++/10.0; - message.angular.x = count_++/50.0; - message.angular.y = count_++/50.0; - message.angular.z = count_++/50.0; - RCLCPP_INFO(this->get_logger(), "Publishing msg: { linear: { x: %f, y: %f, z: %f }, angular: { x: %f, y: %f, z: %f } }", message.linear.x, message.linear.y, message.linear.z, message.angular.x, message.angular.y, message.angular.z); - publisher_->publish(message); - } - rclcpp::TimerBase::SharedPtr timer_; - rclcpp::Publisher::SharedPtr publisher_; - size_t count_; -}; - -int main(int argc, char *argv[]) -{ - rclcpp::init(argc, argv); - rclcpp::spin(std::make_shared()); - rclcpp::shutdown(); - return 0; -} \ No newline at end of file diff --git a/mros2_echoback_uint16/src/sub_node.cpp b/mros2_echoback_uint16/src/sub_node.cpp deleted file mode 100644 index 6a19307..0000000 --- a/mros2_echoback_uint16/src/sub_node.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "std_msgs/msg/u_int16.hpp" - -using std::placeholders::_1; - -class Subscriber : public rclcpp::Node -{ -public: - Subscriber() : Node("mros2_sub") - { - subscriber_ = this->create_subscription("to_linux", rclcpp::QoS(10).best_effort(), std::bind(&Subscriber::topic_callback, this, _1)); - } - -private: - void topic_callback(const std_msgs::msg::UInt16::SharedPtr msg) const - { - RCLCPP_INFO(this->get_logger(), "Subscribed msg: %u", msg->data); - } - rclcpp::Subscription::SharedPtr subscriber_; -}; - - -int main(int argc, char *argv[]) -{ - rclcpp::init(argc, argv); - rclcpp::spin(std::make_shared()); - rclcpp::shutdown(); - return 0; -} \ No newline at end of file diff --git a/mros2_echoback_float32/CMakeLists.txt b/mros2_pub_pose/CMakeLists.txt similarity index 76% rename from mros2_echoback_float32/CMakeLists.txt rename to mros2_pub_pose/CMakeLists.txt index b338b0f..fb229cc 100644 --- a/mros2_echoback_float32/CMakeLists.txt +++ b/mros2_pub_pose/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.5) -project(mros2_echoback_float32) +project(mros2_pub_pose) # Default to C99 @@ -19,29 +19,20 @@ endif() # find dependencies find_package(ament_cmake REQUIRED) find_package(rclcpp REQUIRED) -find_package(std_msgs REQUIRED) +find_package(geometry_msgs REQUIRED) # uncomment the following section in order to fill in # further dependencies manually. # find_package( REQUIRED) add_executable(pub_node src/pub_node.cpp) -ament_target_dependencies(pub_node rclcpp std_msgs) - -add_executable(sub_node src/sub_node.cpp) -ament_target_dependencies(sub_node rclcpp std_msgs) +ament_target_dependencies(pub_node rclcpp geometry_msgs) target_include_directories(pub_node PUBLIC $ $) -target_include_directories(sub_node PUBLIC - $ - $) - install(TARGETS pub_node DESTINATION lib/${PROJECT_NAME}) -install(TARGETS sub_node - DESTINATION lib/${PROJECT_NAME}) install(DIRECTORY launch diff --git a/mros2_echoback_float32/launch/launch_pubsub.py b/mros2_pub_pose/launch/launch_pubsub.py similarity index 56% rename from mros2_echoback_float32/launch/launch_pubsub.py rename to mros2_pub_pose/launch/launch_pubsub.py index fea137e..70c79ef 100644 --- a/mros2_echoback_float32/launch/launch_pubsub.py +++ b/mros2_pub_pose/launch/launch_pubsub.py @@ -5,16 +5,9 @@ def generate_launch_description(): return LaunchDescription([ Node( - package='mros2_echoback_float32', + package='mros2_pub_pose', node_executable='pub_node', - node_name='pub_mros2', - prefix=['stdbuf -o L'], - output="screen" - ), - Node( - package='mros2_echoback_float32', - node_executable='sub_node', - node_name='mros2_sub', + node_name='pub_pose', prefix=['stdbuf -o L'], output="screen" ) diff --git a/mros2_echoback_float32/package.xml b/mros2_pub_pose/package.xml similarity index 84% rename from mros2_echoback_float32/package.xml rename to mros2_pub_pose/package.xml index f899e59..14727d3 100644 --- a/mros2_echoback_float32/package.xml +++ b/mros2_pub_pose/package.xml @@ -1,7 +1,7 @@ - mros2_echoback_float32 + mros2_pub_pose 0.0.0 TODO: Package description uden @@ -9,9 +9,9 @@ ament_cmake rclcpp -std_msgs +geometry_msgs rclcpp -std_msgs +geometry_msgs ament_lint_auto ament_lint_common diff --git a/mros2_pub_pose/src/pub_node.cpp b/mros2_pub_pose/src/pub_node.cpp new file mode 100644 index 0000000..31bdfe5 --- /dev/null +++ b/mros2_pub_pose/src/pub_node.cpp @@ -0,0 +1,56 @@ +#include +#include +#include +#include + +#include "rclcpp/rclcpp.hpp" +#include "geometry_msgs/msg/point.hpp" +#include "geometry_msgs/msg/quaternion.hpp" +#include "geometry_msgs/msg/pose.hpp" + +using namespace std::chrono_literals; + +/* This example creates a subclass of Node and uses std::bind() to register a +* member function as a callback from the timer. */ + +class Publisher : public rclcpp::Node +{ +public: + Publisher() + : Node("pub_pose"), count_(0) + { + publisher_ = this->create_publisher("cmd_vel", 10); + timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); + } + +private: + void timer_callback() + { + auto point = geometry_msgs::msg::Point(); + auto quaternion = geometry_msgs::msg::Quaternion(); + auto pose = geometry_msgs::msg::Pose(); + point.x = count_/1.0; + point.y = count_/1.0; + point.z = count_/1.0; + quaternion.x = count_/1.0; + quaternion.y = count_/1.0; + quaternion.z = count_/1.0; + quaternion.w = count_/1.0; + pose.position = point; + pose.orientation = quaternion; + RCLCPP_INFO(this->get_logger(), "Publishing msg: { position: {x: %f, y: %f, z: %f }, orientation: {x: %f, y: %f, z: %f, w: %f } }" , pose.position.x, pose.position.y, pose.position.z, pose.orientation.x, pose.orientation.y, pose.orientation.z, pose.orientation.w ); + publisher_->publish(pose); + count_++; + } + rclcpp::TimerBase::SharedPtr timer_; + rclcpp::Publisher::SharedPtr publisher_; + uint16_t count_; +}; + +int main(int argc, char * argv[]) +{ + rclcpp::init(argc, argv); + rclcpp::spin(std::make_shared()); + rclcpp::shutdown(); + return 0; +} diff --git a/mros2_echoback_header/CMakeLists.txt b/mros2_pub_uint16/CMakeLists.txt similarity index 81% rename from mros2_echoback_header/CMakeLists.txt rename to mros2_pub_uint16/CMakeLists.txt index d139de9..c30db66 100644 --- a/mros2_echoback_header/CMakeLists.txt +++ b/mros2_pub_uint16/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.5) -project(mros2_echoback_header) +project(mros2_pub_uint16) # Default to C99 @@ -27,21 +27,12 @@ find_package(std_msgs REQUIRED) add_executable(pub_node src/pub_node.cpp) ament_target_dependencies(pub_node rclcpp std_msgs) -add_executable(sub_node src/sub_node.cpp) -ament_target_dependencies(sub_node rclcpp std_msgs) - target_include_directories(pub_node PUBLIC $ $) -target_include_directories(sub_node PUBLIC - $ - $) - install(TARGETS pub_node DESTINATION lib/${PROJECT_NAME}) -install(TARGETS sub_node - DESTINATION lib/${PROJECT_NAME}) install(DIRECTORY launch diff --git a/mros2_echoback_header/launch/launch_pubsub.py b/mros2_pub_uint16/launch/launch_pubsub.py similarity index 61% rename from mros2_echoback_header/launch/launch_pubsub.py rename to mros2_pub_uint16/launch/launch_pubsub.py index 9f79f12..2e26456 100644 --- a/mros2_echoback_header/launch/launch_pubsub.py +++ b/mros2_pub_uint16/launch/launch_pubsub.py @@ -5,17 +5,10 @@ def generate_launch_description(): return LaunchDescription([ Node( - package='mros2_echoback_header', + package='mros2_pub_uint16', node_executable='pub_node', node_name='pub_mros2', prefix=['stdbuf -o L'], output="screen" - ), - Node( - package='mros2_echoback_header', - node_executable='sub_node', - node_name='mros2_sub', - prefix=['stdbuf -o L'], - output="screen" ) ]) diff --git a/mros2_echoback_header/package.xml b/mros2_pub_uint16/package.xml similarity index 95% rename from mros2_echoback_header/package.xml rename to mros2_pub_uint16/package.xml index d25a846..0e946f3 100644 --- a/mros2_echoback_header/package.xml +++ b/mros2_pub_uint16/package.xml @@ -1,7 +1,7 @@ - mros2_echoback_header + mros2_pub_uint16 0.0.0 TODO: Package description uden diff --git a/mros2_echoback_uint16/src/pub_node.cpp b/mros2_pub_uint16/src/pub_node.cpp similarity index 100% rename from mros2_echoback_uint16/src/pub_node.cpp rename to mros2_pub_uint16/src/pub_node.cpp diff --git a/mros2_echoback_uint16/CMakeLists.txt b/mros2_sub_float32/CMakeLists.txt similarity index 81% rename from mros2_echoback_uint16/CMakeLists.txt rename to mros2_sub_float32/CMakeLists.txt index 58d8c34..2004683 100644 --- a/mros2_echoback_uint16/CMakeLists.txt +++ b/mros2_sub_float32/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.5) -project(mros2_echoback_uint16) +project(mros2_sub_float32) # Default to C99 @@ -24,22 +24,13 @@ find_package(std_msgs REQUIRED) # further dependencies manually. # find_package( REQUIRED) -add_executable(pub_node src/pub_node.cpp) -ament_target_dependencies(pub_node rclcpp std_msgs) - add_executable(sub_node src/sub_node.cpp) ament_target_dependencies(sub_node rclcpp std_msgs) -target_include_directories(pub_node PUBLIC - $ - $) - target_include_directories(sub_node PUBLIC $ $) - -install(TARGETS pub_node - DESTINATION lib/${PROJECT_NAME}) + install(TARGETS sub_node DESTINATION lib/${PROJECT_NAME}) diff --git a/mros2_echoback_uint16/launch/launch_pubsub.py b/mros2_sub_float32/launch/launch_pubsub.py similarity index 61% rename from mros2_echoback_uint16/launch/launch_pubsub.py rename to mros2_sub_float32/launch/launch_pubsub.py index e036b37..8f677e4 100644 --- a/mros2_echoback_uint16/launch/launch_pubsub.py +++ b/mros2_sub_float32/launch/launch_pubsub.py @@ -5,14 +5,7 @@ def generate_launch_description(): return LaunchDescription([ Node( - package='mros2_echoback_uint16', - node_executable='pub_node', - node_name='pub_mros2', - prefix=['stdbuf -o L'], - output="screen" - ), - Node( - package='mros2_echoback_uint16', + package='mros2_sub_float32', node_executable='sub_node', node_name='mros2_sub', prefix=['stdbuf -o L'], diff --git a/mros2_echoback_uint16/package.xml b/mros2_sub_float32/package.xml similarity index 95% rename from mros2_echoback_uint16/package.xml rename to mros2_sub_float32/package.xml index 3ac8e22..80c546d 100644 --- a/mros2_echoback_uint16/package.xml +++ b/mros2_sub_float32/package.xml @@ -1,7 +1,7 @@ - mros2_echoback_uint16 + mros2_sub_float32 0.0.0 TODO: Package description uden diff --git a/mros2_echoback_float32/src/sub_node.cpp b/mros2_sub_float32/src/sub_node.cpp similarity index 100% rename from mros2_echoback_float32/src/sub_node.cpp rename to mros2_sub_float32/src/sub_node.cpp diff --git a/mros2_echoback_twist/CMakeLists.txt b/mros2_sub_twist/CMakeLists.txt similarity index 81% rename from mros2_echoback_twist/CMakeLists.txt rename to mros2_sub_twist/CMakeLists.txt index ad7f64e..7a59d30 100644 --- a/mros2_echoback_twist/CMakeLists.txt +++ b/mros2_sub_twist/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.5) -project(mros2_echoback_twist) +project(mros2_sub_twist) # Default to C99 @@ -24,22 +24,13 @@ find_package(geometry_msgs REQUIRED) # further dependencies manually. # find_package( REQUIRED) -add_executable(pub_node src/pub_node.cpp) -ament_target_dependencies(pub_node rclcpp geometry_msgs) - add_executable(sub_node src/sub_node.cpp) ament_target_dependencies(sub_node rclcpp geometry_msgs) -target_include_directories(pub_node PUBLIC - $ - $) - target_include_directories(sub_node PUBLIC $ $) -install(TARGETS pub_node - DESTINATION lib/${PROJECT_NAME}) install(TARGETS sub_node DESTINATION lib/${PROJECT_NAME}) diff --git a/mros2_echoback_twist/launch/launch_pubsub.py b/mros2_sub_twist/launch/launch_pubsub.py similarity index 56% rename from mros2_echoback_twist/launch/launch_pubsub.py rename to mros2_sub_twist/launch/launch_pubsub.py index 2198bd1..3c26d92 100644 --- a/mros2_echoback_twist/launch/launch_pubsub.py +++ b/mros2_sub_twist/launch/launch_pubsub.py @@ -5,16 +5,9 @@ def generate_launch_description(): return LaunchDescription([ Node( - package='mros2_echoback_twist', - node_executable='pub_node', - node_name='pub_mros2', - prefix=['stdbuf -o L'], - output="screen" - ), - Node( - package='mros2_echoback_twist', + package='mros2_sub_twist', node_executable='sub_node', - node_name='mros2_sub', + node_name='sub_twist', prefix=['stdbuf -o L'], output="screen" ) diff --git a/mros2_echoback_twist/package.xml b/mros2_sub_twist/package.xml similarity index 95% rename from mros2_echoback_twist/package.xml rename to mros2_sub_twist/package.xml index 3b17b12..7b482df 100644 --- a/mros2_echoback_twist/package.xml +++ b/mros2_sub_twist/package.xml @@ -1,7 +1,7 @@ - mros2_echoback_twist + mros2_sub_twist 0.0.0 TODO: Package description uden diff --git a/mros2_echoback_twist/src/sub_node.cpp b/mros2_sub_twist/src/sub_node.cpp similarity index 86% rename from mros2_echoback_twist/src/sub_node.cpp rename to mros2_sub_twist/src/sub_node.cpp index ff7f060..95e2aec 100644 --- a/mros2_echoback_twist/src/sub_node.cpp +++ b/mros2_sub_twist/src/sub_node.cpp @@ -11,9 +11,9 @@ using std::placeholders::_1; class Subscriber : public rclcpp::Node { public: - Subscriber() : Node("mros2_sub") + Subscriber() : Node("sub_twist") { - subscriber_ = this->create_subscription("to_linux", rclcpp::QoS(10).best_effort(), std::bind(&Subscriber::topic_callback, this, _1)); + subscriber_ = this->create_subscription("cmd_vel", rclcpp::QoS(10).best_effort(), std::bind(&Subscriber::topic_callback, this, _1)); } private: From 219bcb77e5558d61e0dc5d4deac419e7f5e362d3 Mon Sep 17 00:00:00 2001 From: MEIP-users Date: Mon, 14 Feb 2022 21:55:46 +0900 Subject: [PATCH 52/56] clean apps for v0.2.4 --- mros2_echoback_joint_state/CMakeLists.txt | 62 ----------------- .../launch/launch_pubsub.py | 21 ------ mros2_echoback_joint_state/package.xml | 21 ------ mros2_echoback_joint_state/src/pub_node.cpp | 57 ---------------- mros2_echoback_joint_state/src/sub_node.cpp | 34 ---------- mros2_echoback_odometry/CMakeLists.txt | 64 ------------------ .../launch/launch_pubsub.py | 21 ------ mros2_echoback_odometry/package.xml | 25 ------- mros2_echoback_odometry/src/pub_node.cpp | 66 ------------------- mros2_echoback_odometry/src/sub_node.cpp | 34 ---------- 10 files changed, 405 deletions(-) delete mode 100644 mros2_echoback_joint_state/CMakeLists.txt delete mode 100644 mros2_echoback_joint_state/launch/launch_pubsub.py delete mode 100644 mros2_echoback_joint_state/package.xml delete mode 100644 mros2_echoback_joint_state/src/pub_node.cpp delete mode 100644 mros2_echoback_joint_state/src/sub_node.cpp delete mode 100644 mros2_echoback_odometry/CMakeLists.txt delete mode 100644 mros2_echoback_odometry/launch/launch_pubsub.py delete mode 100644 mros2_echoback_odometry/package.xml delete mode 100644 mros2_echoback_odometry/src/pub_node.cpp delete mode 100644 mros2_echoback_odometry/src/sub_node.cpp diff --git a/mros2_echoback_joint_state/CMakeLists.txt b/mros2_echoback_joint_state/CMakeLists.txt deleted file mode 100644 index 3e43520..0000000 --- a/mros2_echoback_joint_state/CMakeLists.txt +++ /dev/null @@ -1,62 +0,0 @@ -cmake_minimum_required(VERSION 3.5) -project(mros2_echoback_joint_state) - - -# Default to C99 -if(NOT CMAKE_C_STANDARD) - set(CMAKE_C_STANDARD 99) -endif() - -# Default to C++14 -if(NOT CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 14) -endif() - -if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_compile_options(-Wall -Wextra -Wpedantic) -endif() - -# find dependencies -find_package(ament_cmake REQUIRED) -find_package(rclcpp REQUIRED) -find_package(sensor_msgs REQUIRED) -# uncomment the following section in order to fill in -# further dependencies manually. -# find_package( REQUIRED) - -add_executable(pub_node src/pub_node.cpp) -ament_target_dependencies(pub_node rclcpp sensor_msgs) - -add_executable(sub_node src/sub_node.cpp) -ament_target_dependencies(sub_node rclcpp sensor_msgs) - -target_include_directories(pub_node PUBLIC - $ - $) - -target_include_directories(sub_node PUBLIC - $ - $) - -install(TARGETS pub_node - DESTINATION lib/${PROJECT_NAME}) -install(TARGETS sub_node - DESTINATION lib/${PROJECT_NAME}) - -install(DIRECTORY - launch - DESTINATION share/${PROJECT_NAME} -) - -if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - # the following line skips the linter which checks for copyrights - # uncomment the line when a copyright and license is not present in all source files - #set(ament_cmake_copyright_FOUND TRUE) - # the following line skips cpplint (only works in a git repo) - # uncomment the line when this package is not in a git repo - #set(ament_cmake_cpplint_FOUND TRUE) - ament_lint_auto_find_test_dependencies() -endif() - -ament_package() \ No newline at end of file diff --git a/mros2_echoback_joint_state/launch/launch_pubsub.py b/mros2_echoback_joint_state/launch/launch_pubsub.py deleted file mode 100644 index b098e67..0000000 --- a/mros2_echoback_joint_state/launch/launch_pubsub.py +++ /dev/null @@ -1,21 +0,0 @@ -from launch import LaunchDescription -from launch_ros.actions import Node - -# Note: `node_`, `prefix` and `output` will be removed on Foxy -def generate_launch_description(): - return LaunchDescription([ - Node( - package='mros2_echoback_joint_state', - node_executable='pub_node', - node_name='pub_mros2', - prefix=['stdbuf -o L'], - output="screen" - ), - Node( - package='mros2_echoback_joint_state', - node_executable='sub_node', - node_name='mros2_sub', - prefix=['stdbuf -o L'], - output="screen" - ) - ]) \ No newline at end of file diff --git a/mros2_echoback_joint_state/package.xml b/mros2_echoback_joint_state/package.xml deleted file mode 100644 index 860e6c0..0000000 --- a/mros2_echoback_joint_state/package.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - mros2_echoback_joint_state - 0.0.0 - TODO: Package description - uden - TODO: License declaration - - ament_cmake -rclcpp -sensor_msgs -rclcpp -sensor_msgs - ament_lint_auto - ament_lint_common - - - ament_cmake - - \ No newline at end of file diff --git a/mros2_echoback_joint_state/src/pub_node.cpp b/mros2_echoback_joint_state/src/pub_node.cpp deleted file mode 100644 index fb22c13..0000000 --- a/mros2_echoback_joint_state/src/pub_node.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#include -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "sensor_msgs/msg/joint_state.hpp" - -using namespace std::chrono_literals; - -/* This example creates a subclass of Node and uses std::bind() to register a -* member function as a callback from the timer. */ - -class Publisher : public rclcpp::Node -{ -public: - Publisher() - : Node("pub_mros2"), count_(0) - { - publisher_ = this->create_publisher("to_stm", 10); - timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); - } - -private: - void timer_callback() - { - auto message = sensor_msgs::msg::JointState(); - message.header.frame_id = "0"; - message.header.stamp = this->get_clock()->now(); - message.name.resize(2); - message.name[0] = "joint1"; - message.name[1] = "joint2"; - message.position.resize(2); - message.position[0] = -1.0*(count_/40.0); - message.position[1] = 2.0*(count_/40.0); - message.velocity.resize(2); - message.velocity[0] = -1.0*(count_/40.0); - message.velocity[1] = 2.0*(count_/40.0); - message.effort.resize(1); - message.effort[0] = -1.0*(count_/40.0); - //message.effort[1] = 2.0*(count_/40.0); - count_++; - RCLCPP_INFO(this->get_logger(), "Publishing msg: { frame_id: '%s', sec: %d, nanosec: %u, name: { %s, %s }, position: { x: %f, y: %f }, velocity: { x: %f, y: %f }, effort: { x: %f, y: %f } }", message.header.frame_id.c_str(), message.header.stamp.sec, message.header.stamp.nanosec, message.name[0].c_str(), message.name[1].c_str(), message.position[0], message.position[1], message.velocity[0], message.velocity[1], message.effort[0], message.effort[1] ); - publisher_->publish(message); - } - rclcpp::TimerBase::SharedPtr timer_; - rclcpp::Publisher::SharedPtr publisher_; - size_t count_; -}; - -int main(int argc, char *argv[]) -{ - rclcpp::init(argc, argv); - rclcpp::spin(std::make_shared()); - rclcpp::shutdown(); - return 0; -} \ No newline at end of file diff --git a/mros2_echoback_joint_state/src/sub_node.cpp b/mros2_echoback_joint_state/src/sub_node.cpp deleted file mode 100644 index 5c1ec2d..0000000 --- a/mros2_echoback_joint_state/src/sub_node.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "sensor_msgs/msg/joint_state.hpp" - -using std::placeholders::_1; - -class Subscriber : public rclcpp::Node -{ -public: - Subscriber() : Node("mros2_sub") - { - subscriber_ = this->create_subscription("to_linux", rclcpp::QoS(10).best_effort(), std::bind(&Subscriber::topic_callback, this, _1)); - } - -private: - void topic_callback(const sensor_msgs::msg::JointState::SharedPtr message) const - { - RCLCPP_INFO(this->get_logger(), "Subscribed msg: { frame_id: '%s', sec: %d, nanosec: %u, name: { %s, %s }, position: { x: %f, y: %f }, velocity: { x: %f, y: %f }, effort: { x: %f, y: %f } }", message->header.frame_id.c_str(), message->header.stamp.sec, message->header.stamp.nanosec, message->name[0].c_str(), message->name[1].c_str(), message->position[0], message->position[1], message->velocity[0], message->velocity[1], message->effort[0], message->effort[1] ); - } - rclcpp::Subscription::SharedPtr subscriber_; -}; - - -int main(int argc, char *argv[]) -{ - rclcpp::init(argc, argv); - rclcpp::spin(std::make_shared()); - rclcpp::shutdown(); - return 0; -} \ No newline at end of file diff --git a/mros2_echoback_odometry/CMakeLists.txt b/mros2_echoback_odometry/CMakeLists.txt deleted file mode 100644 index 695e8af..0000000 --- a/mros2_echoback_odometry/CMakeLists.txt +++ /dev/null @@ -1,64 +0,0 @@ -cmake_minimum_required(VERSION 3.5) -project(mros2_echoback_odometry) - - -# Default to C99 -if(NOT CMAKE_C_STANDARD) - set(CMAKE_C_STANDARD 99) -endif() - -# Default to C++14 -if(NOT CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 14) -endif() - -if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_compile_options(-Wall -Wextra -Wpedantic) -endif() - -# find dependencies -find_package(ament_cmake REQUIRED) -find_package(rclcpp REQUIRED) -find_package(std_msgs REQUIRED) -find_package(geometry_msgs REQUIRED) -find_package(nav_msgs REQUIRED) -# uncomment the following section in order to fill in -# further dependencies manually. -# find_package( REQUIRED) - -add_executable(pub_node src/pub_node.cpp) -ament_target_dependencies(pub_node rclcpp std_msgs geometry_msgs nav_msgs) - -add_executable(sub_node src/sub_node.cpp) -ament_target_dependencies(sub_node rclcpp std_msgs geometry_msgs nav_msgs) - -target_include_directories(pub_node PUBLIC - $ - $) - -target_include_directories(sub_node PUBLIC - $ - $) - -install(TARGETS pub_node - DESTINATION lib/${PROJECT_NAME}) -install(TARGETS sub_node - DESTINATION lib/${PROJECT_NAME}) - -install(DIRECTORY - launch - DESTINATION share/${PROJECT_NAME} -) - -if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - # the following line skips the linter which checks for copyrights - # uncomment the line when a copyright and license is not present in all source files - #set(ament_cmake_copyright_FOUND TRUE) - # the following line skips cpplint (only works in a git repo) - # uncomment the line when this package is not in a git repo - #set(ament_cmake_cpplint_FOUND TRUE) - ament_lint_auto_find_test_dependencies() -endif() - -ament_package() \ No newline at end of file diff --git a/mros2_echoback_odometry/launch/launch_pubsub.py b/mros2_echoback_odometry/launch/launch_pubsub.py deleted file mode 100644 index d3c4e9e..0000000 --- a/mros2_echoback_odometry/launch/launch_pubsub.py +++ /dev/null @@ -1,21 +0,0 @@ -from launch import LaunchDescription -from launch_ros.actions import Node - -# Note: `node_`, `prefix` and `output` will be removed on Foxy -def generate_launch_description(): - return LaunchDescription([ - Node( - package='mros2_echoback_odometry', - node_executable='pub_node', - node_name='pub_mros2', - prefix=['stdbuf -o L'], - output="screen" - ), - Node( - package='mros2_echoback_odometry', - node_executable='sub_node', - node_name='mros2_sub', - prefix=['stdbuf -o L'], - output="screen" - ) - ]) \ No newline at end of file diff --git a/mros2_echoback_odometry/package.xml b/mros2_echoback_odometry/package.xml deleted file mode 100644 index c78c927..0000000 --- a/mros2_echoback_odometry/package.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - mros2_echoback_odometry - 0.0.0 - TODO: Package description - uden - TODO: License declaration - - ament_cmake -rclcpp -std_msgs -geometry_msgs -nav_msgs -rclcpp -std_msgs -geometry_msgs -nav_msgs - ament_lint_auto - ament_lint_common - - - ament_cmake - - \ No newline at end of file diff --git a/mros2_echoback_odometry/src/pub_node.cpp b/mros2_echoback_odometry/src/pub_node.cpp deleted file mode 100644 index fb2287c..0000000 --- a/mros2_echoback_odometry/src/pub_node.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "nav_msgs/msg/odometry.hpp" - -using namespace std::chrono_literals; - -/* This example creates a subclass of Node and uses std::bind() to register a -* member function as a callback from the timer. */ - -class Publisher : public rclcpp::Node -{ -public: - Publisher() - : Node("pub_mros2"), count_(0) - { - publisher_ = this->create_publisher("to_stm", 10); - timer_ = this->create_wall_timer(1000ms, std::bind(&Publisher::timer_callback, this)); - } - -private: - void timer_callback() - { - auto message = nav_msgs::msg::Odometry(); - message.header.stamp = this->get_clock()->now(); - message.header.frame_id = "odometry"; - message.child_frame_id = "child_odometry"; - for (int i=0;i<36;i++){ - message.pose.covariance[i]=(i/100.0); - } - message.pose.pose.position.x=count_++/10.0; - message.pose.pose.position.y=count_++/10.0; - message.pose.pose.position.z=count_++/10.0; - message.pose.pose.orientation.x=count_++/20.0; - message.pose.pose.orientation.y=count_++/20.0; - message.pose.pose.orientation.z=count_++/20.0; - message.pose.pose.orientation.w=count_++/20.0; - - for (int i=0;i<36;i++){ - message.twist.covariance[i]=(i/100.0); - } - message.twist.twist.linear.x = count_++/50.0; - message.twist.twist.linear.y = count_++/50.0; - message.twist.twist.linear.z = count_++/50.0; - message.twist.twist.angular.x = count_++/100.0; - message.twist.twist.angular.y = count_++/100.0; - message.twist.twist.angular.z = count_++/100.0; - - RCLCPP_INFO(this->get_logger(), "Publishing msg: { sec:%d, nanosec:%u, frame_id:%s, child_frame_id:%s, pos_x:%f, ori_x:%f, pos_cov:%f, lin:%f, ang:%f, twi_cov:%f }", message.header.stamp.sec, message.header.stamp.nanosec, message.header.frame_id.c_str(), message.child_frame_id.c_str(), message.pose.pose.position.x, message.pose.pose.orientation.x, message.pose.covariance[18], message.twist.twist.linear.x, message.twist.twist.angular.x, message.twist.covariance[18] ); - publisher_->publish(message); - } - rclcpp::TimerBase::SharedPtr timer_; - rclcpp::Publisher::SharedPtr publisher_; - size_t count_; -}; - -int main(int argc, char *argv[]) -{ - rclcpp::init(argc, argv); - rclcpp::spin(std::make_shared()); - rclcpp::shutdown(); - return 0; -} \ No newline at end of file diff --git a/mros2_echoback_odometry/src/sub_node.cpp b/mros2_echoback_odometry/src/sub_node.cpp deleted file mode 100644 index 6c0d986..0000000 --- a/mros2_echoback_odometry/src/sub_node.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "nav_msgs/msg/odometry.hpp" - -using std::placeholders::_1; - -class Subscriber : public rclcpp::Node -{ -public: - Subscriber() : Node("mros2_sub") - { - subscriber_ = this->create_subscription("to_linux", rclcpp::QoS(10).best_effort(), std::bind(&Subscriber::topic_callback, this, _1)); - } - -private: - void topic_callback(const nav_msgs::msg::Odometry::SharedPtr message) const - { - RCLCPP_INFO(this->get_logger(), "Subscribed msg: { sec:%d, nanosec:%u, frame_id:%s, child_frame_id:%s, pos_x:%f, ori_x:%f, pos_cov:%f, lin:%f, ang:%f, twi_cov:%f }", message->header.stamp.sec, message->header.stamp.nanosec, message->header.frame_id.c_str(), message->child_frame_id.c_str(), message->pose.pose.position.x, message->pose.pose.orientation.x, message->pose.covariance[18], message->twist.twist.linear.x, message->twist.twist.angular.x, message->twist.covariance[18] ); - } - rclcpp::Subscription::SharedPtr subscriber_; -}; - - -int main(int argc, char *argv[]) -{ - rclcpp::init(argc, argv); - rclcpp::spin(std::make_shared()); - rclcpp::shutdown(); - return 0; -} \ No newline at end of file From a02ce4ff5c45c2c3c702ed443d72685a23f3d4ed Mon Sep 17 00:00:00 2001 From: MEIP-users Date: Mon, 14 Feb 2022 21:57:36 +0900 Subject: [PATCH 53/56] clean apps for v0.2.4 --- mros2_echoback_string/src/pub_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mros2_echoback_string/src/pub_node.cpp b/mros2_echoback_string/src/pub_node.cpp index 49fa857..9c288bf 100644 --- a/mros2_echoback_string/src/pub_node.cpp +++ b/mros2_echoback_string/src/pub_node.cpp @@ -25,7 +25,7 @@ class Publisher : public rclcpp::Node void timer_callback() { auto message = std_msgs::msg::String(); - message.data = "Hello, world!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + std::to_string(count_++); + message.data = "Hello, world! " + std::to_string(count_++); RCLCPP_INFO(this->get_logger(), "Publishing msg: '%s'", message.data.c_str()); publisher_->publish(message); } From f521c14363020947e980ffb035b0b681aee7c578 Mon Sep 17 00:00:00 2001 From: MEIP-users Date: Wed, 16 Feb 2022 12:11:24 +0900 Subject: [PATCH 54/56] README modified --- README.md | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cafcf36..fddad69 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,64 @@ # mros2-host-examples -ROS 2 packages that communicate with mROS 2 from host + +This repository contains ROS 2 packages that can communicate with [mros2](https://github.com/mROS-base/mros2), which is an agent-less and lightweight runtime environment for ROS 2 nodes onto embedded devices. +Please also check [mROS-base/mros2-asp3-f767zi/workspace](https://github.com/mROS-base/mros2-asp3-f767zi/workspace) for more details about example application on mros2. + +## mros2_echoback_string + +- Description: + - The `pub_mros2` node on the host publishes `string` (`std_msgs::msg::String`) message to `/to_stm` topic. + - (The mros2 node on the embedded device will echoreply this message as it is.) + - The `mros2_sub` node on the host subscribes `string` message from `/to_linux` topic. +- Host operation: + - `$ ros2 launch mros2_echoback_string launch.py` + - or, at two terminals: + - `$ ros2 run mros2_echoback_string pub_node` + - `$ ros2 run mros2_echoback_string sub_node` +- mros2 application on the embedded device: + - [echoreply_string](https://github.com/mROS-base/mros2-asp3-f767zi/workspace/echoreply_string) + - [pub_string](https://github.com/mROS-base/mros2-asp3-f767zi/workspace/pub_string) + - [sub_string](https://github.com/mROS-base/mros2-asp3-f767zi/workspace/sub_string) + +## mros2_pub_uint16 + +- Description: + - The `pub_mros2` node on the host publishes `uint16` (`std_msgs::msg::UInt16`) message to `/to_stm` topic. +- Host operation: + - `$ ros2 launch mros2_pub_uint16 launch.py` + - or, at two terminals: + - `$ ros2 run mros2_pub_uint16 pub_node` +- mros2 application on the embedded device: + - [sub_uint16](https://github.com/mROS-base/mros2-asp3-f767zi/workspace/sub_uint16) + +## mros2_sub_float32 + +- Description: + - The `mros2_sub` node on the host subscribes `float32` (`std_msgs::msg::Float32`) message from `/to_linux` topic. +- Host operation: + - `$ ros2 launch mros2_sub_float32 launch.py` + - or, at two terminals: + - `$ ros2 run mros2_sub_float32 sub_node` +- mros2 application on the embedded device: + - [pub_float32](https://github.com/mROS-base/mros2-asp3-f767zi/workspace/pub_float32) + + ## mros2_pub_pose + +- Description: + - The `pub_pose` node on the host publishes `Pose` (`geometry_msgs::msg::Pose`) message to `cmd_vel` topic. +- Host operation: + - `$ ros2 launch mros2_pub_pose launch.py` + - or, at two terminals: + - `$ ros2 run mros2_pub_pose pub_node` +- mros2 application on the embedded device: + - [sub_pose](https://github.com/mROS-base/mros2-asp3-f767zi/workspace/sub_pose) + +## mros2_sub_twist + +- Description: + - The `sub_twist` node on the host subscribes `Twist` (`geometry_msgs::msg::Twist`) message from `cmd_vel` topic. +- Host operation: + - `$ ros2 launch mros2_sub_twist launch.py` + - or, at two terminals: + - `$ ros2 run mros2_sub_twist sub_node` +- mros2 application on the embedded device: + - [pub_twist](https://github.com/mROS-base/mros2-asp3-f767zi/workspace/pub_twist) From 79f1a109d5c80ab40bbf9483b32111d2a05df522 Mon Sep 17 00:00:00 2001 From: MEIP-users Date: Wed, 16 Feb 2022 12:11:59 +0900 Subject: [PATCH 55/56] README modified --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fddad69..4dd8489 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ Please also check [mROS-base/mros2-asp3-f767zi/workspace](https://github.com/mRO - mros2 application on the embedded device: - [pub_float32](https://github.com/mROS-base/mros2-asp3-f767zi/workspace/pub_float32) - ## mros2_pub_pose +## mros2_pub_pose - Description: - The `pub_pose` node on the host publishes `Pose` (`geometry_msgs::msg::Pose`) message to `cmd_vel` topic. From dd029d894634181aebd9b4794dfa865a23957405 Mon Sep 17 00:00:00 2001 From: MEIP-users Date: Wed, 16 Feb 2022 12:13:04 +0900 Subject: [PATCH 56/56] README modified --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 4dd8489..bf3f045 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,6 @@ Please also check [mROS-base/mros2-asp3-f767zi/workspace](https://github.com/mRO - `$ ros2 run mros2_echoback_string sub_node` - mros2 application on the embedded device: - [echoreply_string](https://github.com/mROS-base/mros2-asp3-f767zi/workspace/echoreply_string) - - [pub_string](https://github.com/mROS-base/mros2-asp3-f767zi/workspace/pub_string) - - [sub_string](https://github.com/mROS-base/mros2-asp3-f767zi/workspace/sub_string) ## mros2_pub_uint16