File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -1678,9 +1678,12 @@ HardwareReadWriteStatus ResourceManager::read(
1678
1678
1.0 / resource_storage_->hardware_info_map_ [component.get_name ()].read_rate );
1679
1679
if (
1680
1680
component.get_last_read_time ().seconds () == 0 ||
1681
- (time - component.get_last_read_time ()). seconds () >= hw_read_period. seconds () )
1681
+ (time - component.get_last_read_time ()) >= hw_read_period)
1682
1682
{
1683
- ret_val = component.read (time, hw_read_period);
1683
+ const rclcpp::Duration actual_period = component.get_last_read_time ().seconds () == 0
1684
+ ? hw_read_period
1685
+ : time - component.get_last_read_time ();
1686
+ ret_val = component.read (time, actual_period);
1684
1687
}
1685
1688
}
1686
1689
const auto component_group = component.get_group_name ();
@@ -1755,9 +1758,12 @@ HardwareReadWriteStatus ResourceManager::write(
1755
1758
1.0 / resource_storage_->hardware_info_map_ [component.get_name ()].write_rate );
1756
1759
if (
1757
1760
component.get_last_write_time ().seconds () == 0 ||
1758
- (time - component.get_last_write_time ()). seconds () >= hw_write_period. seconds () )
1761
+ (time - component.get_last_write_time ()) >= hw_write_period)
1759
1762
{
1760
- ret_val = component.write (time, hw_write_period);
1763
+ const rclcpp::Duration actual_period = component.get_last_write_time ().seconds () == 0
1764
+ ? hw_write_period
1765
+ : time - component.get_last_read_time ();
1766
+ ret_val = component.write (time, actual_period);
1761
1767
}
1762
1768
}
1763
1769
const auto component_group = component.get_group_name ();
You can’t perform that action at this time.
0 commit comments