Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions content/api/servos.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
title: Servos
---

{{% notice note %}}
Servos only apply to the [physical robot](/robots/physical/).
{{% /notice %}}

You can control attached servo motors from the [Arduino](../arduino/). By default, servos will be unpowered when your robot starts, and can freely rotate when turned by hand. Upon setting a value, they will hold the corresponding position. They will become unpowered again when you turn off your robot, unplug your USB stick, or set their position to the special value `None`.

## Querying servos

The servo assembly can interface with up to sixteen servos connected to it.

```python
servo_zero = r.arduino.servos[0]
```

{{% notice tip %}}
Servo can be connected to any port, you don't have to start at 0!
{{% /notice %}}

## Controlling servos

Servos can be controlled using the `position` parameter. This should be set to a value between -1 and 1.

```python
servo_zero.position = 0.65
print(servo_zero.position)
>>> 0.65
```

{{% notice tip %}}
When `position` is set to `None`, the servo loses power and can freely rotate. This is the same state they're in at start-up.
{{% /notice %}}
4 changes: 3 additions & 1 deletion content/robots/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ In this year's competition we have 2 Robots, which are each controlled by their
- [Crane Robot](crane) which is controlled by `crane.py`.
- [Forklift Robot](forklift) which is controlled by `forklift.py`.

See [the API section](../api/) for more details on how to run your code.
There is also a [Physical Robot](physical).

See [the API section](../api/) for more details on how to run your code.
23 changes: 23 additions & 0 deletions content/robots/physical.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: Physical robot
---

The physical robot is closely modelled after the [forklift](../forklift) robot, however is different in a few important ways. The physical robot has two [radial motors](/api/motor-board), allowing it to move itself around the arena.

## Motor layout

The layout of the motors attached to the motor boards for the forklift robot are as follows:

- Motor Board 0:
- Motor 0 - Left wheel motor
- Motor 1 - Right wheel motor

## Servos

The front grabber is actuated by a single [servo](/api/servos), attached to the [Arduino](/api/arduino/#servos). It is plugged in to port 0.

The servo will only let you move the grabber in a safe range. `-1` will open the grabber, and `1` will close the grabber.

## Ultrasound

The forklift has an [ultrasound sensor](/api/ultrasound) attached to the front of the robot. This sensor uses pin 4 as the trigger pin and 5 as the echo.