Skip to content

Commit

Permalink
Fix deprecated usage of lock_memory API (#1970) (#1971)
Browse files Browse the repository at this point in the history
(cherry picked from commit 52a2ffd)

Co-authored-by: Sudip Roy <[email protected]>
  • Loading branch information
mergify[bot] and imsudiproy authored Dec 23, 2024
1 parent 5bbc0ad commit f89c466
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions controller_manager/src/ros2_control_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,13 @@ int main(int argc, char ** argv)
}
const bool has_realtime = realtime_tools::has_realtime_kernel();
const bool lock_memory = cm->get_parameter_or<bool>("lock_memory", has_realtime);
std::string message;
if (lock_memory && !realtime_tools::lock_memory(message))
if (lock_memory)
{
RCLCPP_WARN(cm->get_logger(), "Unable to lock the memory : '%s'", message.c_str());
const auto lock_result = realtime_tools::lock_memory();
if (!lock_result.first)
{
RCLCPP_WARN(cm->get_logger(), "Unable to lock the memory: '%s'", lock_result.second.c_str());
}
}

RCLCPP_INFO(cm->get_logger(), "update rate is %d Hz", cm->get_update_rate());
Expand Down

0 comments on commit f89c466

Please sign in to comment.