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 @@ -1630,9 +1630,12 @@ HardwareReadWriteStatus ResourceManager::read(
1630
1630
1.0 / resource_storage_->hardware_info_map_ [component.get_name ()].read_rate );
1631
1631
if (
1632
1632
component.get_last_read_time ().seconds () == 0 ||
1633
- (time - component.get_last_read_time ()). seconds () >= hw_read_period. seconds () )
1633
+ (time - component.get_last_read_time ()) >= hw_read_period)
1634
1634
{
1635
- ret_val = component.read (time, hw_read_period);
1635
+ const rclcpp::Duration actual_period = component.get_last_read_time ().seconds () == 0
1636
+ ? hw_read_period
1637
+ : time - component.get_last_read_time ();
1638
+ ret_val = component.read (time, actual_period);
1636
1639
}
1637
1640
}
1638
1641
const auto component_group = component.get_group_name ();
@@ -1707,9 +1710,12 @@ HardwareReadWriteStatus ResourceManager::write(
1707
1710
1.0 / resource_storage_->hardware_info_map_ [component.get_name ()].write_rate );
1708
1711
if (
1709
1712
component.get_last_write_time ().seconds () == 0 ||
1710
- (time - component.get_last_write_time ()). seconds () >= hw_write_period. seconds () )
1713
+ (time - component.get_last_write_time ()) >= hw_write_period)
1711
1714
{
1712
- ret_val = component.write (time, hw_write_period);
1715
+ const rclcpp::Duration actual_period = component.get_last_write_time ().seconds () == 0
1716
+ ? hw_write_period
1717
+ : time - component.get_last_read_time ();
1718
+ ret_val = component.write (time, actual_period);
1713
1719
}
1714
1720
}
1715
1721
const auto component_group = component.get_group_name ();
You can’t perform that action at this time.
0 commit comments