Skip to content

Commit

Permalink
Add documentation for peripherals
Browse files Browse the repository at this point in the history
  • Loading branch information
sindrehan committed Sep 26, 2023
1 parent 0059a1e commit 12c440c
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
51 changes: 51 additions & 0 deletions docs/peripherals.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Peripherals

The `Drone` class maintains a list of peripherals that are attached to the drone. These peripherals can include cameras, grippers, and other devices that can be controlled using the drone's API.

To list the peripherals that are currently attached to the drone, you can check the `peripherals` attribute of the `Drone` class. This attribute is a list of [`Peripheral`](reference/blueye/sdk/guestport.md#peripheral) objects.

The SDK will also create attributes for supported peripherals to simplify access.

## External camera
If the drone has a camera attached, the `Drone` class will have an `external_camera` attribute that is a [`GuestPortCamera`](reference/blueye/sdk/guestport.md#guestportcamera) object. This object can be used to control the camera.

```python
# Capture an image from the external camera
drone.external_camera.take_picture()

# Set bitrate for external camera to 2 Mbps
drone.external_camera.bitrate = 2_000_000

# Start recording video from the external camera
drone.external_camera.is_recording = True
```

## External light
If the drone has an external light attached, the `Drone` class will have an `external_light` attribute that is a [`GuestPortLight`](reference/blueye/sdk/guestport.md#guestportlight) object. This object can be used to control the light.

```python
# Get the current intensity of the external light
intensity: float = drone.external_light.get_intensity()

# Set the intensity of the external light to 0.5
drone.external_light.set_intensity(0.5)
```

## Gripper
If the drone has a gripper attached, the `Drone` class will have a `gripper` attribute that is a [`Gripper`](reference/blueye/sdk/guestport.md#gripper) object. This object can be used to control the grip and rotation of the gripper.

If the connected gripper does not support rotation, the `rotation_velocity` property will be ignored.

```python
# Open the gripper
drone.gripper.grip_velocity = 1.0

# Close the gripper
drone.gripper.grip_velocity = -1.0

# Rotate the gripper clockwise
drone.gripper.rotation_velocity = 1.0

# Rotate the gripper counterclockwise
drone.gripper.rotation_velocity = -1.0
```
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ nav:
- "Legacy log file format": "logs/legacy-log-file-format.md"
- "Configure drone parameters": "configuration.md"
- "Subscribing to a telemetry message": "telemetry-callback.md"
- "Peripherals": "peripherals.md"
- "Updating from v1 to v2": "migrating-to-v2.md"
- "Protobuf protocol": "protobuf-protocol.md"
- "HTTP API": "http-api.html"
Expand Down

0 comments on commit 12c440c

Please sign in to comment.