docs: while True -> while not rospy.is_shutdown() in snippets

This commit is contained in:
Oleg Kalachev
2019-07-29 22:48:28 +03:00
parent 76a358e3bb
commit 6ea693eb85
2 changed files with 8 additions and 8 deletions

View File

@@ -37,7 +37,7 @@ start = get_telemetry()
print navigate(z=z, speed=0.5, frame_id='body', auto_arm=True)
# Waiting for takeoff
while True:
while not rospy.is_shutdown():
# Checking current altitude
if get_telemetry().z - start.z + z < tolerance:
# Takeoff complete
@@ -52,7 +52,7 @@ 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:
while not rospy.is_shutdown():
if get_telemetry().z - start.z + z < tolerance:
break
@@ -71,7 +71,7 @@ frame_id='aruco_map'
print navigate(frame_id=frame_id, x=1, y=2, z=3, speed=0.5)
# Wait for the copter to arrive at the requested point
while True:
while not rospy.is_shutdown():
telem = get_telemetry(frame_id=frame_id)
# Calculating the distance to the requested point
if get_distance(1, 2, 3, telem.x, telem.y, telem.z) < tolerance:

View File

@@ -54,7 +54,7 @@ start = get_telemetry()
print navigate(z=z, speed=0.5, frame_id='body', auto_arm=True)
# Ожидаем взлета
while True:
while not rospy.is_shutdown():
# Проверяем текущую высоту
if get_telemetry().z - start.z + z < tolerance:
# Взлет завершен
@@ -69,7 +69,7 @@ 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:
while not rospy.is_shutdown():
if get_telemetry().z - start.z + z < tolerance:
break
@@ -88,7 +88,7 @@ frame_id='aruco_map'
print navigate(frame_id=frame_id, x=1, y=2, z=3, speed=0.5)
# Ждем, пока коптер долетит до запрошенной точки
while True:
while not rospy.is_shutdown():
telem = get_telemetry(frame_id=frame_id)
# Вычисляем расстояние до заданной точки
if get_distance(1, 2, 3, telem.x, telem.y, telem.z) < tolerance:
@@ -103,7 +103,7 @@ while True:
def navigate_wait(x, y, z, speed, frame_id, tolerance=0.2):
navigate(x=x, y=y, z=z, speed=speed, frame_id=frame_id)
while True:
while not rospy.is_shutdown():
telem = get_telemetry(frame_id=frame_id)
if get_distance(x, y, z, telem.x, telem.y, telem.z) < tolerance:
break
@@ -116,7 +116,7 @@ def navigate_wait(x, y, z, speed, frame_id, tolerance=0.2):
def navigate_wait(x, y, z, speed, frame_id, tolerance=0.2):
navigate(x=x, y=y, z=z, speed=speed, frame_id=frame_id)
while True:
while not rospy.is_shutdown():
telem = get_telemetry(frame_id='navigate_target')
if math.sqrt(telem.x ** 2 + telem.y ** 2 + telem.z ** 2) < tolerance:
break