Skip to content

Commit

Permalink
Revert "Decouple rosout publisher init from node init. (#351)"
Browse files Browse the repository at this point in the history
This reverts commit b507003.

Signed-off-by: Tomoya.Fujita <[email protected]>
  • Loading branch information
fujitatomoya committed Apr 29, 2023
1 parent b507003 commit beef487
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 50 deletions.
20 changes: 0 additions & 20 deletions rclc/src/rclc/node.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
#include "rclc/node.h"

#include <rcl/error_handling.h>
#include <rcl/logging.h>
#include <rcl/logging_rosout.h>
#include <rcutils/logging_macros.h>

rcl_ret_t
Expand Down Expand Up @@ -81,24 +79,6 @@ rclc_node_init_with_options(
node_ops);
if (rc != RCL_RET_OK) {
PRINT_RCLC_WARN(rclc_node_init_with_options, rcl_node_init);
return rc;
}

// The initialization for the rosout publisher
if (rcl_logging_rosout_enabled() && node_ops->enable_rosout) {
rc = rcl_logging_rosout_init_publisher_for_node(node);
if (rc != RCL_RET_OK) {
PRINT_RCLC_WARN(
rclc_node_init_with_options,
rcl_logging_rosout_init_publisher_for_node);
if (rcl_logging_rosout_fini_publisher_for_node(node) != RCL_RET_OK) {
PRINT_RCLC_WARN(
rclc_node_init_with_options,
rcl_logging_rosout_fini_publisher_for_node);
}
return rc;
}
}

return rc;
}
6 changes: 0 additions & 6 deletions rclc/test/rclc/test_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
#include <thread>
#include <vector>

#include "rcl/logging.h"
#include "rcl/logging_rosout.h"
#include "rclc/executor.h"
#include "osrf_testing_tools_cpp/scope_exit.hpp"
#include "rcutils/time.h"
Expand Down Expand Up @@ -547,10 +545,6 @@ class TestDefaultExecutor : public ::testing::Test
rcl_node_options_t node_options = rcl_node_get_default_options();
ret = rcl_node_init(&this->node, name, "", &this->context, &node_options);
ASSERT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
if (rcl_logging_rosout_enabled() && node_options.enable_rosout) {
ret = rcl_logging_rosout_init_publisher_for_node(&this->node);
ASSERT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
}
const rcl_node_options_t * node_ops = rcl_node_get_options(&this->node);
this->allocator_ptr = &node_ops->allocator;

Expand Down
9 changes: 0 additions & 9 deletions rclc_examples/src/example_executor_only_rcl.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

#include <stdio.h>

#include <rcl/logging.h>
#include <rcl/logging_rosout.h>
#include <rclc/executor.h>
#include <std_msgs/msg/string.h>

Expand Down Expand Up @@ -85,13 +83,6 @@ int main(int argc, const char * argv[])
printf("Error in rcl_node_init\n");
return -1;
}
if (rcl_logging_rosout_enabled() && node_ops.enable_rosout) {
rc = rcl_logging_rosout_init_publisher_for_node(&my_node);
if (rc != RCL_RET_OK) {
printf("Error in rcl_logging_rosout_init_publisher_for_node\n");
return -1;
}
}

// create a publisher to publish topic 'topic_0' with type std_msg::msg::String
// my_pub is global, so that the timer callback can access this publisher.
Expand Down
15 changes: 0 additions & 15 deletions rclc_lifecycle/test/test_lifecycle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ extern "C"
#include <lifecycle_msgs/msg/state.h>
#include <lifecycle_msgs/msg/transition.h>

#include <rcl/logging.h>
#include <rcl/logging_rosout.h>

#include "rclc_lifecycle/rclc_lifecycle.h"
}

Expand Down Expand Up @@ -66,9 +63,6 @@ TEST(TestRclcLifecycle, lifecycle_node) {
rcl_node_t my_node = rcl_get_zero_initialized_node();
rcl_node_options_t node_ops = rcl_node_get_default_options();
res += rcl_node_init(&my_node, "lifecycle_node", "rclc", &context, &node_ops);
if (rcl_logging_rosout_enabled() && node_ops.enable_rosout) {
res += rcl_logging_rosout_init_publisher_for_node(&my_node);
}

rclc_lifecycle_node_t lifecycle_node;
rcl_lifecycle_state_machine_t state_machine = rcl_lifecycle_get_zero_initialized_state_machine();
Expand Down Expand Up @@ -106,9 +100,6 @@ TEST(TestRclcLifecycle, lifecycle_node_transitions) {
rcl_node_t my_node = rcl_get_zero_initialized_node();
rcl_node_options_t node_ops = rcl_node_get_default_options();
res += rcl_node_init(&my_node, "lifecycle_node", "rclc", &context, &node_ops);
if (rcl_logging_rosout_enabled() && node_ops.enable_rosout) {
res += rcl_logging_rosout_init_publisher_for_node(&my_node);
}

rclc_lifecycle_node_t lifecycle_node;
rcl_lifecycle_state_machine_t state_machine = rcl_lifecycle_get_zero_initialized_state_machine();
Expand Down Expand Up @@ -179,9 +170,6 @@ TEST(TestRclcLifecycle, lifecycle_node_callbacks) {
rcl_node_t my_node = rcl_get_zero_initialized_node();
rcl_node_options_t node_ops = rcl_node_get_default_options();
res += rcl_node_init(&my_node, "lifecycle_node", "rclc", &context, &node_ops);
if (rcl_logging_rosout_enabled() && node_ops.enable_rosout) {
res += rcl_logging_rosout_init_publisher_for_node(&my_node);
}

rclc_lifecycle_node_t lifecycle_node;
rcl_lifecycle_state_machine_t state_machine = rcl_lifecycle_get_zero_initialized_state_machine();
Expand Down Expand Up @@ -247,9 +235,6 @@ TEST(TestRclcLifecycle, lifecycle_node_servers) {
rcl_node_t my_node = rcl_get_zero_initialized_node();
rcl_node_options_t node_ops = rcl_node_get_default_options();
res += rcl_node_init(&my_node, "lifecycle_node", "rclc", &context, &node_ops);
if (rcl_logging_rosout_enabled() && node_ops.enable_rosout) {
res += rcl_logging_rosout_init_publisher_for_node(&my_node);
}

rclc_lifecycle_node_t lifecycle_node;
rcl_lifecycle_state_machine_t state_machine = rcl_lifecycle_get_zero_initialized_state_machine();
Expand Down

0 comments on commit beef487

Please sign in to comment.