Merge branch 'main' of ssh://gitlab.fdmci.hva.nl/propedeuse-hbo-ict/onderwijs/2023-2024/out-a-se-ti/blok-4/muupooviixee66 into 54-als-gebruiker-wil-ik-een-scherm-waar-ik-mijn-score-kan-zien-na-de-oefeningen-zodat-ik-een
This commit is contained in:
109
docs/documentation/android/javaClasses.md
Normal file
109
docs/documentation/android/javaClasses.md
Normal file
@@ -0,0 +1,109 @@
|
||||
# Java class modifiers
|
||||
|
||||
## How are classes build in java?
|
||||
There are a lot of classes with a lot of parameters
|
||||
|
||||
A class always begins with either the public or default or abstract access modifier. Then comes the class name
|
||||
|
||||
Example:
|
||||
```java
|
||||
public class MyClass {
|
||||
//methods and atributes
|
||||
}
|
||||
|
||||
```
|
||||
Then in a class you can have Methods or Atributes where the actual code is.
|
||||
|
||||
```mermaid
|
||||
flowchart
|
||||
a[Access Modifiers] --> b[class] --> c[Class name]
|
||||
```
|
||||
|
||||
## Constructor
|
||||
A constructor in Java is a special method that is used to initialize objects. The constructor is called when an object of a class is created. It can be used to set initial values for object attributes.
|
||||
|
||||
The constructor Method is the first method that is called when a class is created. It has the same name as the class and no return type. It is automaticly called when a class is created.
|
||||
|
||||
### Methods
|
||||
A method is a block of code which only runs when it is called. You can pass data, known as parameters, into a method. Methods are used to perform certain actions, and they are also known as functions.
|
||||
|
||||
Methods are build like this
|
||||
```mermaid
|
||||
flowchart
|
||||
A[Access Modifiers] --> B[Method Modifier] --> C[Return Type] --> D[Method Name] --> E[Parameters] --> F[Method Body]
|
||||
```
|
||||
|
||||
|
||||
Example:
|
||||
```java
|
||||
public class MyClass {
|
||||
// Method
|
||||
static void myMethod() {
|
||||
// print Hello World!
|
||||
System.out.println("Hello World!");
|
||||
}
|
||||
// Main method
|
||||
//access modifier, Method Modifier, return type, method name, parameters, method body
|
||||
public static void main(String[] args) {
|
||||
// Call the method
|
||||
myMethod();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### Atributes
|
||||
Attributes are variables within a class. When an object is created from a class, the object will have these attributes.
|
||||
|
||||
Example:
|
||||
```java
|
||||
public class MyClass {
|
||||
int x = 5;
|
||||
}
|
||||
```
|
||||
|
||||
## Classes
|
||||
### Class modifiers
|
||||
|
||||
#### Non-access modifiers
|
||||
| Modifier | Description | | | |
|
||||
|---|---|---|---|---|
|
||||
| final | The class cannot be inherited by other classes (You will learn more about inheritance in the Inheritance chapter) | | | |
|
||||
| abstract | The class cannot be used to create objects (To access an abstract class, it must be inherited from another class. You will learn more about inheritance and abstraction in the Inheritance and Abstraction chapters) | | | |
|
||||
||||
|
||||
|
||||
#### Access modifiers
|
||||
| Modifier | Description | | | |
|
||||
|---|---|---|---|---|
|
||||
| public | The code is accessible for all classes | | | |
|
||||
| private | The code is only accessible within the declared class | | | |
|
||||
| default | The code is only accessible in the same package. This is used when you don't specify a modifier. You will learn more about packages in the Packages chapter | | | |
|
||||
| protected | The code is accessible in the same package and subclasses. You will learn more about subclasses and superclasses in the Inheritance chapter | | | |
|
||||
| | | | | |
|
||||
|
||||
|
||||
## Methods and attributes
|
||||
#### non access modifiers
|
||||
| Modifier | Description | | | |
|
||||
|---|---|---|---|---|
|
||||
| final | Attributes and methods cannot be overridden/modified | | | |
|
||||
| static | Attributes and methods belongs to the class, rather than an object. You don't really wanna use this one. | | | |
|
||||
| abstract | Can only be used in an abstract class, and can only be used on methods. The method does not have a body, for example abstract void run();. The body is provided by the subclass (inherited from). You will learn more about inheritance and abstraction in the Inheritance and Abstraction chapters | | | |
|
||||
| transient | Attributes and methods are skipped when serializing the object containing them | | | |
|
||||
| synchronized | Methods can only be accessed by one thread at a time | | | |
|
||||
| volatile | The value of an attribute is not cached thread-locally, and is always read from the "main memory" | | | |
|
||||
||||
|
||||
|
||||
#### Access modifiers
|
||||
| Modifier | Description | | | |
|
||||
|---|---|---|---|---|
|
||||
| public | The code is accessible for all classes | | | |
|
||||
| private | The code is only accessible within the declared class | | | |
|
||||
| default | The code is only accessible in the same package. This is used when you don't specify a modifier. You will learn more about packages in the Packages chapter | | | |
|
||||
| protected | The code is accessible in the same package and subclasses. You will learn more about subclasses and superclasses in the Inheritance chapter | | | |
|
||||
| | | | | |
|
||||
|
||||
|
||||
## Sources
|
||||
|
||||
* https://www.w3schools.com/java/java_modifiers.asp
|
Binary file not shown.
After Width: | Height: | Size: 3.5 KiB |
BIN
docs/documentation/assets/motion-path-example-path-error.png
Normal file
BIN
docs/documentation/assets/motion-path-example-path-error.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.7 KiB |
BIN
docs/documentation/assets/motion-path-example-vertices.png
Normal file
BIN
docs/documentation/assets/motion-path-example-vertices.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 863 B |
File diff suppressed because one or more lines are too long
Binary file not shown.
Before Width: | Height: | Size: 114 KiB After Width: | Height: | Size: 114 KiB |
@@ -0,0 +1,50 @@
|
||||
## Analysis for Motion Tracking System on the Pepper Robot.
|
||||
|
||||
---
|
||||
|
||||
For our project, we want our users to be able to see the movement they're making, so they can
|
||||
see whether they're executing the fitness task correctly. For a tracking system as such, we'll need to use quite
|
||||
some mathematics.
|
||||
|
||||
Our current approach is defining the required path by a set of vertices; points in 3d space.
|
||||
These points define along which path the user has to move their limbs to, depending on what the activity is
|
||||
and where they've placed the tracking devices.
|
||||
|
||||
A path can look like the following
|
||||
|
||||
<img height="128" src="../assets/motion-path-example-vertices.png" width="128" alt="Path Point Example"/>
|
||||
|
||||
To be able to measure the position of our tracking device, we'll have to use sensors that allow us
|
||||
to retrieve useful information that can provide us with either position or velocity. The device will have
|
||||
to be calibrated initially, of course, due to position being relative.
|
||||
|
||||
To acquire our measurements, we've chosen for the following configuration for the tracking device:
|
||||
|
||||
- ESP8266 (Wi-Fi only)
|
||||
- Accelerometer / Gyroscope combination (BNO085)
|
||||
|
||||
We've chosen for this configuration due to the fact that it delivers all of our needs, with the smallest form factor,
|
||||
whilst also delivering quality measurements.
|
||||
This sadly does come at the cost that the ESP8266 does not have a dedicated Bluetooth chip, therefore making
|
||||
connectivity to our robot a little more complicated.
|
||||
|
||||
The calculations behind the tracking system will be done in the following steps:
|
||||
|
||||
1. Acquire calibration point (zero point)
|
||||
2. Convert relative acceleration and rotation to position, relative to the calibration point
|
||||
3. Generate a path object that can be compared to the correct one
|
||||
4. Calculate the difference of the path at every measurement sample
|
||||
|
||||
At first, to get the calibration point, the user will have to stand still for a moment without moving.
|
||||
This can be sensed by the device, which will then be sent to the Pepper robot.
|
||||
We've decided to send this data using Wi-Fi using a HTTP WebSocket connection, due to the fact that our
|
||||
ESP8266 does not have a Bluetooth chip present, and due to the fact that a WebSocket connection allows us
|
||||
for a both fast and secure data transfer.
|
||||
|
||||
Second, to convert our relative acceleration rotation to a useful position, we'll have to first convert the
|
||||
acceleration vector `A(x, y, z)` and rotation vector `R(x, y, z)` to an acceleration vector that is
|
||||
perpendicular to the normal vector of the earth. This is because the acceleration vector of the device
|
||||
is relative to its own axes, and not to the earth's normal vector.
|
||||
To convert this, we'll have to multiply the acceleration vector `A(x, y, z)` by the rotation matrix
|
||||
with negative angles, to rotate it back to be perpendicular with the normal of the earth.
|
||||
After this transformation
|
@@ -0,0 +1,89 @@
|
||||
# Position Tracking with Embedded Systems
|
||||
|
||||
## Introduction
|
||||
|
||||
For this project we want to design an embedded system that can track a users position. We want to track their current position on the ground and see how they are shifting their weight. This system will be used to track their position to determine if a user is doing the exercises correctly.
|
||||
|
||||
## Objectives
|
||||
|
||||
- Design an embedded system that can track user position.
|
||||
- Develop an algorithm to process the data from the Wii Fit Board and determine the user's position.
|
||||
|
||||
## Research and Analysis
|
||||
|
||||
### Choosing the Wii Fit Board
|
||||
|
||||
For this project we have chosen the Wii Fit Board as our primary sensor. The Wii Fit Board is a balance board that can measure a user's weight and center of balance. It is a low-cost sensor that is easy to interface with a microcontroller. The Wii Fit Board communicates over Bluetooth, which makes it easy to connect to a microcontroller with Bluetooth capabilities.
|
||||
|
||||
### Alternative Solutions
|
||||
|
||||
There are other sensors that can be used for position tracking, such as pressure sensors or accelerometers. However, these sensors are more expensive and may require additional processing to determine the user's position. The Wii Fit Board provides a simple and cost-effective solution for position tracking.
|
||||
|
||||
Example of other sensors that can be used for position tracking:
|
||||
|
||||
Pressure sensors:
|
||||
- Description: Pressure sensors can be used to measure the force applied by the user on the ground. By measuring the pressure distribution, the user's position can be determined.
|
||||
- Pros: High accuracy, can measure force applied by the user.
|
||||
- Cons: Expensive, will require additional hardware for data transfer.
|
||||
- Cost: ~ 33 euros (https://www.antratek.nl/flexiforce-a401-sensor-25lbs?gad_source=1&gclid=CjwKCAjwupGyBhBBEiwA0UcqaMMrIXGafsF2oE-15JaTPT5tDhfCyDHz2D2gSghyPvg11okv_QIFThoCw5oQAvD_BwE)
|
||||
|
||||
Accelerometers:
|
||||
- Description: Accelerometers can be used to measure the user's acceleration and orientation. By integrating the acceleration data, the user's position can be determined.
|
||||
- Pros: Can measure acceleration and orientation, cheap.
|
||||
- Cons: Will require additional hardware for data transfer.
|
||||
- Cost: ~ 5 euros (https://www.amazon.nl/versnellingsmeter-gyroscoop-versnellingssensor-converter-gegevensuitgang/dp/B07BVXN2GP/ref=asc_df_B07BVXN2GP/?tag=nlshogostdde-21&linkCode=df0&hvadid=430548884871&hvpos=&hvnetw=g&hvrand=5187253011954678898&hvpone=&hvptwo=&hvqmt=&hvdev=c&hvdvcmdl=&hvlocint=&hvlocphy=1010543&hvtargid=pla-928293154057&psc=1&mcid=43bf111afa7b3ba593f4a49321683352)
|
||||
|
||||
### System Requirements
|
||||
|
||||
To be added
|
||||
|
||||
## System Design
|
||||
|
||||
### Hardware
|
||||
|
||||
The hardware of the system will consist of the following components:
|
||||
- Wii Fit Board: The primary sensor for position tracking.
|
||||
- Pepper: The controller that will process the data from the Wii Fit Board.
|
||||
|
||||
### Software
|
||||
|
||||
The software of the system will consist of the following:
|
||||
- Wiiboard-simple: A library that will be used to transfer data from the Wii Fit Board to pepper.
|
||||
- Position Tracking Algorithm: An algorithm that will process the sensor data and determine the user's position.
|
||||
|
||||
### Integration
|
||||
|
||||
The Wii Fit Board will be connected to Pepper using the Wiiboard-simple library. The library will be used to read the sensor data from the Wii Fit Board and transfer it to Pepper. The position tracking algorithm will process the sensor data and determine the user's position.
|
||||
|
||||
Challenge:
|
||||
- Connecting to the wii fit board. It is not possible to connect directly to the Wii Fit Board, it is necessary to use a library that can interpret the data sent by the Wii Fit Board.
|
||||
- The Wii Fit Balance Board sends data in a specific format. To interpret this data, it's necessary to understand the format and how to convert it to a usable format.
|
||||
- The Wii Fit Balance Board uses Bluetooth 2.0 to communicate. Pepper uses Bluetooth 4.0 this means that there might be compatibility issues/latancy issues.
|
||||
|
||||
## Implementation
|
||||
|
||||
### Prototyping
|
||||
|
||||
To start the implementation of the system, we will create a prototype that will read the sensor data from the Wii Fit Board and send it to your computer. Once we have the data, we will develop the position tracking algorithm to determine the user's position. After that, the algorithm will be integrated with pepper.
|
||||
|
||||
### Testing and Validation
|
||||
|
||||
Tests:
|
||||
- Test the prototype to ensure that it can read the sensor data from the Wii Fit Board.
|
||||
- Test the position tracking algorithm to ensure that it can determine the user's position accurately.
|
||||
- Test the integrated system to ensure that it can track the user's position in real-time.
|
||||
|
||||
## Conclusion
|
||||
|
||||
To be added
|
||||
|
||||
## References
|
||||
|
||||
[Wiiboard lib](https://code.google.com/archive/p/wiiboard-simple/wikis/Documentation.wiki)
|
||||
https://advanti-lab.sb.dfki.de/?page_id=64
|
||||
https://github.com/paulburton/fitscales
|
||||
https://github.com/micromu/WiiRemoteJ
|
||||
|
||||
## Appendices
|
||||
|
||||
To be added
|
Reference in New Issue
Block a user