Skip to content

Commit

Permalink
Guard condition to check node clock is not zero, to suppress "No cloc…
Browse files Browse the repository at this point in the history
…k received" error from ros2_control. (#1027)

Added guard condition to check node clock is not zero, to suppress "No clock received" error from ros2_control.
  • Loading branch information
ralphieraccoon authored Feb 2, 2025
1 parent 9d870d1 commit 73551ef
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion webots_ros2_control/src/Ros2Control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ namespace webots_ros2_control {
void Ros2Control::step() {
const int nowMs = wb_robot_get_time() * 1000.0;
const int periodMs = nowMs - mLastControlUpdateMs;
if (periodMs >= mControlPeriodMs) {
if (periodMs >= mControlPeriodMs && mNode->get_clock()->now() != rclcpp::Time(0, 0, mNode->get_clock()->get_clock_type())) {
const rclcpp::Duration dt = rclcpp::Duration::from_seconds(mControlPeriodMs / 1000.0);
mControllerManager->read(mNode->get_clock()->now(), dt);

Expand Down
2 changes: 2 additions & 0 deletions webots_ros2_driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ find_package(yaml-cpp REQUIRED)

if($ENV{ROS_DISTRO} MATCHES "humble")
find_package(Python 3.10 EXACT REQUIRED COMPONENTS Development)
elseif($ENV{ROS_DISTRO} MATCHES "iron")
find_package(Python 3.10 EXACT REQUIRED COMPONENTS Development)
elseif($ENV{ROS_DISTRO} MATCHES "jazzy")
find_package(Python 3.12 EXACT REQUIRED COMPONENTS Development)
elseif($ENV{ROS_DISTRO} MATCHES "rolling")
Expand Down

0 comments on commit 73551ef

Please sign in to comment.