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 @@ -1676,9 +1676,12 @@ HardwareReadWriteStatus ResourceManager::read(
1676
1676
1.0 / resource_storage_->hardware_info_map_ [component.get_name ()].read_rate );
1677
1677
if (
1678
1678
component.get_last_read_time ().seconds () == 0 ||
1679
- (time - component.get_last_read_time ()). seconds () >= hw_read_period. seconds () )
1679
+ (time - component.get_last_read_time ()) >= hw_read_period)
1680
1680
{
1681
- ret_val = component.read (time, hw_read_period);
1681
+ const rclcpp::Duration actual_period = component.get_last_read_time ().seconds () == 0
1682
+ ? hw_read_period
1683
+ : time - component.get_last_read_time ();
1684
+ ret_val = component.read (time, actual_period);
1682
1685
}
1683
1686
}
1684
1687
const auto component_group = component.get_group_name ();
@@ -1753,9 +1756,12 @@ HardwareReadWriteStatus ResourceManager::write(
1753
1756
1.0 / resource_storage_->hardware_info_map_ [component.get_name ()].write_rate );
1754
1757
if (
1755
1758
component.get_last_write_time ().seconds () == 0 ||
1756
- (time - component.get_last_write_time ()). seconds () >= hw_write_period. seconds () )
1759
+ (time - component.get_last_write_time ()) >= hw_write_period)
1757
1760
{
1758
- ret_val = component.write (time, hw_write_period);
1761
+ const rclcpp::Duration actual_period = component.get_last_write_time ().seconds () == 0
1762
+ ? hw_write_period
1763
+ : time - component.get_last_read_time ();
1764
+ ret_val = component.write (time, actual_period);
1759
1765
}
1760
1766
}
1761
1767
const auto component_group = component.get_group_name ();
You can’t perform that action at this time.
0 commit comments