Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Raises
------
ActionError
If the request fails. The error contains the reason for the failure.
"""
request = action_pb2.SetReturnToLaunchAltitudeRequest()
request.relative_altitude_m = relative_altitude_m
response = await self._stub.SetReturnToLaunchAltitude(request)
result = self._extract_result(response)
if result.result is not ActionResult.Result.SUCCESS:
raise ActionError(result, "set_return_to_launch_altitude()", relative_altitude_m)
This switches the drone to 'Land' flight mode.
Raises
------
ActionError
If the request fails. The error contains the reason for the failure.
"""
request = action_pb2.LandRequest()
response = await self._stub.Land(request)
result = self._extract_result(response)
if result.result is not ActionResult.Result.SUCCESS:
raise ActionError(result, "land()")
Raises
------
ActionError
If the request fails. The error contains the reason for the failure.
"""
request = action_pb2.SetTakeoffAltitudeRequest()
request.altitude = altitude
response = await self._stub.SetTakeoffAltitude(request)
result = self._extract_result(response)
if result.result is not ActionResult.Result.SUCCESS:
raise ActionError(result, "set_takeoff_altitude()", altitude)
reject the disarm command. Disarming means that all motors will stop.
Raises
------
ActionError
If the request fails. The error contains the reason for the failure.
"""
request = action_pb2.DisarmRequest()
response = await self._stub.Disarm(request)
result = self._extract_result(response)
if result.result is not ActionResult.Result.SUCCESS:
raise ActionError(result, "disarm()")
This will reboot the autopilot, companion computer, camera and gimbal.
Raises
------
ActionError
If the request fails. The error contains the reason for the failure.
"""
request = action_pb2.RebootRequest()
response = await self._stub.Reboot(request)
result = self._extract_result(response)
if result.result is not ActionResult.Result.SUCCESS:
raise ActionError(result, "reboot()")
is already in multicopter mode.
Raises
------
ActionError
If the request fails. The error contains the reason for the failure.
"""
request = action_pb2.TransitionToMulticopterRequest()
response = await self._stub.TransitionToMulticopter(request)
result = self._extract_result(response)
if result.result is not ActionResult.Result.SUCCESS:
raise ActionError(result, "transition_to_multicopter()")
back to the launch (takeoff) position and land there.
Raises
------
ActionError
If the request fails. The error contains the reason for the failure.
"""
request = action_pb2.ReturnToLaunchRequest()
response = await self._stub.ReturnToLaunch(request)
result = self._extract_result(response)
if result.result is not ActionResult.Result.SUCCESS:
raise ActionError(result, "return_to_launch()")
Before arming take all safety precautions and stand clear of the drone!
Raises
------
ActionError
If the request fails. The error contains the reason for the failure.
"""
request = action_pb2.ArmRequest()
response = await self._stub.Arm(request)
result = self._extract_result(response)
if result.result is not ActionResult.Result.SUCCESS:
raise ActionError(result, "arm()")
Note that the vehicle must be armed before it can take off.
Raises
------
ActionError
If the request fails. The error contains the reason for the failure.
"""
request = action_pb2.TakeoffRequest()
response = await self._stub.Takeoff(request)
result = self._extract_result(response)
if result.result is not ActionResult.Result.SUCCESS:
raise ActionError(result, "takeoff()")
Raises
------
ActionError
If the request fails. The error contains the reason for the failure.
"""
request = action_pb2.SetMaximumSpeedRequest()
request.speed = speed
response = await self._stub.SetMaximumSpeed(request)
result = self._extract_result(response)
if result.result is not ActionResult.Result.SUCCESS:
raise ActionError(result, "set_maximum_speed()", speed)