docs: add takeoff_wait function to snippets

This commit is contained in:
Oleg Kalachev
2019-07-20 15:33:06 +03:00
parent 09d06a517f
commit 57c22fccf7
2 changed files with 28 additions and 0 deletions

View File

@@ -45,6 +45,20 @@ while True:
rospy.sleep(0.2)
```
This code can be wrapped in a function:
```python
def takeoff_wait(alt, speed=0.5, tolerance=0.2):
start = get_telemetry()
print navigate(z=alt, speed=speed, frame_id='body', auto_arm=True)
while True:
if get_telemetry().z - start.z + z < tolerance:
break
rospy.sleep(0.2)
```
### # {#block-nav}
Flying towards a point and waiting for copter's arrival:

View File

@@ -62,6 +62,20 @@ while True:
rospy.sleep(0.2)
```
Вышеприведенный код может быть обернут в функцию:
```python
def takeoff_wait(alt, speed=0.5, tolerance=0.2):
start = get_telemetry()
print navigate(z=alt, speed=speed, frame_id='body', auto_arm=True)
while True:
if get_telemetry().z - start.z + z < tolerance:
break
rospy.sleep(0.2)
```
### # {#block-nav}
Лететь в точку и ждать пока коптер долетит в нее: