Skip to content

Commit d0de317

Browse files
committed
- optimized cpu usage by spin loop (by astumpf)
1 parent 176c64e commit d0de317

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

robotis_controller/src/robotis_controller/robotis_controller.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -660,11 +660,9 @@ void RobotisController::msgQueueThread()
660660
ros::ServiceServer joint_module_server = ros_node.advertiseService("/robotis/get_present_joint_ctrl_modules",
661661
&RobotisController::getCtrlModuleCallback, this);
662662

663-
while (ros_node.ok())
664-
{
665-
callback_queue.callAvailable();
666-
usleep(1000);
667-
}
663+
ros::WallDuration duration(CONTROL_CYCLE_MSEC / 1000.0);
664+
while(ros_node.ok())
665+
callback_queue.callAvailable(duration);
668666
}
669667

670668
void *RobotisController::timerThread(void *param)

0 commit comments

Comments
 (0)