From 3094accf21641c31c7e5effd596a4702532d11a9 Mon Sep 17 00:00:00 2001 From: jkerpe Date: Fri, 17 Nov 2023 14:00:10 +0100 Subject: [PATCH] Updated Documentation --- doc/architecture/SENSORFUSION.md | 14 ++-- .../uml/LogicalView/SensorFusion/HAL_IMU.puml | 74 +++++++------------ .../SensorFusion/HAL_SensorFusion.puml | 41 ++-------- 3 files changed, 42 insertions(+), 87 deletions(-) diff --git a/doc/architecture/SENSORFUSION.md b/doc/architecture/SENSORFUSION.md index a9a3d0e5..0da4ff13 100644 --- a/doc/architecture/SENSORFUSION.md +++ b/doc/architecture/SENSORFUSION.md @@ -27,11 +27,11 @@ This channel is used to send raw sensor data used for Sensor Fusion on the ZumoC * The datatypes can be found in SerialMuxChannel.h. * Order: - * Acceleration in X (raw sensor value) - * Acceleration in Y (raw sensor value) - * turnRateZ around Z (raw sensor value) - * Magnetometer value in X (raw sensor value) - * Magnetometer value in Y (raw sensor value) + * Acceleration in X (raw sensor value in digits) + * Acceleration in Y (raw sensor value in digits) + * turnRateZ around Z (raw sensor value in digits) + * Magnetometer value in X (raw sensor value in digits) + * Magnetometer value in Y (raw sensor value in digits) * Angle calculated by Odometry (in mrad) * Position in X calculated by Odometry (in mm) * Position in Y calculated by Odometry (in mm) @@ -47,11 +47,11 @@ The application uses the same [State Machine](https://github.com/BlueAndi/RadonU ### HAL Some changes have been made to the HAL. -![HALSensorFusion](http://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/BlueAndi/RadonUlzer/SensorFusion/doc/architecture/uml/LogicalView/SensorFusion/HAL_SensorFusion.puml) +![HALSensorFusion](http://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/BlueAndi/RadonUlzer/SensorFusion/sync/doc/architecture/uml/LogicalView/SensorFusion/HAL_SensorFusion.puml) ButtonB, ButtonC, the ProximitySensor and the Buzzer have been removed. An IMU has been added: -![HALIMU](http://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/BlueAndi/RadonUlzer/SensorFusion/doc/architecture/uml/LogicalView/SensorFusion/HAL_IMU.puml) +![HALIMU](http://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/BlueAndi/RadonUlzer/SensorFusion/sync/doc/architecture/uml/LogicalView/SensorFusion/HAL_IMU.puml) # Abbreviations diff --git a/doc/architecture/uml/LogicalView/SensorFusion/HAL_IMU.puml b/doc/architecture/uml/LogicalView/SensorFusion/HAL_IMU.puml index 2a1e5d50..f1163ca6 100644 --- a/doc/architecture/uml/LogicalView/SensorFusion/HAL_IMU.puml +++ b/doc/architecture/uml/LogicalView/SensorFusion/HAL_IMU.puml @@ -1,44 +1,35 @@ -@startuml HAL IMU +@startuml -title Hardware Abstraction Layer - IMU +title RadonUlzer - Hardware Abstraction Layer package "HAL" as hal { package "HAL Interfaces" as halInterfaces { - interface "IBoard" as iBoard { - + {abstract} getIMU() : IIMU& - + init() : void - } interface "IIMU" as iIMU { + {abstract} init() : bool - + {abstract} readAcc() : void + + {abstract} readAccelerometer() : void + {abstract} readGyro() : void - + {abstract} readMag() : void - + {abstract} accDataReady() : bool + + {abstract} readMagnetometer() : void + + {abstract} accelerometerDataReady() : bool + {abstract} gyroDataReady() : bool - + {abstract} magDataReady() : bool - + {abstract} getAccelerationValues(int16_t* accelerationValues) : void - + {abstract} getTurnRates(int16_t* turnRates) : void - + {abstract} getMagnetometerValues(int16_t* magnetometerValues) : void + + {abstract} magnetometerDataReady() : bool + + {abstract} getAccelerationValues(IMUData* accelerationValues) : void + + {abstract} getTurnRates(IMUData* turnRates) : void + + {abstract} getMagnetometerValues(IMUData* magnetometerValues) : void } + struct IMUData { + + valueX: int16_t + + valueY: int16_t + + valueZ: int16_t + } } package "HAL Simulation" as simulation { class "IMU" as ImuSim { - - m_accelerationValues[3] : int16_t - - m_gyroValues[3] : int16_t - - m_magnetometerValues[3] : int16_t - + init() : bool - + readAcc() : void - + readGyro() : void - + readMag() : void - + accDataReady() : bool - + gyroDataReady() : bool - + magDataReady() : bool - + getAccelerationValues(int16_t* accelerationValues) : void - + getTurnRates(int16_t* turnRates) : void - + getMagnetometerValues(int16_t* magnetometerValues) : void + - m_accelerationValues : IMUData + - m_gyroValues : IMUData + - m_magnetometerValues : IMUData } class "Board" as BoardSim { - m_imu : IMU @@ -49,19 +40,9 @@ package "HAL" as hal { package "HAL Target" as target { class "IMU" as ImuTarget { - - m_accelerationValues[3] : vector - - m_gyroValues[3] : vector - - m_magnetometerValues[3] : vector - + init() : bool - + readAcc() : void - + readGyro() : void - + readMag() : void - + accDataReady() : bool - + gyroDataReady() : bool - + magDataReady() : bool - + getAccelerationValues(int16_t* accelerationValues) : void - + getTurnRates(int16_t* turnRates) : void - + getMagnetometerValues(int16_t* magnetometerValues) : void + - m_accelerationValues : IMUData + - m_gyroValues : IMUData + - m_magnetometerValues : IMUData } class "Board" as BoardTarget{ - m_imu : IMU @@ -69,15 +50,14 @@ package "HAL" as hal { + init() : void } } - } + + iIMU ..> IMUData: <> iIMU <|... ImuSim: <> - iBoard <|... BoardSim: <> - iBoard *-- iIMU + ImuTarget *- BoardTarget + ImuSim *- BoardSim iIMU <|... ImuTarget: <> - iBoard <|... BoardTarget: <> - - +} package "Webots library" as webotsLib { class Accelerometer { + getValues() : double * @@ -125,13 +105,13 @@ ImuSim *--> Accelerometer ImuSim *--> Gyro ImuSim *--> Compass -note left of iIMU +note right of iIMU IMU stands for Inertial Measurement Unit. end note note left of hal This diagram shows the added IMU component. - Classes like the LineSensors or Motors + Classes like the LineSensors or Encoders are missing. end note diff --git a/doc/architecture/uml/LogicalView/SensorFusion/HAL_SensorFusion.puml b/doc/architecture/uml/LogicalView/SensorFusion/HAL_SensorFusion.puml index 649c03dc..b1e42583 100644 --- a/doc/architecture/uml/LogicalView/SensorFusion/HAL_SensorFusion.puml +++ b/doc/architecture/uml/LogicalView/SensorFusion/HAL_SensorFusion.puml @@ -19,19 +19,6 @@ package "HAL" as hal { + {abstract} getResolution() const : uint16_t } - interface "IDisplay" as iDisplay { - + {abstract} clear() : void - + {abstract} gotoXY(xCoord : uint8_t, yCoord : uint8_t) : void - + {abstract} print(str : const String&) : size_t - + {abstract} print(str : const char[]) : size_t - + {abstract} print(value : uint8_t) : size_t - + {abstract} print(value : uint16_t) : size_t - + {abstract} print(value : uint32_t) : size_t - + {abstract} print(value : int8_t) : size_t - + {abstract} print(value : int16_t) : size_t - + {abstract} print(value : int32_t) : size_t - } - interface "ILed" as iLed { + {abstract} enable(enableIt : bool) : void } @@ -52,28 +39,25 @@ package "HAL" as hal { + {abstract} getMaxSpeed() const : int16_t } - interface "IIMU" as iIMU { + interface "IIMU" as iIMU { + {abstract} init() : bool - + {abstract} readAcc() : void + + {abstract} readAccelerometer() : void + {abstract} readGyro() : void - + {abstract} readMag() : void - + {abstract} accDataReady() : bool + + {abstract} readMagnetometer() : void + + {abstract} accelerometerDataReady() : bool + {abstract} gyroDataReady() : bool - + {abstract} magDataReady() : bool - + {abstract} getAccelerationValues(int16_t* accelerationValues) : void - + {abstract} getTurnRates(int16_t* turnRates) : void - + {abstract} getMagnetometerValues(int16_t* magnetometerValues) : void + + {abstract} magnetometerDataReady() : bool + + {abstract} getAccelerationValues(IMUData* accelerationValues) : void + + {abstract} getTurnRates(IMUData* turnRates) : void + + {abstract} getMagnetometerValues(IMUData* magnetometerValues) : void } } class Board << namespace >> { + getButtonA() : IButton& - + getDisplay() : IDisplay& + getEncoders() : IEncoders& - + getLedRed() : ILed& + getLedYellow() : ILed& - + getLedGreen() : iLed& + getLineSensors() : ILineSensors& + getMotors() : IMotors& + getIMU() : IIMU& @@ -106,22 +90,16 @@ package "HAL" as hal { class LineSensors class ButtonA class Motors - class Display class Encoders - class LedRed class LedYellow - class LedGreen class IMU } iLineSensors <|... LineSensors: <> iButton <|... ButtonA: <> iMotors <|... Motors: <> - iDisplay <|... Display: <> iEncoders <|... Encoders: <> - iLed <|... LedRed: <> iLed <|... LedYellow: <> - iLed <|... LedGreen: <> iIMU <|... IMU: <> } @@ -146,12 +124,9 @@ hal -[hidden]-- zumo32u4Lib LineSensors *--> Zumo32U4LineSensors ButtonA *--> Zumo32U4ButtonA Motors *--> Zumo32U4Motors -Display *--> Zumo32U4LCD Encoders *--> Zumo32U4Encoders IMU *--> Zumo32U4IMU -LedRed ..> Zumo32U4: <> LedYellow ..> Zumo32U4: <> -LedGreen ..> Zumo32U4: <> note bottom of hal The hardware abstraction layer contains