docs: add snippet on how to check if code is running inside simulation

This commit is contained in:
Oleg Kalachev
2022-10-26 03:31:00 +06:00
committed by GitHub
parent d6f9327ede
commit 26245dfb42
2 changed files with 16 additions and 0 deletions

View File

@@ -480,3 +480,11 @@ param_set(param_id='COM_FLTMODE1', value=ParamValue(integer=8))
# Set parameter of type FLOAT: # Set parameter of type FLOAT:
param_set(param_id='MPC_Z_P', value=ParamValue(real=1.5)) param_set(param_id='MPC_Z_P', value=ParamValue(real=1.5))
``` ```
### # {#is-simulation}
Check, if the code is running inside a [Gazebo simulation](simulation.md):
```python
is_simulation = rospy.get_param('/use_sim_time', False)
```

View File

@@ -491,3 +491,11 @@ param_set(param_id='COM_FLTMODE1', value=ParamValue(integer=8))
# Изменить параметр типа FLOAT: # Изменить параметр типа FLOAT:
param_set(param_id='MPC_Z_P', value=ParamValue(real=1.5)) param_set(param_id='MPC_Z_P', value=ParamValue(real=1.5))
``` ```
### # {#is-simulation}
Проверить, что код запущен в [симуляции Gazebo](simulation.md):
```python
is_simulation = rospy.get_param('/use_sim_time', False)
```