Added documentation (robot_motion_tracking_system.md and MotionProcessor.md)

This commit is contained in:
Luca Warmenhoven
2024-05-10 12:21:34 +02:00
parent b2d145f030
commit f74faa9d42
2 changed files with 173 additions and 0 deletions

View File

@@ -0,0 +1,65 @@
## Class Implementation - MotionProcessor
---
#### Methods
Creates a WebSocket server and starts listening for incoming MotionData messages
```java
public void startListening() { ... }
```
Stops the WebSocket server and stops listening for incoming MotionData messages
```java
public void stopListening() { ... }
```
Parses an incoming WebSocket message packet and processes the data.
The data that is accepted is a string that can be of the following formats:
- "data `Ax`;`Ay`;`Az`;`Rx`;`Ry`;`Rz`"
- "sampleRate `x`"
- "calibrate `x`;`y`;`z`"
```java
public void parsePacket(@NotNull String message) { ... }
```
Processes the provided MotionData object, uses it as a relative path point, and calls the
motionDataEventHandler with the calculated vector.
```java
public void addMotionData(MotionData data) { ... }
```
Updates the relative path to the provided path.
```java
public void setRelativePath(List<Vector3> relativePath) { ... }
```
Sets the motionDataEventHandler to the provided handler.
```java
public void setMotionDataEventHandler(Consumer<Vector3> consumer) { ... }
```
Calculate the relative vector given a MotionData object.
This converts relative acceleration and rotation to a vector, taking the
sample rate into account.
```java
public Vector3 getRelativeVector(MotionData motionData) { ... }
```
Get a list of error values given the provided GesturePath.
This compares the relative path (calibrated) to the provided path segments,
and returns the offsets.
```java
public List<Double> getErrors(GesturePath referencePath) { ... }
```
Get the error offset of the provided vector to the provided path.
This compares a given vector to the provided GesturePath object.
```java
public double getError(GesturePath path, Vector3 referencePoint) { ... }
```
Get the average error offset of the relative path and the provided GesturePath object.
```java
public double getAverageError(GesturePath referencePath) { ... }
```