Skip to content
Snippets Groups Projects
Commit 8d095d1e authored by m-guberina's avatar m-guberina
Browse files

initial commit

parents
No related branches found
No related tags found
No related merge requests found
README.md 0 → 100644
Intro to intro
--------------
These tutorials will cover some of the basics of the software stack
typically used in robotics engineering (Linux, Python), and my library for robot
control.
The intended audience are mechanical engineering students
at Lund university/LTH. This translates to assuming
experience in programming and to knowing bachelor level
engineering mathematics (calculus, linear algebra etc).
The primary purpose is to get students up to speed with the
software needed for student projects,
but they can be used for anyone who wants to get started with
the mentioned topics or see what they're about.
The videos are separated so feel free to skip
the parts you're familiar with. I do recommend watching
or at least skipping though all of them
to ensure you know the specifics.
The tutorials are meant to be bare-bones and used
just to get your feet wet.
The idea is to introduce the absolute minimum number of concepts,
and to empower you to learn the rest as you go.
In particular we will cover,
1. Linux Linux CLI basics
============================
1.1. why Linux - 1 video
- no other option
- open source
- is the best: fastest and most robust
- OS itself is customizable for a task
- can be server - example: ai training
- can be raspberry pi - example: chalmers car
1.2. Linux as a daily driver - 1 bonus video
- blazing fast: example - old hardware
- easily customizable: distributions
- pretty: r/unixporn, wal color changing
- tailor-made workflows (ex. no mouse like my setup)
- random cool stuff: kde connect
1.2. GNU/Linux system outline, terminology - 1 video
- users (root vs other)
- package manager
- absolute and relative paths
- everything is a (text) file
- terminal emulator
- shell
1.3. CLI most basic commands
- sudo
- apt - example update and install htop
- ls
- --help - example: use ls -l
- cd
- pwd
- grep
- empowerment points:
- example reading error messing (bad install)
- man
1.4. advanced basics: - 1 bonus video
- piping
- forming a script
- using git (cloning, add, commit, push, pull (example in docker)) - 1 bonus video
1.5. networking - 1 bonus video, needed for robot control
1.6. vim
- just do vimtutor and look at my keystrokes
- :help something is very well written and useful
- vim - editing at the speed of thought is book if you want to be an expert
2. Python
===========
2.1. basic facts - 1 video
- made for quickly writing short code and prototyping (fast for user)
- very slow (for the computer)
- strong dynamic typing
- no compilation
- executes one command at a time
- huge number of available packages
2.2. script vs shell + jupyter-notebooks
2.3. variables
2.4. types
2.5. built-in data structures:
- list (dynamic linked list)
- dictionary (key-value hashmap)
2.6. loops
- for
- iterators
- while loop
2.7. functions
- chunk of code to be reused
- input/output (API) NOT ENFORCED
- lists are ONLY PASSED BY REFERENCE
2.8. classes
- associations of data and functions
- have some predefined functions like __init__,
__hash__, __str__, __ge__,...
- only public atributes
2.9. many many more things
- list comperhensions (actually show)
- sockets
- multithreading (not real due to GIL) and multiprocessing (real)
- IPC
- decorators
2.10. numpy - 1 video
- wrappers around fast c code
- vectorization into real arrays
- arange
- linspace
- basic math
- matrix multiplication
- matrix inversion
- many many more
2.11. matplotlib
- plotting numpy arrays
- completely intuitive for basics, can get weird otherwise
2.12. openCV - 1 video just for this
- open up the laptop camera
- open up ip_webcam over LAN
- show some basic transformations like negative
- show classic object detection example in action
- show yolov4 in action
2.13. scipy - go over - 1 video, other libraries
- many many things
- linear algebra
- optimization
- regression
- ...
2.14. other noteworthy packages
- sympy
- scikit-learn for classic ML
- pytorch for neural networks
- pandas for tables (eats SQL, Excell, csv no problem)
- yolo-v8 - the end all be all of CNN based object detection
- control - classic control
3. ur_simple_control
======================
3.0. basic info - 1 video
- alternative to ros (less generalization, less code, more math)
- intended users are mechanics engineering students,
i.e. people strong in engineering math, but no necessarily software engineering
- exposes the math
- nearly exclusively based on reading the state and sending speed and torque commands
3.1. Docker - 1 video
- basically Linux virtual machines
- but can be combine with the host (internet access, memory,...) -> VERY fast
- images vs containers
3.2. ur_simple_control - 1 video
- pure python, will get rewritten to C++ with python bindings in the future
- atm only UR5e is supported, but other robots will be added
- every parameter is an argument
- RobotManager
- handles I/O with the robot for you
- manages pinocchio in step()
- just call step and use getters
- ControlLoopManager
- first show the math, explain partial, then go into ControlLoopManager
- does book-keeping around your control loop math
- ensures timing is right
- manages real time visualization and plotting
- handles killing of the program
- visualization
- meshcat server, handled by separate process
- real-time plotting
- matplotlib base, handled in separate process
- can plot whatever vectors you give it, just send an example in a dictionary
- logging
- select what you want to track by providing an example dictionary
- saves the entire run (dictionary of vectors) as a pickle,
along with the pickle of the arguments used
3.3. pinocchio - 1 video
- look at their documentation, do their tutorials if you want more
- data and model
- load robot as urdf
- lie algebra
- body vs space frames
- cheatsheet overview
- forwardKinematics
- just mention dynamics calls
3.4. clik math - 1 video
- write the equations down
3.5. clik in code
- just go over the code and explain it line by line
3.6. all examples run in the robotlab --> need help to film that
Intro to intro
--------------
These tutorials will cover some of the basics of the software stack
typically used in robotics engineering (Linux, Python), and my library for robot
control.
The intended audience are mechanical engineering students
at Lund university/LTH about to do robotics projects. This translates to assuming
experience in programming and to knowing bachelor level
engineering mathematics (calculus, linear algebra etc).
The primary purpose is to get students up to speed with the
software needed for student projects,
but they can be used for anyone who wants to get started with
the mentioned topics or see what they're about.
The videos are separated so feel free to skip
the parts you're familiar with. I do recommend watching
or at least skipping though all of them
to ensure you know the specifics.
While I did try to make them separable,
some topics are introduced on the go and might
not follow the outlined order.
The tutorials are meant to be bare-bones and used
just to get your feet wet.
The idea is to introduce the absolute minimum number of concepts,
and to empower you to learn the rest as you go.
Before introducing each topic, I will also briefly
summarize why a particular piece software has been selected.
In particular we will cover:
1. Linux, Linux CLI basics
==============================
1.1. why Linux - 1 video
1.2. Linux as a daily driver - bonus video
1.2. GNU/Linux system outline, terminology - 1 video
1.3. CLI most basic commands
1.4. advanced basics: - 1 bonus video
- piping
- forming a script
- using git (cloning, add, commit, push, pull (example in docker)) - 1 bonus video
- networking - needed for robot control
- vim the text editor
2. Python
===========
2.1. basic syntax and usage
2.2. common packages
2.10. numpy
2.11. matplotlib
2.12. scipy
3. ur_simple_control
======================
3.0. basic info - 1 video
3.1. Docker - 1 video
3.2. ur_simple_control - 1 video
3.3. pinocchio - 1 video
3.4. inverse kinematics theory and implementation - 1 video
# why linux for (robotics) engineering?
----------------------------------------
0. there are no other options (same for ai)
1. open-source
- knowledge -> guarantees
2. it is the best: fastest and most robust
3. customizable in size and functionality, examples:
- web server
- cloud
- literally every supercomputer runs Linux
- raspberry pi on robot - example: chalmers car
--> it's your host computer that's the exception,
this simplifies life drastically
--> it's the same system, learn it once know it for all cases
4. best CLI
# why CLI?
----------
0. no GUI on server or raspberry pi --> example: ssh into something
1. gives errors
2. everything is text, you're closer to the truth
3. you can program the computer itself
4. the only path to a script is writting the commands into a file
# why linux as a daily driver?
------------------------------
0. there are only two reasons why you don't have it
0.1. some apps and games aren't ported
0.2. it's not preinstalled when you buy a computer
0.3. you can dual-boot and have the other os too
1. it just works
1.1. you decide when to update
1.2. works better and faster than competition - fast even on old hardware
1.3. even if you blow it up, you can reinstall everything in an hour
1.4. every problem is fixable
2. you control it
2.1. don't like something - remove it, replace it
2.2. want something - install it, it's free
2.3. no viruses if you don't install them
3. infinite customizability
3.1. it can look like anything
3.2. your workflow can be whatever you want,
you don't even know what's possible yet
4. everything is a text file
5. any sequence of commands can be put into a script,
and that can be put on a keybinding or a cron command
1.3. CLI most basic commands
- sudo
- apt - example update and install htop
- ls
- --help - example: use ls -l
- cd
- pwd
- grep
- empowerment points:
- example reading error messing (bad install)
- man
2.10. numpy - 1 video - do everything in the shell
- wrappers around fast c code
- vectorization into real arrays
- arange
- linspace
- basic math (addition, powers, exponentials)
- matrix multiplication
- matrix inversion
- many many more
2.11. matplotlib - plot a sin wave
- plotting numpy arrays
- completely intuitive for basics, can get weird otherwise
- show matplotlib gallery
- show chalmers SCS labs
- show manipulability_visualizer
- show AR car
2.12. openCV - 1 video just for this
- open up the laptop camera
- open up ip_webcam over LAN
- show some basic transformations like negative
- show classic object detection example in action
- show yolov4 in action HUMRO project, mention openpose
2.13. scipy - go over - 1 video and other libraries
- linear algebra
- optimization
- regression
- ...
- show chalmers nonlin lab optimization example (just code and plot is ok)
- show a more detailed IK example (math first, then code, but very quickly)
2.14. other noteworthy packages - just show websites
- tkinter - mention its shown use in manipulator_visualizer and hand detection
- sympy - example: calculate hessian: /home/gospodar/chalmers/NONLIN/lab/simpy_lab1.py
- scikit-learn for classic ML
- pytorch for neural networks
- pandas for tables (eats SQL, Excell, csv no problem)
- yolo-v8 - the end all be all of CNN based object detection
- control - classic control
## python general
Easiest possible language to use. Trades off
execution speed for ease of use.
Indentation has programatic meaning.
Learning more syntax sugar leads to much
more readable code.
### basic facts:
- made for quickly writing short code and prototyping (fast for user)
- very slow (for the computer)
- strong dynamic typing
- no compilation
- executes one command at a time
- huge number of available packages
### script vs shell + jupyter-notebooks
- ipython is great quickly verifying things like types or math
- a script is just a full program
- notebooks are in-between the two and some people really like them
--> show a jrnh tutorial
### variables
Any variable in Python can store any type.
The comperhensive list of types can be found at [link_to_structs_in_standard_lib]
Here is a very short list of basic facts:
- all variables are variable/dynamic
- **NOTE: a variable ONLY POINTS TO A LIST, and assigning it to a different variable
DOES NOT COPY THE LIST by default **
### data structures
There are a number of built-in data structures in Python.
The comperhensive list of built-in data structures can be found at [link_to_structs_in_standard_lib]
#### lists
- look like [item_1, item_2,...]
- all lists are mutable (changeable)
- you can put anything in a list, i.e. item_n can be of any type
in any list (including other lists)
#### dictionaries
- look like {key_1 : value_1, key_2: value_2, ...}
- all dictionaries are mutable (changeable)
- you can put anything in a dictionary
### loops
Repeat a block of code. They can be prematurely
stopped with break .
A chunk of code can be skipped with continue .
#### for loop
goes over an iterator. That could be
a sequence of numbers like range(n),
but also elements of list or dictionary etc.
continue and break to control the loop.
**example**: range, iterating over list, iterating over dictionary
#### while loop
runs as long as the logical requirement is met
```python
while test_true:
[code]
```
**example**: optimization until convergence (just minus something iteratively for show)
### functions
A function is a chunk of code to be easily accessed in multiple different places.
To be used somewhere else, its inputs and the outputs need to be matched
by the calling code.
**NOTE: function I/O types are not strictly enforced in Python. BE CAREFUL because
if you don't put in what you think you're putting in,
the code will run and you will get VERY WEIRD ERRORS.**
```python
def something(arguments):
[code]
return [any_variable]
```
example: write a theta to SO2 function
### classes
Classes are collections of variables and functions
that help us organize our code.
**example**: /home/gospodar/lund/praxis/software/double_pendulum/src/python/double_pendulum/model
double pendulum and related functions
- have some predefined functions like __init__,
__hash__, __str__, __ge__,...
- inheritance exists
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment