Skip to content
Snippets Groups Projects
Commit ba45ac86 authored by Tobias's avatar Tobias
Browse files

readme

parent 3efcfd94
No related branches found
No related tags found
No related merge requests found
# Control Component Library
This library contains the projects ControlComponents.Core, ControlComponents.ML and ControlComponent.Frame.
- ControlComponents.Core provides basic functionality to create ControlComponents as defined in [BaSyx](https://wiki.eclipse.org/BaSyx_/_Documentation_/_API_/_ControlComponent#Service_Interface).
- ControlComponents.ML provides basic functionality to extend ControlComponents with Reinforcement Learning specific interfaces.
- ControlComponents.Frame provides the FrameControlComponent, which can be used to extract operation modes and use those in a different component. The relevant states and calls are synchronized between those two components.
This library supports netstandard2.0 to be used in Unity3D.
# Usage
Compile the project by running `dotnet build`
Use the resulting .dll files in your project to access control component feature of this library
Use the resulting .dll files in your project to access control component feature of this library.
## ControlComponent
By extending the OperationMode class and overriding the state specific methods, you can inject your own logic and encapsulate it in a BaSys ControlComponent. Create or extend the ControlComponent class and pass OperationModes and OrderOutputs to it.
## OperationMode
Inheriting the OperationModeBase class allows you to override the execution state method to inject your process logic.
You can find an example [here](https://git.rwth-aachen.de/tobias.rink/pts) in the PTS.ControlComponents project.
# Contribution
1. Prepare VSCode https://code.visualstudio.com/docs/languages/dotnet
## Used setup commands
[Project Structure](https://docs.microsoft.com/de-de/dotnet/core/porting/project-structure)
[dotnet cli](https://docs.microsoft.com/de-de/dotnet/core/tools/dotnet-new)
2. Follow this [Project Structure](https://docs.microsoft.com/de-de/dotnet/core/porting/project-structure)
3. You can use the [dotnet cli](https://docs.microsoft.com/de-de/dotnet/core/tools/dotnet-new) to create new projects
4. Try to implement specific, small and tested features. Create a pull request.
## Testing
This project uses [NUnit](https://nunit.org/).
......@@ -31,7 +37,7 @@ Using the following command creates a TestResult folder with the coverage result
dotnet test --collect:"XPlat Code Coverage"
```
install reportgenerator to generate a test report. `dotnet tool install -g dotnet-reportgenerator-globaltool`
install reportgenerator to generate a test report. `dotnet tool install -g dotnet-reportgenerator-globaltool`.
Run the following command (with the correct result id) to create a "coveragereport" folder with an index.html file to present the coverage results:
```
reportgenerator -reports:.\tests\ControlComponents.Core.Tests\TestResults\58238ace-ffed-4f17-8afa-d9a60792f957\coverage.cobertura.xml -targetdir:coveragereport -reporttypes:Html
......@@ -45,16 +51,7 @@ Open the index.html file in your browser to access the results.
https://github.com/coverlet-coverage/coverlet/blob/master/README.md
https://docs.microsoft.com/de-de/dotnet/core/testing/unit-testing-code-coverage?tabs=windows
### Writing Tests
[assembly:InternalsVisibleTo("ControlComponent.Tests")]
### Logs in Unit Tests by configure logger in code
https://github.com/NLog/NLog/wiki/Configure-from-code
## Target Framework
Changed TargetFramework to netstandard2.0 to enable unity3d support
https://docs.unity3d.com/2019.3/Documentation/Manual/dotnetProfileSupport.html
https://docs.microsoft.com/de-de/dotnet/standard/frameworks
https://docs.microsoft.com/de-de/dotnet/standard/net-standard
@startuml
title Component Diagram
component ControlComponents.Core
component ControlComponents.Conveyor
component PTS
component UnityEngine
PTS --> ControlComponents.Conveyor
PTS --> ControlComponents.Core
PTS --> UnityEngine
ControlComponents.Conveyor --> ControlComponents.Core
@enduml
\ No newline at end of file
@startuml
title ControlComponents.Core
together {
interface ControlComponents.Core.IControlComponent
class ControlComponents.Core.ControlComponent
}
together {
interface ControlComponents.Core.IOrderOutput
class ControlComponents.Core.OrderOutput
}
together {
interface ControlComponents.Core.IOperationMode
abstract ControlComponents.Core.OperationModeBase
}
together {
class ControlComponents.Conveyor.Conveyor
class ControlComponents.Conveyor.ConveyorShift
}
together {
class ControlComponents.Conveyor.Transport
class ControlComponents.Conveyor.Shift
}
namespace ControlComponents.Core {
interface IOperationMode
abstract OperationModeBase
interface IControlComponent
class ControlComponent
interface IOrderOutput
class OrderOutput
IControlComponent <|.. ControlComponent
IOperationMode <|.. OperationModeBase
IControlComponent <|.. IOrderOutput
IOrderOutput <|.. OrderOutput
ControlComponent o--> "0..*" IOrderOutput
ControlComponent o--> "1..*" IOperationMode
OperationModeBase o--> "0..*" IOrderOutput
OrderOutput o--> "1" IControlComponent
}
namespace ControlComponents.Conveyor{
class Conveyor
class ConveyorShift
class Transport
class Shift
interface ILightBarrier
interface IMotor
ControlComponents.Core.OperationModeBase <|-- Transport
ControlComponents.Core.OperationModeBase <|-- Shift
ControlComponents.Core.ControlComponent <|-- Conveyor
Conveyor <|-- ConveyorShift
Conveyor o--> "4" Transport
ConveyorShift o--> "2" Shift
Transport o--> "4" ILightBarrier
Transport o--> "1" IMotor
Shift o--> "1" IMotor
Shift o--> "6" ILightBarrier
}
newpage
title Simulation Integration
namespace PTS {
abstract ControlComponentUnity
class ConveyorUnity
ControlComponentUnity o--> "1" ControlComponents.Core.IControlComponent
ControlComponentUnity <|.. ConveyorUnity
ControlComponents.Core.IControlComponent <|.. ControlComponentUnity
UnityEngine.MonoBehavior <|-- ControlComponentUnity
UnityEngine.MonoBehavior <|-- BeltMotor
UnityEngine.MonoBehavior <|-- LightBarrier
ControlComponents.Conveyor.ILightBarrier <|.. LightBarrier
ControlComponents.Conveyor.IMotor <|.. BeltMotor
ControlComponents.Conveyor.Conveyor <|.. ConveyorUnity
' only for formatting
' UnityEngine.MonoBehavior -[hidden]> ControlComponents.Core.IControlComponent
}
@enduml
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment