Skip to content

Commit

Permalink
fix: 🐛 make force_torque_sensor_broadcaster wait for realtime_publish…
Browse files Browse the repository at this point in the history
…er loop to be ready before finishing configure

refs: #263
  • Loading branch information
jaron-l committed Apr 8, 2022
1 parent 97c9431 commit d70e4ca
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@

#include "force_torque_sensor_broadcaster/force_torque_sensor_broadcaster.hpp"

#include <chrono>
#include <memory>
#include <string>
#include <thread>

namespace force_torque_sensor_broadcaster
{
Expand Down Expand Up @@ -108,6 +110,11 @@ CallbackReturn ForceTorqueSensorBroadcaster::on_configure(
sensor_state_publisher_ = node_->create_publisher<geometry_msgs::msg::WrenchStamped>(
"~/wrench", rclcpp::SystemDefaultsQoS());
realtime_publisher_ = std::make_unique<StatePublisher>(sensor_state_publisher_);
while (!realtime_publisher_->trylock())
{
std::this_thread::sleep_for(std::chrono::milliseconds(10));
}
realtime_publisher_->unlock();
}
catch (const std::exception & e)
{
Expand Down

0 comments on commit d70e4ca

Please sign in to comment.