mirror of
https://github.com/CopterExpress/clover.git
synced 2026-05-28 14:09:33 +00:00
docs: add takeoff_wait function to snippets
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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}
|
||||
|
||||
Лететь в точку и ждать пока коптер долетит в нее:
|
||||
|
||||
Reference in New Issue
Block a user