Skip to content

Commit 0da28d6

Browse files
committed
Fix thread setup problem in LeggedHWLoop
1 parent 7d6e3ca commit 0da28d6

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

legged_hw/src/LeggedHWLoop.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace legged {
88
LeggedHWLoop::LeggedHWLoop(ros::NodeHandle& nh, std::shared_ptr<LeggedHW> hardware_interface)
9-
: nh_(nh), hardwareInterface_(std::move(hardware_interface)) {
9+
: nh_(nh), hardwareInterface_(std::move(hardware_interface)), loopRunning_(true) {
1010
// Create the controller manager
1111
controllerManager_.reset(new controller_manager::ControllerManager(hardwareInterface_.get(), nh_));
1212

@@ -30,9 +30,7 @@ LeggedHWLoop::LeggedHWLoop(ros::NodeHandle& nh, std::shared_ptr<LeggedHW> hardwa
3030
// Setup loop thread
3131
loopThread_ = std::thread([&]() {
3232
while (loopRunning_) {
33-
if (loopRunning_) {
34-
update();
35-
}
33+
update();
3634
}
3735
});
3836
sched_param sched{.sched_priority = threadPriority};
@@ -41,8 +39,6 @@ LeggedHWLoop::LeggedHWLoop(ros::NodeHandle& nh, std::shared_ptr<LeggedHW> hardwa
4139
"Failed to set threads priority (one possible reason could be that the user and the group permissions "
4240
"are not set properly.).\n");
4341
}
44-
45-
loopRunning_ = true;
4642
}
4743

4844
void LeggedHWLoop::update() {

0 commit comments

Comments
 (0)