structuring the project and docs about drone code

This commit is contained in:
2025-01-29 11:51:07 +01:00
parent 1397d66b54
commit 8e91571c15
16 changed files with 31 additions and 3 deletions

View File

@@ -0,0 +1,14 @@
# Basic linux terminal commands
## When do I need these?
You need to know these commands if you wanna navigate a Unix like system like linux or macOS in the terminal. The terminal is used a lot for git so knowing these commands is a must.
## Commands
| Command | Description |
| --------- | ------------------------------------- |
| cat | read a file and output it to terminal |
| cd | change directory |
| ls | view all files in the current folder |
| ls -la | same as ls but also view hidden files |
| rm <file> | remove a file |

View File

@@ -0,0 +1,39 @@
# Idea final project
## Introduction
I wanted to combine 2 random objects that interest me into one project. A drone and a jumbotron. So im gonna make a drone with multiple screens on it that could for example be used for traffic control or entertainment purposes.
## What does the drone do?
The drone needs to be able to fly for atleast 20 minutes. It needs 2 screens on both side so it can display images or video. I wanna program the drone myself so I know how drones work and how they keep themselves upright.
## Drone Requirements
### basic requirements
* 2 screens
* Speakers
* 20 min flight time
* custom microcontroller pcb that controls the drones and screens
* 50 meter range from controller
### Sensors
* GPS
* IMU/rotation sensor
* Read voltage from battery know battery percentage
### Requirements when far ahead
* Docking station
* Automatic docking
* Automatic pathing
* Design own electronic speed controllers
## Images
![](../assets/result.jpg)
![](../assets/result2.jpg)
![](../assets/result1.jpg)
[last image credits](https://gareth-morrison.squarespace.com/drg)

View File

@@ -0,0 +1,51 @@
# Git setup
For me setting up git and ssh keys was really straight forward because I am currently studying IT.
## Generating ssh keys
To be able to push and pull from the git server you need to give your public key to the git server. First we need te generate a ssh key. That can be done using this command.
```bash
ssh-keygen
```
After you run this command it will prompt you for a passphrase and a location to store it you can leave these blank and press enter on them. It will automaticly store them in `<user>/.ssh`.
## Reading the ssh keys
To read the ssh keys from the file you can use the `cat` command. `cat` reads the contents of a file no matter what file type it is and prints it out console.
The command wil probably look like this.
```bash
cat .ssh/id_ed25519.pub
```
Once you run that it outputs a key. That key is your public ssh key. You can share it with everyone and put it on server as a way to authenticate.
## Registering your key on the gitlab server
Now you can register the key that got output in the console on the gitlab server. First click your profile picture in gitlab and then go to edit profile. Now you have a menu bar on the left, there you can click the SSH Keys tab and register your ssh key. After you have done that you can push and pull from your gitlab repository.
## Cloning the repository
To clone a git repository you need a link to the repository. When you press code on your project home you will see multiple links pop up. You will need the link that starts with `git@` and copy the entire link
Now you can go back to your console and type `git clone <link>` and then press enter. It will prompt you to trust the fingerprint of the server. When you've accepted that you have the repository on your local machine!🎉
## Git commands
When you're working on your project you need to make commits and push to the server so your work is also stored over there. There are a few commands you need to use for that.
| Git command | Description |
|-------------------------------- |------------------------------------------------------------ |
| git clone <link> | clones a remote repository from the server to your machine |
| git add <file> | stages a file to be committed |
| git commit -m "commit message" | commits all staged files with the commit message |
| git push | sends all the committed files to the remote server |
Git workflow:
```mermaid
graph LR
A[Work on your project] --> B[Stage your project files]
B --> C[Commit the files with a message]
C --> D[Push]
```
## Extra notes
Write clear commit messages because when you wanna return to a older version it's nice to know what changed since that commit.

View File

@@ -0,0 +1,59 @@
# Lesson notes
## 3D modelling
### tips
* sketch what you wanna make
* When drawing what is your organic shape gonna be (cube, cylinder)
* how big
* what parts are gonna be in your project
### good practices
* Work with real measurements (real units)
* Start with simple shapes
* Divide your model into sections (different components)
* Use groups and name your parts
* ctrl+s
* iterate and review
* document
### other things
* Try making something simple in 3 different cad programs.
* plan the final project in the first weeks
## Electricity
###
![alt text](../assets/electricityTriangle.png)
* V = Voltage
* I = Ampere
* R = Resistance
#### Videos and electronics (also applies to programming)
* Work along videos as you're watching them.
### AI notice for electronics
ask chat gpt to explain things as if you're 12 then 18 then as a electrical engineer.
tldr: ramp up how complicated the explanation is.
## Final project do's and dont's
### Do's
* 2D and 3D drawings
* Try hiding the electronic parts
* Document everything
* Inside the video: conception construction and operation.
* use purposeful holes.
* research design, shape, material and durability
* Make the project more personal
### Dont's
* lasercut press fit box
* loose wires
* no breadboard
* No glue gun
## Extra notes
* keep on practicing its a full time job
* don't strive for perfection
*

View File

@@ -0,0 +1,33 @@
# ImageMagick
## What is ImageMagick and why use it?
ImageMagick is a tool to resize, convert or compress images. You can do all sorts of things with it. But right now we will be using it to compress images. So other people don't have to download hunderds of megabytes when cloning your project or viewing your website.
## How do I install it?
ImageMagick can be installed on arch based systems using:
```bash
sudo pacman -Syu imagemagick
```
## How do I use it?
ImageMagick is a CLI tool so you need to use some kind of terminal. On arch based systems you can use it by typing `magick` after you've installed it.
A ImageMagick command is build up with a input and a output and in between all the parameters for the conversion. Example:
```bash
magick imageInput.jpg -strip -quality 80% imageOutput.jpg
```
## Image compression command examples
This image compresses the image and strips it of all it's details like date and location.
```bash
magick source.jpg -strip -interlace Plane -gaussian-blur 0.05 -quality 85% result.jpg
```
Same as above but resizes the image to 800 width and keeps the aspect ratio.
```bash
magick source.jpg -strip -interlace Plane -gaussian-blur 0.05 -quality 85% -resize 800x result.jpg
```
## Sources
* [installing ImageMagick](https://imagemagick.org/script/download.php)
* [command source](https://stackoverflow.com/questions/7261855/recommendation-for-compressing-jpg-files-with-imagemagick)
* [image resizing](https://legacy.imagemagick.org/Usage/resize/)

View File

@@ -0,0 +1,77 @@
# How to set up your own documentation page using mkdocs
## What is Mkdocs and why use it?
Mkdocs generates HTML from Markdown making an easy documentation page. So you don't have to struggle with html and css so you can focus on things more important.
## How to set it up
For this project im going to use Gitlab CI pipelines. CI stands for continuous intergration. That means that with every push you can make something do. For example clean up code or generate a documentation page based on what you've written in markdown.
### Step 1 choosing a theme
In [this](https://github.com/mkdocs/catalog) github repo there is a catalog of themes that you can choose. I went with the Ivory theme. (note this changed to material theme but the steps are still the same. [link](../week_1_fabacademy/customising_mkdocs.md))
### Step 2 preparing the envoirment
You wanna create a couple of files. These all need to be in the root of your project.
* `mkdocs.yml` The configuration file for mkdocs
* `requirements.txt` The list of dependencies for the python package manager to install
* `.gitlab-ci.yml` The script that builds and deploys you page
#### mkdocs.yml
Lets start with mkdocs.yml. In this file is described how to page should look and be named. This is the base of a mkdocs file:
```
site_name: My Docs by GitLab Pages
site_url: https://pages.gitlab.io/mkdocs
site_dir: public
theme: ivory
```
In here you can describe the site name and add the theme.
#### requirements.txt
requirements.txt tell the python package manager (pip) what dependencies you want installed. For this project we need mkdocs and the theme you want installed.
This is my requirements file
```requirements.txt
mkdocs>=1.5.3
mkdocs-ivory>=0.4.6
```
To find the version number of the theme you want you need to open the package website and there you can find what the latest version it's on. You don't have to add the version numbers but I do it because if the package mainter sends out a broken update the package still works.
#### gitlab-ci.yml
gitlab-ci.yml tells gitlab what to do when a commit is send out. For example this yml file builds a page and publishes it.
```yml
image: python:latest
before_script:
- time apt update
- time pip install -r requirements.txt
pages:
stage: deploy
script:
- time mkdocs build --site-dir public
artifacts:
paths:
- public
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
changes:
- "docs/**/*"
- "mkdocs.yml"
```
What does everything do?
| Variables | Description |
| ------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| image | Defines what OS should be used to for the scripts |
| before_script | Commands to run before you run the script or build something |
| pages | When this variable is mentioned gitlab knows it a pages job |
| stage | Defines what stage the build process is in. This can be used to run jobs in parallel. for example: all early stage jobs at the same time and all main stage jobs at the same time. |
| artifacts | Jobs can leave files. This tells them to save them |
| path | This tells which files or folders to store as the artifacts |
| rules | This tells when to run the pipline |
| if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH | If the branch commited to is set to the default branch in gitlab. Then run the pipline |
| changes | tell the pipline to only update when certain files or folders are changed |
## Sources
* https://gitlab.com/pages/mkdocs
* https://docs.gitlab.com/ee/ci/variables/index.html
* https://docs.gitlab.com/ee/user/project/pages/

View File

@@ -0,0 +1,44 @@
# SSH config files
## Why use ssh config files?
SSH config files are nice to have when you need to connect to multiple servers and don't wanna type the entire an entire serveradress and username. For example: instead of `ssh user@serveradress.co` you can type `ssh hostname` and that saves some brainpower for the rest of the fabacademy!
## What can you do with ssh config files
In SSH config files you can describe how connections should be handled and with which keys you want to use to log in onto a specific server and much more.
## How is a config file structured
```config
Host hostname1
SSH_OPTION value
SSH_OPTION value
Host hostname2
SSH_OPTION value
Host *
SSH_OPTION value
```
A entry always start with `Host` and then the name you wanna give to that host. After that you press enter and then tab. Now you can define the options for the ssh connections.
Example:
```config
HOST gitwaag
Hostname gitlab.waag.org
User git
IdentityFile ~/.ssh/id_ed25519
IdentitiesOnly yes
```
In this config I defined the host as gitwaag. So I can connect to it using the command ```ssh gitwaag``` instead of ```ssh gitlab.waag.org```.
#### Explanation of the parameters used in this config above
* `Hostname` Defines the hostname/domain of the server
* `User` The username you wanna log in as on the server
* `IdentityFile` Which public key you want to use for the connection
* `IdentitiesOnly` Set it to only use the IdentityFile instead of other authentication files.
For a full list of parameters you can visit https://phoenixnap.com/kb/ssh-config or run `man ssh_config` in the terminal.
## Sources:
* https://linuxize.com/post/using-the-ssh-config-file/
* https://phoenixnap.com/kb/ssh-config