Skip to content

Commit dfd25f6

Browse files
Tomas BacaTomas Baca
authored andcommitted
updated time
1 parent 2a86b63 commit dfd25f6

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

docs/10-prerequisities/25-ros2/50-ros1-ros2-patterns/cpp_working_with_time.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,31 @@ description: Working with ROS Time in ROS2
1010

1111
## Comparing times
1212

13-
## Rate
13+
## rclcpp::Rate
1414

15-
## Duration
15+
## rclcpp::Duration
1616

1717
Duration object storing an interal of `1 second`:
1818
```cpp
1919
rclcpp::Duration(std::chrono::duration<double>(1.0))
2020
```
2121
22+
## rclcpp::Time
23+
24+
* creating the Time object out of a floating point time:
25+
```cpp
26+
rclcpp::Duration(std::chrono::duration<double>(1.0))
27+
```
28+
2229
## Sleeping
2330

31+
What was in ROS1 done as:
32+
```cpp
33+
ros::Duration(duration).sleep();
34+
```
35+
is in ROS2 done as:
36+
```cpp
37+
clock_->sleep_for(std::chrono::duration<double>(duration));
38+
```
39+
2440
## Simulation time

0 commit comments

Comments
 (0)