Skip to content

Commit 6276349

Browse files
committed
mavsdk: update to v2.6.0
This brings: - gimbal andles - camera zoom - camera_server zoom Signed-off-by: Julian Oes <[email protected]>
1 parent 8ebfdec commit 6276349

11 files changed

+2233
-123
lines changed

MAVSDK_SERVER_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v2.4.0
1+
v2.6.0

mavsdk/camera.py

Lines changed: 264 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2426,4 +2426,268 @@ async def reset_settings(self):
24262426

24272427
if result.result != CameraResult.Result.SUCCESS:
24282428
raise CameraError(result, "reset_settings()")
2429+
2430+
2431+
async def zoom_in_start(self):
2432+
"""
2433+
Start zooming in.
2434+
2435+
Raises
2436+
------
2437+
CameraError
2438+
If the request fails. The error contains the reason for the failure.
2439+
"""
2440+
2441+
request = camera_pb2.ZoomInStartRequest()
2442+
response = await self._stub.ZoomInStart(request)
2443+
2444+
2445+
result = self._extract_result(response)
2446+
2447+
if result.result != CameraResult.Result.SUCCESS:
2448+
raise CameraError(result, "zoom_in_start()")
2449+
2450+
2451+
async def zoom_out_start(self):
2452+
"""
2453+
Start zooming out.
2454+
2455+
Raises
2456+
------
2457+
CameraError
2458+
If the request fails. The error contains the reason for the failure.
2459+
"""
2460+
2461+
request = camera_pb2.ZoomOutStartRequest()
2462+
response = await self._stub.ZoomOutStart(request)
2463+
2464+
2465+
result = self._extract_result(response)
2466+
2467+
if result.result != CameraResult.Result.SUCCESS:
2468+
raise CameraError(result, "zoom_out_start()")
2469+
2470+
2471+
async def zoom_stop(self):
2472+
"""
2473+
Stop zooming.
2474+
2475+
Raises
2476+
------
2477+
CameraError
2478+
If the request fails. The error contains the reason for the failure.
2479+
"""
2480+
2481+
request = camera_pb2.ZoomStopRequest()
2482+
response = await self._stub.ZoomStop(request)
2483+
2484+
2485+
result = self._extract_result(response)
2486+
2487+
if result.result != CameraResult.Result.SUCCESS:
2488+
raise CameraError(result, "zoom_stop()")
2489+
2490+
2491+
async def zoom_range(self, range):
2492+
"""
2493+
Zoom to value as proportion of full camera range (percentage between 0.0 and 100.0).
2494+
2495+
Parameters
2496+
----------
2497+
range : float
2498+
Range must be between 0.0 and 100.0
2499+
2500+
Raises
2501+
------
2502+
CameraError
2503+
If the request fails. The error contains the reason for the failure.
2504+
"""
2505+
2506+
request = camera_pb2.ZoomRangeRequest()
2507+
request.range = range
2508+
response = await self._stub.ZoomRange(request)
2509+
2510+
2511+
result = self._extract_result(response)
2512+
2513+
if result.result != CameraResult.Result.SUCCESS:
2514+
raise CameraError(result, "zoom_range()", range)
2515+
2516+
2517+
async def track_point(self, point_x, point_y, radius):
2518+
"""
2519+
Track point.
2520+
2521+
Parameters
2522+
----------
2523+
point_x : float
2524+
Point in X axis (0..1, 0 is left, 1 is right)
2525+
2526+
point_y : float
2527+
Point in Y axis (0..1, 0 is top, 1 is bottom)
2528+
2529+
radius : float
2530+
Radius (0 is one pixel, 1 is full image width)
2531+
2532+
Raises
2533+
------
2534+
CameraError
2535+
If the request fails. The error contains the reason for the failure.
2536+
"""
2537+
2538+
request = camera_pb2.TrackPointRequest()
2539+
request.point_x = point_x
2540+
request.point_y = point_y
2541+
request.radius = radius
2542+
response = await self._stub.TrackPoint(request)
2543+
2544+
2545+
result = self._extract_result(response)
2546+
2547+
if result.result != CameraResult.Result.SUCCESS:
2548+
raise CameraError(result, "track_point()", point_x, point_y, radius)
2549+
2550+
2551+
async def track_rectangle(self, top_left_x, top_left_y, bottom_right_x, bottom_right_y):
2552+
"""
2553+
Track rectangle.
2554+
2555+
Parameters
2556+
----------
2557+
top_left_x : float
2558+
Top left corner of rectangle x value (normalized 0..1, 0 is left, 1 is right)
2559+
2560+
top_left_y : float
2561+
Top left corner of rectangle y value (normalized 0..1, 0 is top, 1 is bottom)
2562+
2563+
bottom_right_x : float
2564+
Bottom right corner of rectangle x value (normalized 0..1, 0 is left, 1 is right)
2565+
2566+
bottom_right_y : float
2567+
Bottom right corner of rectangle y value (normalized 0..1, 0 is top, 1 is bottom)
2568+
2569+
Raises
2570+
------
2571+
CameraError
2572+
If the request fails. The error contains the reason for the failure.
2573+
"""
2574+
2575+
request = camera_pb2.TrackRectangleRequest()
2576+
request.top_left_x = top_left_x
2577+
request.top_left_y = top_left_y
2578+
request.bottom_right_x = bottom_right_x
2579+
request.bottom_right_y = bottom_right_y
2580+
response = await self._stub.TrackRectangle(request)
2581+
2582+
2583+
result = self._extract_result(response)
2584+
2585+
if result.result != CameraResult.Result.SUCCESS:
2586+
raise CameraError(result, "track_rectangle()", top_left_x, top_left_y, bottom_right_x, bottom_right_y)
2587+
2588+
2589+
async def track_stop(self):
2590+
"""
2591+
Stop tracking.
2592+
2593+
Raises
2594+
------
2595+
CameraError
2596+
If the request fails. The error contains the reason for the failure.
2597+
"""
2598+
2599+
request = camera_pb2.TrackStopRequest()
2600+
response = await self._stub.TrackStop(request)
2601+
2602+
2603+
result = self._extract_result(response)
2604+
2605+
if result.result != CameraResult.Result.SUCCESS:
2606+
raise CameraError(result, "track_stop()")
2607+
2608+
2609+
async def focus_in_start(self):
2610+
"""
2611+
Start focusing in.
2612+
2613+
Raises
2614+
------
2615+
CameraError
2616+
If the request fails. The error contains the reason for the failure.
2617+
"""
2618+
2619+
request = camera_pb2.FocusInStartRequest()
2620+
response = await self._stub.FocusInStart(request)
2621+
2622+
2623+
result = self._extract_result(response)
2624+
2625+
if result.result != CameraResult.Result.SUCCESS:
2626+
raise CameraError(result, "focus_in_start()")
2627+
2628+
2629+
async def focus_out_start(self):
2630+
"""
2631+
Start focusing out.
2632+
2633+
Raises
2634+
------
2635+
CameraError
2636+
If the request fails. The error contains the reason for the failure.
2637+
"""
2638+
2639+
request = camera_pb2.FocusOutStartRequest()
2640+
response = await self._stub.FocusOutStart(request)
2641+
2642+
2643+
result = self._extract_result(response)
2644+
2645+
if result.result != CameraResult.Result.SUCCESS:
2646+
raise CameraError(result, "focus_out_start()")
2647+
2648+
2649+
async def focus_stop(self):
2650+
"""
2651+
Stop focus.
2652+
2653+
Raises
2654+
------
2655+
CameraError
2656+
If the request fails. The error contains the reason for the failure.
2657+
"""
2658+
2659+
request = camera_pb2.FocusStopRequest()
2660+
response = await self._stub.FocusStop(request)
2661+
2662+
2663+
result = self._extract_result(response)
2664+
2665+
if result.result != CameraResult.Result.SUCCESS:
2666+
raise CameraError(result, "focus_stop()")
2667+
2668+
2669+
async def focus_range(self, range):
2670+
"""
2671+
Focus with range value of full range (value between 0.0 and 100.0).
2672+
2673+
Parameters
2674+
----------
2675+
range : float
2676+
Range must be between 0.0 - 100.0
2677+
2678+
Raises
2679+
------
2680+
CameraError
2681+
If the request fails. The error contains the reason for the failure.
2682+
"""
2683+
2684+
request = camera_pb2.FocusRangeRequest()
2685+
request.range = range
2686+
response = await self._stub.FocusRange(request)
2687+
2688+
2689+
result = self._extract_result(response)
2690+
2691+
if result.result != CameraResult.Result.SUCCESS:
2692+
raise CameraError(result, "focus_range()", range)
24292693

mavsdk/camera_pb2.py

Lines changed: 261 additions & 41 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)