Commit e73aa2ad authored by Jean Meurice's avatar Jean Meurice
Browse files

Moved doc to wiki, BusComponent -> BusUser, removed msgid indirection, added...

Moved doc to wiki, BusComponent -> BusUser, removed msgid indirection, added BusUserProperties, fixed Vehicle serialization
parent 7f97381b
Pipeline #313530 passed with stage
in 1 minute and 25 seconds
# Simulation
## [Documentation for this project](docs/documentation/readme.md)
## >> [Link to the Documentation for this project (Wiki)](https://git.rwth-aachen.de/monticore/EmbeddedMontiArc/simulators/simulation/-/wikis/home) <<
## Usage
To use the different sub-project as maven dependency, add the following to your pom's `<dependencies>`:
```xml
<dependency>
<groupId>montisim</groupId>
<artifactId>"sub-project name"</artifactId>
<artifactId>sub-project-name</artifactId>
<version>${revision}</version>
</dependency>
```
[Documentation Root](readme.md) | [Previous (Simulator)](simulator.md)
# Debug Visualization
## Viewer, SimulationRunner/Control
## Renderers
\ No newline at end of file
[Documentation Root](readme.md) | [Previous (Vehicle)](vehicle.md) | [Next (Simulator)](simulator.md)
# EEComponents
## Navigation
## Autopilots
\ No newline at end of file
[Documentation Root](readme.md) | [Previous (Environment)](environment.md) | [Next (Vehicle)](vehicle.md)
TODO
- EESimulator/Structure
- Components/Component Manager
- Discrete Events system/Events
- Messages/Types
- EE Setup / Validation
- Creating new components
- Buses, Bridges
- Sensors, Actuators
# EESimulator
The `EESimulator` sub-project handles the transmission and processing of **discrete events** inside a vehicle. These discrete events mainly have the form of **messages** between **ee-components** across communication **buses**.
> *__EE__ comes from "Electrical & Electronic Systems"*
## Usage
Users of this sub-project can either instance the `EESimulator` as part of their vehicle or inherit the `EEComponent` class to create new components that work inside the ee-vehicle.
To setup an ee-system, create an `EESimulator`.
Then create the required `Bus`, `EEComponent` & `Bridge` instances.
Components and bridges can then be linked to buses (with `connectToBus()`) using the bus object, its _component-id_ or its name.
A component or bridge can be connected to multiple buses.
> _**Note**: no cyclic bus/bridge structures are allowed._
When all components are connected, call `simulator.getComponentManager().finalizeSetup()`.
This will check the routing validity between components and setup the optimized routing data-structures.
## Structure
EESimulator: extends a DiscreteEventSimulator.
EEEventProcessor: registers at the EESimulator.
The `EESimulator` contains a `ComponentManager` and a `MessageTypeManager`
## Buses
### ConstantBus
### CAN
## Tests
### CANTest
Messages used in the different CAN tests:
| Message | Size (bits) | Priority |
| ------- | ------------|:--------:|
| **m1** | _MP_ | 1 |
| **m2** | 3 | 2 |
| **m3** | 5*_MP_ | 3 |
| **m4** | 3*_MP_ + 5 | 4 |
| **m5** | _MP_ | 5 |
> _MP_ is for "**Max Payload**", the maximum number of payload bits in one frame.
### Performed tests
- **fullFrameMsg()**: send _m1_.
- **partialFrameMsg()**: send _m2_.
- **multiFullFrameMsg()**: send _m3_.
- **multiPartialFrameMsg()**: send _m4_.
- **multiMsgsInTime()**: send _m1_ to _m4_, spaced in time (no overlap).
- **multiMsgsAtSameTime()**: send _m1_ to _m4_ at the exact same time (test priorities).
- **multiMsgsOverlappingTime()**: send _m1_ to _m5_ at overlapping time (test partial transmissions and transmission resume, see next section).
### multiMsgsOverlappingTime()
The following shows the expected behavior for the `multiMsgsOverlappingTime()` test. Note that the inter-frame spaces are not shown in the graph but have an impact on how the expected times have to be computed. (The *completion time* doesn't include the inter-frame space necessary to start transmitting the next frame.)
![CANTest](img/CANTest.svg)
## TODO
- Usage
- Structure
- Buses
- Tests
[Documentation Root](readme.md) | [Previous (EESimulator)](eesimulator.md) | [Next (Vehicle)](vehicle.md)
# Environment
## World
## Osm
## Pathfinding
\ No newline at end of file
[//]: # (These documents are best viewed in their formatted form, e.g. in the online gitlab file viewer.)
# Simulation Documentation
## Sub-Projects
- [Environment](environment.md)
- [EESimulator](eesimulator.md)
- [Vehicle](vehicle.md)
- [EEComponents](eecomponents.md)
- [Simulator](simulator.md)
- [Debug Visualization](debugvis.md)
[Documentation]() of the `Commons` project TODO LINK
## Introduction
## How to build
## Structure Overview
\ No newline at end of file
[Documentation Root](readme.md) | [Previous (Vehicle)](vehicle.md) | [Next (Debug Visualization)](debugvis.md)
# Simulator
## Simulator/Loop
## Vehicle Configs
\ No newline at end of file
[Documentation Root](readme.md) | [Previous (EESimulator)](eesimulator.md) | [Next (EEComponents)](eecomponents.md)
# Vehicle
## Structure
## DynamicObject/PhysicalValues
## Physics Model
## PowerTrain
## Builder/Config/Properties
\ No newline at end of file
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="125" height="20">
<linearGradient id="b" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
<stop offset="1" stop-opacity=".1"/>
</linearGradient>
<mask id="anybadge_1">
<rect width="98" height="20" rx="3" fill="#fff"/>
</mask>
<g mask="url(#anybadge_1)">
<path fill="#b0dbfc" d="M0 0h98v20H0z"/>
<!-- <path fill="#4c1" d="M97 0h28v20H97z"/> -->
<path fill="url(#b)" d="M0 0h125v20H0z"/>
</g>
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
<text x="49.5" y="15" fill="#010101" fill-opacity=".3">Documentation</text>
<text x="48.5" y="14">Documentation</text>
</g>
</svg>
\ No newline at end of file
This diff is collapsed.
......@@ -77,18 +77,18 @@ public class JavaAutopilot extends EEComponent {
@Override
protected void receive(MessageReceiveEvent msgRecvEvent) {
Message msg = msgRecvEvent.getMessage();
if (msg.msgId == velocityMsg.messageId) {
if (msg.isMsg(velocityMsg)) {
currentVelocity = (Double) msg.message;
// Trigger computation
} else if (msg.msgId == positionMsg.messageId) {
} else if (msg.isMsg(positionMsg)) {
currentPosition = (Vec2) msg.message;
// Trigger computation
compute(msgRecvEvent.getEventTime());
} else if (msg.msgId == compassMsg.messageId) {
} else if (msg.isMsg(compassMsg)) {
currentCompass = (Double) msg.message;
} else if (msg.msgId == trajXMsg.messageId) {
} else if (msg.isMsg(trajXMsg)) {
// Assumes the x positions array of a new trajectory always arrives first
newTrajX = (double[]) msg.message;
} else if (msg.msgId == trajYMsg.messageId) {
} else if (msg.isMsg(trajYMsg)) {
trajY = (double[]) msg.message;
trajX = newTrajX;
}
......@@ -253,7 +253,7 @@ public class JavaAutopilot extends EEComponent {
// Eval junction turn
double junctionAngle = Math.acos(IPM.dot(currSeg.dir, nextSeg.dir));
double junctionSign = Math.signum(IPM.dot(normal, nextSeg.dir));
//double junctionSign = Math.signum(IPM.dot(normal, nextSeg.dir));
double maxRadius = junctionAngle == 0 ? Double.POSITIVE_INFINITY
: MAX_DEVIATION / ((1 / Math.cos(junctionAngle * 0.5)) - 1);
double maxDistToCorner = Math.sqrt(MAX_DEVIATION * (MAX_DEVIATION + maxRadius * 2));
......
......@@ -4,12 +4,12 @@ package de.rwth.montisim.simulation.eecomponents.autopilots;
import java.time.Duration;
import de.rwth.montisim.commons.utils.json.Typed;
import de.rwth.montisim.simulation.eesimulator.components.EEComponentProperties;
import de.rwth.montisim.simulation.eesimulator.components.BusUserProperties;
import de.rwth.montisim.simulation.eesimulator.components.EEComponentType;
import de.rwth.montisim.simulation.vehicle.VehicleBuilder;
@Typed(JavaAutopilotProperties.TYPE)
public class JavaAutopilotProperties extends EEComponentProperties {
public class JavaAutopilotProperties extends BusUserProperties {
public static final String TYPE = "java_autopilot";
static {
VehicleBuilder.registerComponentBuilder(TYPE,
......
......@@ -50,7 +50,7 @@ public class TestAutopilot extends EEComponent {
@Override
protected void receive(MessageReceiveEvent msgRecvEvent) {
Message msg = msgRecvEvent.getMessage();
if (msg.msgId == velocityMsg.messageId) {
if (msg.isMsg(velocityMsg)) {
currentVelocity = (Double) msg.message;
// Trigger computation
compute(msgRecvEvent.getEventTime());
......
......@@ -5,12 +5,12 @@ import java.time.Duration;
import de.rwth.montisim.commons.utils.json.JsonEntry;
import de.rwth.montisim.commons.utils.json.Typed;
import de.rwth.montisim.simulation.eesimulator.components.EEComponentProperties;
import de.rwth.montisim.simulation.eesimulator.components.BusUserProperties;
import de.rwth.montisim.simulation.eesimulator.components.EEComponentType;
import de.rwth.montisim.simulation.vehicle.VehicleBuilder;
@Typed(TestAutopilotProperties.TYPE)
public class TestAutopilotProperties extends EEComponentProperties {
public class TestAutopilotProperties extends BusUserProperties {
public static final String TYPE = "test_autopilot";
public static final String COMPUTER_TYPE = "test_autopilot";
static {
......
......@@ -91,7 +91,7 @@ public class Navigation extends EEComponent {
// // Update position -> Check current routing
// // TODO
// } else
if (msg.msgId == truePosMsg.messageId) {
if (msg.isMsg(truePosMsg)) {
currentPos = Optional.of((Vec2) msg.message);
if (!currentPath.isPresent() && !targets.empty()){
newTrajectory(time);
......@@ -99,12 +99,12 @@ public class Navigation extends EEComponent {
updateTrajectory(time);
}
// TODO
} else if (msg.msgId == pushTargetPosMsg.messageId) {
} else if (msg.isMsg(pushTargetPosMsg)) {
// Add new position to routing stack -> compute new routing
// TODO
pushTargetPos((Vec2)msg.message, time);
newTrajectory(time);
} else if (msg.msgId == popTargetPosMsg.messageId) {
} else if (msg.isMsg(popTargetPosMsg)) {
// Remove target from routing stack -> compute new routing
// TODO
popTargetPos();
......
......@@ -2,12 +2,12 @@
package de.rwth.montisim.simulation.eecomponents.navigation;
import de.rwth.montisim.commons.utils.json.Typed;
import de.rwth.montisim.simulation.eesimulator.components.EEComponentProperties;
import de.rwth.montisim.simulation.eesimulator.components.BusUserProperties;
import de.rwth.montisim.simulation.eesimulator.components.EEComponentType;
import de.rwth.montisim.simulation.vehicle.VehicleBuilder;
@Typed(NavigationProperties.TYPE)
public class NavigationProperties extends EEComponentProperties {
public class NavigationProperties extends BusUserProperties {
public static final String TYPE = "navigation";
static {
VehicleBuilder.registerComponentBuilder(TYPE,
......
......@@ -78,11 +78,11 @@ public class Actuator extends EEComponent implements Updatable {
@Override
protected void receive(MessageReceiveEvent msgRecvEvent) {
Message msg = msgRecvEvent.getMessage();
if (msg.msgId == msgInfo.messageId) {
if (msg.isMsg(msgInfo)) {
targetValue = (Double) msg.message;
} else {
Logger.getLogger("Warnings").warning("Actuator \"" + properties.name + "\" received unexpected message: "
+ simulator.getMessageTypeManager().getMsgInfo(msg.msgId).name);
+ msg.msgInfo.name);
}
}
......
......@@ -5,12 +5,12 @@ import java.util.Optional;
import de.rwth.montisim.commons.utils.json.JsonEntry;
import de.rwth.montisim.commons.utils.json.Typed;
import de.rwth.montisim.simulation.eesimulator.components.EEComponentProperties;
import de.rwth.montisim.simulation.eesimulator.components.BusUserProperties;
import de.rwth.montisim.simulation.eesimulator.components.EEComponentType;
import de.rwth.montisim.simulation.eesimulator.sensor.SensorProperties;
@Typed(ActuatorProperties.TYPE)
public class ActuatorProperties extends EEComponentProperties {
public class ActuatorProperties extends BusUserProperties {
public static final String TYPE = "actuator";
public String physical_value_name;
......
......@@ -4,11 +4,11 @@ package de.rwth.montisim.simulation.eesimulator.bridge;
import java.time.Duration;
import de.rwth.montisim.commons.utils.json.Typed;
import de.rwth.montisim.simulation.eesimulator.components.EEComponentProperties;
import de.rwth.montisim.simulation.eesimulator.components.BusUserProperties;
import de.rwth.montisim.simulation.eesimulator.components.EEComponentType;
@Typed(BridgeProperties.TYPE)
public class BridgeProperties extends EEComponentProperties {
public class BridgeProperties extends BusUserProperties {
public static final String TYPE = "bridge";
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment