Skip to content

Commit

Permalink
fix the logic for async hardware components
Browse files Browse the repository at this point in the history
  • Loading branch information
saikishor committed Jan 16, 2025
1 parent 8b52c3d commit b74a55b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions hardware_interface/src/actuator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,12 +294,12 @@ const rclcpp::Time & Actuator::get_last_write_time() const { return last_write_c

const HardwareComponentStatisticsCollector & Actuator::get_read_statistics() const
{
return read_statistics_;
return !impl_->get_hardware_info().is_async ? read_statistics_ : write_statistics_;
}

const HardwareComponentStatisticsCollector & Actuator::get_write_statistics() const
{
return write_statistics_;
return !impl_->get_hardware_info().is_async ? write_statistics_ : read_statistics_;
}

return_type Actuator::read(const rclcpp::Time & time, const rclcpp::Duration & period)
Expand Down
4 changes: 2 additions & 2 deletions hardware_interface/src/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,12 +292,12 @@ const rclcpp::Time & System::get_last_write_time() const { return last_write_cyc

const HardwareComponentStatisticsCollector & System::get_read_statistics() const
{
return read_statistics_;
return !impl_->get_hardware_info().is_async ? read_statistics_ : write_statistics_;
}

const HardwareComponentStatisticsCollector & System::get_write_statistics() const
{
return write_statistics_;
return !impl_->get_hardware_info().is_async ? write_statistics_ : read_statistics_;
}

return_type System::read(const rclcpp::Time & time, const rclcpp::Duration & period)
Expand Down

0 comments on commit b74a55b

Please sign in to comment.