Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
DeDiamondPro committed Mar 15, 2024
1 parent 4dba678 commit de9f0d8
Show file tree
Hide file tree
Showing 18 changed files with 99 additions and 48 deletions.
19 changes: 14 additions & 5 deletions documentation/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,19 @@
[AQLARP](title-page.md)
# Introduction
- [Design Principles](ch01-01-design-principles.md)
- [Coordinate System](ch02-01-coordinate-system.md)
# Building
- [Materials](ch02-01-required-materials.md)
# Documentation
- [Required Materials](ch03-01-required-materials.md)
- [Building](ch04-00-building.md)
- [Building The Legs](ch04-01-building-leg.md)
- [Building The Main Body](ch04-02-building-body.md)
- [Wiring](ch04-03-wiring.md)
- [Installing Software](ch05-01-installing-software.md)
# API
- [ROS2 topics](ch06-01-ros2-topics.md)
- [Code Structure](ch07-01-code-structure.md)
# Concepts explained

- [Inverse Kinematics](ch04-00-inverse-kinematics.md)
- [Inverse Kinematics Of The Legs](ch04-01-inverse-kinematics-legs.md)
- [Inverse Kinematics Of The Body](ch04-02-inverse-kinematics-body.md)
- [Inverse Kinematics](ch08-00-inverse-kinematics.md)
- [Inverse Kinematics Of The Legs](ch08-01-inverse-kinematics-legs.md)
- [Inverse Kinematics Of The Body](ch08-02-inverse-kinematics-body.md)
1 change: 1 addition & 0 deletions documentation/src/ch-01-02-coordinate-system
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#
17 changes: 17 additions & 0 deletions documentation/src/ch02-01-coordinate-system.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Defining AQLARP's coordinate system
Knowing AQLARP's coordinate system is import so you know what setting each axis will do.
Here are the definitions for it:
- X-axis:
- Increasing the value will make AQLARP move to the front
- Decreasing the value will make AQLARP move to the back
- Y-axis:
- Increasing the value will make AQLARP go up
- Decreasing the value will make AQLARP go down
- Z-axis:
- Increasing the value will make AQLARP go to the right
- Decreasing the value will make AQLARP go to the left

The origin of these axis is where the leg is connected to the top joint, this is a per leg coordinate system.

Below are some images to clarify what axis does what.
![](img/Coordinate-System-XY.png)![](img/Coordinate-System-XZ.png)
Empty file.
Empty file.
Empty file.
37 changes: 0 additions & 37 deletions documentation/src/ch04-02-inverse-kinematics-body.md

This file was deleted.

Empty file.
Empty file.
Empty file.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Then finally we can combine them by adding them together.
$$A = A_{x} + A_{y}$$
$$B = B_{y}$$
$$C = C_{y} + C_{z}$$
## In code
## Code
After transforming all these calculations into code, we get this:
```py
def calc_angles(leg, x, y, z):
Expand Down
63 changes: 63 additions & 0 deletions documentation/src/ch08-02-inverse-kinematics-body.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Inverse kinematic of the body
The inverse kinematics of the body is to transform pitch, roll and rotation into offsets for the x, y and z coordinate of a leg.
## Definitions
\\(l\\) length of the body

\\(w\\) width of the body

\\(pitch\\) desired pitch

\\(roll\\) desired roll

\\(rotation\\) desired rotation

\\(rotation\\) desired rotation

\\(m_{x}\\) leg movement x

\\(m_{y}\\) leg movement y

\\(m_{z}\\) leg movement z

\\(x\\) x position of a leg relative to the center

\\(z\\) z position of a leg relative to the center
## Pitch
The calculations for pitch are as follows:
$$m_{x} = \frac{l(1-\cos(pitch))}{2}$$
$$m_{y} = \frac{l\sin(pitch)}{2}$$
## Roll
The calculations for roll are as follows:
$$m_{z} = \frac{w(1-\cos(roll))}{2}$$
$$m_{y} = \frac{w\sin(roll)}{2}$$
## Rotation
The calculations for rotation are based on a [rotation matrix](https://en.wikipedia.org/wiki/Rotation_matrix). These calculations are as follows:

$$m_{x} = (x \times \cos(rotation) - z \times \sin(rotation)) - x$$
$$m_{z} = (x \times \sin(rotation) + z \times \cos(rotation)) - z$$
## Combining Calculations
To combine these calculations you just calculate each one separately and then calculate the sum of all x calculations, then the sum of all y calculations and finally the sum of all z calculations.
## Code
After transforming these calculations into code, we get this:
```py
def calc_leg_offsets(leg, pitch, roll, rotation):
# Get the X and Z coordinate of the leg
x = (body_length / 2) if leg < 2 else -(body_length / 2)
z = -(body_width / 2) if leg == 0 or leg == 3 else (body_width / 2)
# Calculate the height difference of the leg to reach the target pitch
height_diff_pitch = x * sin(radians(pitch))
# Calculate the height difference of the leg to reach the target roll
height_diff_roll = z * sin(radians(roll))
# Calculate the X and Z offsets to keep the body centered
movement_x_pitch = x * (1 - cos(radians(pitch)))
movement_z_roll = z * (1 - cos(radians(roll)))
# Calculate the rotation offsets
movement_x_rotation = (x * cos(radians(rotation)) - z * sin(radians(rotation))) - x
movement_z_rotation = (x * sin(radians(rotation)) + z * cos(radians(rotation))) - z
# Merge the offsets and return them
return (
movement_x_pitch + movement_x_rotation,
height_diff_pitch - height_diff_roll,
movement_z_roll + movement_z_rotation
)
```
Binary file added documentation/src/img/Coordinate-System-XY.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added documentation/src/img/Coordinate-System-XZ.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 3 additions & 5 deletions documentation/src/title-page.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ AQLARP stands for **A**ffordable **Q**uadruped **L**earning **A**nd **R**esearch

AQLARP is licensed under the [MIT license](https://github.com/DeDiamondPro/AQLARP/blob/master/LICENSE).

<div class = "warning">
This documentation is incomplete

It is advisable to have a basic understanding of the parts of the robot to effectively address encountered issues. If you need help, feel free to open an issue on [AQLARP's GitHub](https://github.com/DeDiamondPro/AQLARP). However no guarantees can be provided that I will be able to help you.
</div>
> **🚨 This documentation is incomplete**
>
> It is advisable to have a basic understanding of the parts of the robot to effectively address encountered issues. If you need help, feel free to open an issue on [AQLARP's GitHub](https://github.com/DeDiamondPro/AQLARP). However there is no gaurantee that I will be able to help you.

0 comments on commit de9f0d8

Please sign in to comment.