Skip to content

Commit c506c55

Browse files
committed
feat: time manager description
1 parent e865720 commit c506c55

1 file changed

Lines changed: 35 additions & 1 deletion

File tree

docs/user-guide/concepts/simulator-architecture.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ The following table summarizes the correlation between connections in hardware a
4646
The simulator architecture is diagrammed below.
4747

4848
| ![Simulator Architecture](../images/simulator_architecture.svg) |
49-
| --- |
49+
| :---: |
5050
| Fig 1: Architecture of the simulator. Note that the blue dashed box refers to the only parts that are active when running on hardware, while every module runs in sim. |
5151

5252
Throughout this guide, we will refer to **_modules_** in the simulator.
@@ -143,6 +143,40 @@ By default, this parameter is set `false`.
143143
When `use_sim_time == true`, however, the node will listen to the `clock` topic as its internal time source.
144144
This means that all timers, calls to `get_clock()`, or any other time for that node will be based off of the `clock` topic.
145145

146+
ROSflight sim can be run with or without the `time_manager`.
147+
If you are using the `time_manager`, note that you can toggle pause/play of the simulation using the `/time_manager/toggle_pause` service call.
148+
149+
!!! warning "When to use the `time_manager`"
150+
151+
The `time_manager` is really only useful when you care about running faster or slower than real time or pausing and starting the simulation.
152+
If you don't care about this, don't run the `time_manager` node, and don't set the `use_sim_time` parameter of other nodes to `true`.
153+
This will free up resources otherwise used by the `time_manager`.
154+
155+
The `time_manager`'s main job is to publish the current time to the `clock` topic.
156+
It needs to publish fast enough so that other timers on other nodes aren't stalled because the `clock` topic isn't coming fast enough.
157+
158+
159+
The `time_manager` has some built in functionality to enable faster or slower than real time simulations.
160+
This is done by configuring the parameters associated with the `time_manager` node.
161+
162+
| <span style="display: inline-block; width:150px">Parameter name</span> | Default value | Description |
163+
| --- | --- | --- |
164+
| `default_pub_rate_us` | 100.0 | Default interval the time manager will publish to the `clock` topic (in microseconds) |
165+
| `real_time_multiplier` | 1.0 | Multiplier for configuring faster or slower than real time simulations. E.g. set to 2 to run 2 times as fast as real time |
166+
167+
!!! example "Pub rate example"
168+
169+
Let's say I know that the fastest timer in my simulation environment runs at 400 Hz.
170+
Thus, that timer has to tick every 2.5 ms.
171+
The `default_pub_rate` parameter therefore needs to be **smaller than 2500** so that the timer runs reliably.
172+
173+
Note that we have not tested all of the timing intracacies of the `clock` topic--set it to publish faster than you need and you probably won't run into issues.
174+
175+
!!! example "Real time multiplier example"
176+
177+
If I want to run a simulation 2 times faster than real time, I would set `real_time_multiplier = 2.0`.
178+
If I wanted to run it 0.5 times as fast as real time, I would set it to 0.5.
179+
146180
### Sim Manager
147181

148182
### SIL Board

0 commit comments

Comments
 (0)