Skip to content

Commit 26245df

Browse files
authored
docs: add snippet on how to check if code is running inside simulation
1 parent d6f9327 commit 26245df

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

docs/en/snippets.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,3 +480,11 @@ param_set(param_id='COM_FLTMODE1', value=ParamValue(integer=8))
480480
# Set parameter of type FLOAT:
481481
param_set(param_id='MPC_Z_P', value=ParamValue(real=1.5))
482482
```
483+
484+
### # {#is-simulation}
485+
486+
Check, if the code is running inside a [Gazebo simulation](simulation.md):
487+
488+
```python
489+
is_simulation = rospy.get_param('/use_sim_time', False)
490+
```

docs/ru/snippets.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,3 +491,11 @@ param_set(param_id='COM_FLTMODE1', value=ParamValue(integer=8))
491491
# Изменить параметр типа FLOAT:
492492
param_set(param_id='MPC_Z_P', value=ParamValue(real=1.5))
493493
```
494+
495+
### # {#is-simulation}
496+
497+
Проверить, что код запущен в [симуляции Gazebo](simulation.md):
498+
499+
```python
500+
is_simulation = rospy.get_param('/use_sim_time', False)
501+
```

0 commit comments

Comments
 (0)