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 @@ -1801,9 +1801,12 @@ HardwareReadWriteStatus ResourceManager::read(
1801
1801
1.0 / resource_storage_->hardware_info_map_ [component.get_name ()].read_rate );
1802
1802
if (
1803
1803
component.get_last_read_time ().seconds () == 0 ||
1804
- (time - component.get_last_read_time ()). seconds () >= hw_read_period. seconds () )
1804
+ (time - component.get_last_read_time ()) >= hw_read_period)
1805
1805
{
1806
- ret_val = component.read (time, hw_read_period);
1806
+ const rclcpp::Duration actual_period = component.get_last_read_time ().seconds () == 0
1807
+ ? hw_read_period
1808
+ : time - component.get_last_read_time ();
1809
+ ret_val = component.read (time, actual_period);
1807
1810
}
1808
1811
}
1809
1812
const auto component_group = component.get_group_name ();
@@ -1878,9 +1881,12 @@ HardwareReadWriteStatus ResourceManager::write(
1878
1881
1.0 / resource_storage_->hardware_info_map_ [component.get_name ()].write_rate );
1879
1882
if (
1880
1883
component.get_last_write_time ().seconds () == 0 ||
1881
- (time - component.get_last_write_time ()). seconds () >= hw_write_period. seconds () )
1884
+ (time - component.get_last_write_time ()) >= hw_write_period)
1882
1885
{
1883
- ret_val = component.write (time, hw_write_period);
1886
+ const rclcpp::Duration actual_period = component.get_last_write_time ().seconds () == 0
1887
+ ? hw_write_period
1888
+ : time - component.get_last_read_time ();
1889
+ ret_val = component.write (time, actual_period);
1884
1890
}
1885
1891
}
1886
1892
const auto component_group = component.get_group_name ();
You can’t perform that action at this time.
0 commit comments