-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from BlueAndi/SensorFusionPR
Sensor fusion Pull Request
- Loading branch information
Showing
26 changed files
with
7,409 additions
and
231 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# Radon Ulzer - SENSORFUSION <!-- omit in toc --> | ||
|
||
* [General](#general) | ||
* [SerialMuxProt Channels](#serialmuxprot-channels) | ||
* [Tx channel "LINE\_SENS"](#tx-channel-sensor_data) | ||
* [SW Architecture](#sw-architecture) | ||
* [Logical View](#logical-view) | ||
* [Application](#application) | ||
* [Abbreviations](#abbreviations) | ||
* [Issues, Ideas And Bugs](#issues-ideas-and-bugs) | ||
* [License](#license) | ||
* [Contribution](#contribution) | ||
|
||
# General | ||
|
||
The robot sends sensor data (Odometry data and IMU data) via SerialMuxProt. | ||
|
||
On target the physical communication uses the serial. | ||
|
||
On simulation the physical communication uses a socket connection. | ||
|
||
## SerialMuxProt Channels | ||
|
||
|
||
### Tx channel "SENSOR_DATA" | ||
This channel is used to send raw sensor data used for Sensor Fusion on the ZumoComSystem. | ||
|
||
* 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) | ||
* Angle calculated by Odometry (in mrad) | ||
* Position in X calculated by Odometry (in mm) | ||
* Position in Y calculated by Odometry (in mm) | ||
* Endianess: Big endian | ||
|
||
# SW Architecture | ||
The following part contains the specific details of the SensorFusion application. | ||
|
||
## Logical View | ||
|
||
### Application | ||
The application uses the same [State Machine](https://github.com/BlueAndi/RadonUlzer/blob/main/doc/architecture/LINEFOLLOWER.md) as the Line Follower Application. | ||
|
||
### 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) | ||
|
||
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) | ||
|
||
# Abbreviations | ||
|
||
| Abbreviation | Description | | ||
| - | - | | ||
| HAL | Hardware Abstraction Layer | | ||
| IMU | Inertial Measurement Unit | | ||
|
||
# Issues, Ideas And Bugs | ||
If you have further ideas or you found some bugs, great! Create a [issue](https://github.com/BlueAndi/RadonUlzer/issues) or if you are able and willing to fix it by yourself, clone the repository and create a pull request. | ||
|
||
# License | ||
The whole source code is published under the [MIT license](http://choosealicense.com/licenses/mit/). | ||
Consider the different licenses of the used third party libraries too! | ||
|
||
# Contribution | ||
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, shall be licensed as above, without any | ||
additional terms or conditions. |
139 changes: 139 additions & 0 deletions
139
doc/architecture/uml/LogicalView/SensorFusion/HAL_IMU.puml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
@startuml HAL IMU | ||
|
||
title Hardware Abstraction Layer - IMU | ||
|
||
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} readGyro() : void | ||
+ {abstract} readMag() : void | ||
+ {abstract} accDataReady() : 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 | ||
|
||
} | ||
} | ||
|
||
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 | ||
} | ||
class "Board" as BoardSim { | ||
- m_imu : IMU | ||
+ getIMU() : IMU& | ||
+ init() : void | ||
} | ||
} | ||
|
||
package "HAL Target" as target { | ||
class "IMU" as ImuTarget { | ||
- m_accelerationValues[3] : vector<int16_t> | ||
- m_gyroValues[3] : vector<int16_t> | ||
- m_magnetometerValues[3] : vector<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 | ||
} | ||
class "Board" as BoardTarget{ | ||
- m_imu : IMU | ||
+ getIMU() : IMU& | ||
+ init() : void | ||
} | ||
} | ||
} | ||
iIMU <|... ImuSim: <<realize>> | ||
iBoard <|... BoardSim: <<realize>> | ||
iBoard *-- iIMU | ||
|
||
iIMU <|... ImuTarget: <<realize>> | ||
iBoard <|... BoardTarget: <<realize>> | ||
|
||
|
||
package "Webots library" as webotsLib { | ||
class Accelerometer { | ||
+ getValues() : double * | ||
+ enable(int samplingPeriod) : void | ||
} | ||
class Gyro { | ||
+ getValues() : double * | ||
+ enable(int samplingPeriod) : void | ||
} | ||
class Compass { | ||
+ getValues() : double * | ||
+ enable(int samplingPeriod) : void | ||
} | ||
} | ||
|
||
package "Zumo32U4 library" as zumo32u4Lib { | ||
|
||
class Zumo32U4IMU { | ||
- a[3] : vector<int16_t> | ||
- g[3] : vector<int16_t> | ||
- m[3] : vector<int16_t> | ||
+ init() : bool | ||
+ readAcc() : void | ||
+ readGyro() : void | ||
+ readMag() : void | ||
+ accDataReady() : bool | ||
+ gyroDataReady() : bool | ||
+ magDataReady() : bool | ||
} | ||
} | ||
|
||
note bottom of zumo32u4Lib | ||
Provided by Pololu. | ||
https://pololu.github.io/zumo-32u4-arduino-library/index.html | ||
end note | ||
|
||
note bottom of webotsLib | ||
Provided by Cyberbotics. | ||
https://cyberbotics.com/doc/reference/thanks?version=R2023b | ||
end note | ||
|
||
ImuTarget *--> Zumo32U4IMU | ||
|
||
ImuSim *--> Accelerometer | ||
ImuSim *--> Gyro | ||
ImuSim *--> Compass | ||
|
||
note left 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 | ||
are missing. | ||
end note | ||
|
||
|
||
@enduml |
Oops, something went wrong.