Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix component lifecycle #1098

Merged
merged 5 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ class URPositionHardwareInterface : public hardware_interface::SystemInterface
bool first_pass_;
bool initialized_;
double system_interface_initialized_;
bool async_thread_shutdown_;
std::atomic_bool async_thread_shutdown_;
double get_robot_software_version_major_;
double get_robot_software_version_minor_;
double get_robot_software_version_bugfix_;
Expand Down
1 change: 1 addition & 0 deletions ur_robot_driver/src/hardware_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ void URPositionHardwareInterface::readBitsetData(const std::unique_ptr<rtde::Dat

void URPositionHardwareInterface::asyncThread()
{
async_thread_shutdown_ = false;
while (!async_thread_shutdown_) {
if (initialized_) {
// RCLCPP_INFO(rclcpp::get_logger("URPositionHardwareInterface"), "Initialized in async thread");
Expand Down
6 changes: 3 additions & 3 deletions ur_robot_driver/src/urcl_log_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
namespace ur_robot_driver
{
bool g_registered = false;
std::unique_ptr<UrclLogHandler> g_log_handler(new UrclLogHandler);

UrclLogHandler::UrclLogHandler() = default;

Expand Down Expand Up @@ -82,10 +81,11 @@ void UrclLogHandler::log(const char* file, int line, urcl::LogLevel loglevel, co
void registerUrclLogHandler(const std::string& tf_prefix)
{
if (g_registered == false) {
g_log_handler->setTFPrefix(tf_prefix);
std::unique_ptr<UrclLogHandler> log_handler(new UrclLogHandler);
log_handler->setTFPrefix(tf_prefix);
// Log level is decided by ROS2 log level
urcl::setLogLevel(urcl::LogLevel::DEBUG);
urcl::registerLogHandler(std::move(g_log_handler));
urcl::registerLogHandler(std::move(log_handler));
g_registered = true;
}
}
Expand Down
Loading