Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Follow up on website documentation #231

Merged
merged 19 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
51 changes: 50 additions & 1 deletion website/docs/concepts/canbus_service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,53 @@ title: CANBUS

# Canbus Service Overview

(Coming soon!)
The Canbus service is an integral component of the Amiga platform.
This service offers direct control over the robot's motors, allowing users to both
publish motor states and send specific commands to manipulate the robot's movements.

## Overview

- **Purpose**: Control and manage the motors on the Amiga, handling command reception,
processing, and motor instruction.
- **Communication**: Direct interface with motors via CAN bus, a communication standard
or microcontrollers and devices.
- **Dependencies**: Standalone service, but pivotal for many autonomous operations.
Notably, the Controller service is heavily reliant on the Canbus service.

## API

1. `/twist`: Receives twist commands (linear and angular velocities) and instructs the
motors accordingly.
2. `/can_message`: Accepts a specific Protobuf message format (details TBD).
3. `/get_battery_state`: Returns the battery state.
A float value indicating the battery's state of charge, ranging [0.0, 1.0].
If no motors are connected, it returns -1.0.

guilhermedemouraa marked this conversation as resolved.
Show resolved Hide resolved
# Data Streams

- `/twist`: The commanded linear velocity of the vehicle in the x direction in meters per second.
Check the protobuf definition for more details:
[canbus_pb2.Twist2d](https://github.com/farm-ng/farm-ng-amiga/blob/main/protos/farm_ng/canbus/canbus.proto#L58-L61)

- `/raw_messages`:A representation of raw CAN bus messages with timestamps, node IDs, error
flags, remote transmission indicators, and encoded payloads.
Check the protobuf definition for more details:
[canbus_pb2.RawCanbusMessages](https://github.com/farm-ng/farm-ng-amiga/blob/main/protos/farm_ng/canbus/canbus.proto#L95-L107)

- `/state`: State of the Amiga CAN bus.
Encapsulates key information required to evaluate the state of the Amiga robot.
Check the protobuf definition for more details:
[amiga_v6_pb2.AmigaV6CanbusState](https://github.com/farm-ng/farm-ng-amiga/blob/main-v2/protos/farm_ng/canbus/amiga_v6.proto)

## Safety and Operation

- **Operating Mode**: The robot should be in automode (activated via the dashboard)
to utilize the Canbus service.
- **Safety Perimeter**: Establish a clear perimeter when operating the robot, as motor
commands will induce movement, ensuring safe operation.

## Common Use-Cases

The Canbus service is foundational for many of Amiga's autonomous functionalities.
For instance, the Controller service is a prominent client of the Canbus service, making the
Canbus service pivotal for any autonomous motion or activity undertaken by the Amiga.
16 changes: 14 additions & 2 deletions website/docs/examples/events_recorder/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,20 @@ title: Events Recorder

## Events Recorder

In [this example](https://github.com/farm-ng/farm-ng-amiga/blob/main-v2/py/examples/event_recorder/main.py)
we show how to record events from farm-ng-brain using
:::info Basic Knowledge Requirements

Before diving into this example, here's a quick heads-up on what you'll need to be familiar with:

1. **Python Programming**: It's essential to be well-versed in Python, as the example leverages foundational
concepts such as functions, conditional statements, and command-line argument parsing using the
argparse module.

2. **[farm-ng Recorder Service Overview](/docs/concepts/recorder_service/)**:
This overview provides a base understanding of the gRPC service the client you create will connect to.
:::

In the [**Events Recorder**](https://github.com/farm-ng/farm-ng-amiga/blob/main-v2/py/examples/event_recorder/main.py)
example we show how to record events from farm-ng-brain using
the `EventClient` class.

### 1. Install the [farm-ng Brain ADK package](/docs/brain/brain-install)
Expand Down
13 changes: 10 additions & 3 deletions website/docs/examples/file_converter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@ id: file-converter
title: File Converter
---


# File Converter Example

> [This example](https://github.com/farm-ng/farm-ng-amiga/blob/main-v2/py/examples/file_converter/main.py)
will take the `*.bin` log file for a given Oak Camera Stream or snapshot
:::info Basic Knowledge Requirements

Before diving into this example, here's a quick overview of what you'll need to be familiar with:

1. **Python Programming**: This example is based in Python, making use of various foundational
constructs like functions, conditional statements, and object-oriented techniques.
:::

> The [**File Converter example**](https://github.com/farm-ng/farm-ng-amiga/blob/main-v2/py/examples/file_converter/main.py)
will take the `*.bin` log file for a given Oak Camera Stream or snapshot
> captured by the Recorder app on an Amiga brain and convert it to either
> `*.mp4` videos or `*.jpg` images for each view stream.

Expand Down
13 changes: 12 additions & 1 deletion website/docs/examples/file_reader/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,20 @@ title: File Reader

# File Reader Example

:::info Basic Knowledge Requirements

Before diving into this example, here's a quick overview of what you'll need to be familiar with:

1. **Python Programming**: Mastery of Python is essential, as the example employs foundational
concepts such as functions, conditional statements, and working with third-party libraries.

2. **OpenCV**: A foundational understanding of the OpenCV library, particularly functions related to
image decoding and display, as the example showcases how to visualize camera images from the log file.
:::

In this example you will learn how to upload a given log file and
use it to run the
[**file_reader example**](https://github.com/farm-ng/farm-ng-amiga/tree/main-v2/py/examples/file_reader/main.py).
[**File Reader Example**](https://github.com/farm-ng/farm-ng-amiga/tree/main-v2/py/examples/file_reader/main.py).

## Install the [farm-ng Brain ADK package](/docs/brain/brain-install)

Expand Down
15 changes: 13 additions & 2 deletions website/docs/examples/file_reader_can/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,19 @@ title: File Reader CAN

# File Reader CAN Example

This [**file_reader_can example**](https://github.com/farm-ng/farm-ng-amiga/tree/main-v2/py/examples/file_reader_can/main.py)
parses the CAN data from a recorded log and prints the `AmigaTpdo1` parsed
:::info Basic Knowledge Requirements

Before diving into this example, here's a quick overview of what you'll need to be familiar with:

1. **Python Programming**: This code is written in Python.
Basic constructs such as functions, conditional statements, loops, and more are utilized.

2. **[farm-ng Canbus Service Overview](/docs/concepts/canbus_service/)**:
This overview provides a base understanding of the gRPC service the client you create will connect to.
:::

This [**File Reader Can**](https://github.com/farm-ng/farm-ng-amiga/tree/main-v2/py/examples/file_reader_can/main.py)
example parses the CAN data from a recorded log and prints the `AmigaTpdo1` parsed
values. The `AmigaTpdo1` can packet contains
the `state`, `speed`, and `angular rate` of the Amiga, as
reported by the vehicle control unit (VCU).
Expand Down
26 changes: 11 additions & 15 deletions website/docs/examples/file_reader_gps/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,21 @@ title: File Reader GPS

# File Reader GPS Example

This [**file_reader_gps_example**](https://github.com/farm-ng/farm-ng-amiga/blob/main-v2/py/examples/file_reader_gps/main.py)
provides a utility for reading and parsing GPS messages from the event file.
It can process two types of GPS messages: `relposned` and `pvt`.
The user specifies the type of GPS message to parse, and the script reads the corresponding data,
unpacks it, and prints it to the console.

:::info
There are two types of GPS messages: **PVT** and **RELPOSNED**.
:::info Basic Knowledge Requirements

**PVT** (Position, Velocity, and Time) messages provide the all-in-one solution: position, velocity,
and time.
It contains details like longitude, latitude, altitude, speed, and UTC time.
1. **Python Programming**: Understanding basic Python programming concepts such as functions, loops,
conditional statements, and type-checking.

**RELPOSNED** (Relative Positioning) messages provide relative position
information in a North, East, Down (N-E-D) frame. It's mainly used for applications requiring relative
positioning between two receivers, often as a part of Real Time Kinematics (RTK) solutions.
It shows the difference in position between a "moving" receiver and a "fixed" reference receiver.
2. **[farm-ng GPS Service Overview](/docs/concepts/gps_service/)**:
This overview provides a base understanding of the gRPC service the client you create will connect to.
:::

This [**File Reader GPS**](https://github.com/farm-ng/farm-ng-amiga/blob/main-v2/py/examples/file_reader_gps/main.py)
example provides a utility for reading and parsing GPS messages from the event file.
It can process two types of GPS messages: `relposned` and `pvt`.
The user specifies the type of GPS message to parse, and the script reads the corresponding data,
unpacks it, and prints it to the console.

## Install the [farm-ng Brain ADK package](/docs/brain/brain-install)

## Download the example log file
Expand Down
Loading