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 5 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
35 changes: 34 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,37 @@ 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 Canbus, a communication standard
guilhermedemouraa marked this conversation as resolved.
Show resolved Hide resolved
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
## 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.
19 changes: 17 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,23 @@ 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. **Asynchronous Programming with asyncio**: A good understanding of Python's asyncio library is
crucial since the example employs asynchronous functions and tasks, denoted by the `async/await` syntax.

3. **Protocol Buffers (protobuf)**: Familiarity with Protocol Buffers and how they work in Python,
guilhermedemouraa marked this conversation as resolved.
Show resolved Hide resolved
especially since the example uses protobuf messages like EventServiceConfig and methods such as proto_from_json_file.
:::

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
26 changes: 23 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,31 @@ 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.

2. **File Handling**: The central operation in this example is reading from a `.bin` file and writing
data to either `.mp4` video files or `.jpg` image files.
Therefore, understanding how file I/O works in Python, especially with binary files, is crucial.

3. **OpenCV**: The OpenCV library is leveraged extensively in this example, especially for operations
related to image decoding, processing, and video writing.
A basic understanding of these aspects of OpenCV is necessary.
guilhermedemouraa marked this conversation as resolved.
Show resolved Hide resolved

4. **File Conversion and Visualization**: The primary goal of this example is to convert data
from a log file into a visual format, either as a video or a series of images.Knowledge about the
basics of multimedia formats, especially videos and images, is beneficial.

:::

> 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
22 changes: 21 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,29 @@ 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. **File Handling**: Proficiency in reading from and processing files in Python, particularly binary
log files.
The essence of this example is to demonstrate how to navigate through and interpret data from a log file.

3. **OpenCV**: A foundational understanding of the OpenCV library, particularly functions related to
guilhermedemouraa marked this conversation as resolved.
Show resolved Hide resolved
image decoding and display, as the example showcases how to visualize camera images from the log file.

4. **Log File Manipulation**: Insight into how log files work, especially reading and parsing them,
is crucial.
This example emphasizes the playback mode, wherein data from a previously recorded log file is
processed for review.
guilhermedemouraa marked this conversation as resolved.
Show resolved Hide resolved
:::

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
22 changes: 20 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,26 @@ 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. **File Handling**: The code reads from a .bin file, specifically a log file containing
recorded CAN data.
Understanding file I/O, especially with binary files, is essential.

3. **CAN Protocol**: CAN (Controller Area Network) is a robust communication protocol used mainly
guilhermedemouraa marked this conversation as resolved.
Show resolved Hide resolved
in automotive and industrial applications.
In this example, the log file contains recorded CAN messages, and the goal is to parse and
display specific message types.
Familiarity with the basics of CAN is beneficial.
:::

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
15 changes: 13 additions & 2 deletions website/docs/examples/file_reader_gps/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,19 @@ 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.
:::info Basic Knowledge Requirements

1. **Python Programming**: Understanding basic Python programming concepts such as functions, loops,
conditional statements, and type-checking.

2. **File Handling**: Familiarity with reading binary files in Python.
guilhermedemouraa marked this conversation as resolved.
Show resolved Hide resolved

guilhermedemouraa marked this conversation as resolved.
Show resolved Hide resolved
3. **GPS Data**: Knowledge of GPS-related metrics, such as latitude, longitude, altitude,
and ground speed.
:::

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.
Expand Down
Loading