Aufgrund von Umarbeiten des s3 Storage wird es in GitLab, in nächster Zeit, mögliche Performance-Einbußen geben. Näheres dazu unter: https://maintenance.itc.rwth-aachen.de/ticket/status/messages/43/show_ticket/6670

Commit e91c8ef9 authored by Jean Meurice's avatar Jean Meurice

New Math Types, new Simulation Interfaces

parent 9e590070
Pipeline #261237 passed with stage
in 45 seconds
......@@ -7,7 +7,8 @@
can be found under https://github.com/MontiCore/monticore.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>montisim</groupId>
......@@ -79,7 +80,7 @@
</execution>
</executions>
</plugin>
<!-- to add copyright information automatically-->
<plugin>
<groupId>com.mycila</groupId>
......@@ -103,7 +104,7 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
......@@ -143,4 +144,11 @@
</snapshotRepository>
</distributionManagement>
<repositories>
<repository>
<id>se-nexus</id>
<name>SE-Nexus repository</name>
<url>https://nexus.se.rwth-aachen.de/content/groups/public</url>
</repository>
</repositories>
</project>
......@@ -6,6 +6,19 @@
*/
package de.rwth.montisim.commons.boundingbox;
import de.rwth.montisim.commons.utils.Mat3;
import de.rwth.montisim.commons.utils.Vec3;
public class OBB implements BoundingBox {
public Vec3 position;
public Vec3 halfSize;
//Every collumn is a unit axis in the rotated space
public Mat3 rotation;
/// Takes ownership of the position and rotation
public OBB(Vec3 position, Vec3 size, Mat3 rotation) {
this.halfSize = size.multiply(0.5);
this.position = position;
this.rotation = rotation;
}
}
\ No newline at end of file
......@@ -7,7 +7,7 @@
package de.rwth.montisim.commons.composite;
/**
* BusValue objects should only content basic data types (double, int, ...).
* BusValue objects should only contain basic data types (double, int, ...).
* Complex data types should be represented by BusComposite or BusArray.
*/
public class BusValue implements BusComponent {
......
......@@ -15,102 +15,102 @@ package de.rwth.montisim.commons.controller.commons;
*/
public enum BusEntry {
// ***************************************************************************
// Navigation *
// ***************************************************************************
NAVIGATION_DETAILED_PATH_WITH_MAX_STEERING_ANGLE("NAVIGATION_DETAILED_PATH_WITH_MAX_STEERING_ANGLE"),
// x coordinates of the planned trajectory, List<Double>
PLANNED_TRAJECTORY_X("PLANNED_TRAJECTORY_X"),
// y coordinates of the planned trajectory, List<Double>
PLANNED_TRAJECTORY_Y("PLANNED_TRAJECTORY_Y"),
// ***************************************************************************
// Constants *
// ***************************************************************************
CONSTANT_MAXIMUM_TOTAL_VELOCITY("CONSTANT_MAXIMUM_TOTAL_VELOCITY"),
CONSTANT_NUMBER_OF_GEARS("CONSTANT_NUMBER_OF_GEARS"), CONSTANT_WHEELBASE("CONSTANT_WHEELBASE"),
CONSTANT_MAP_ADJACENCY_LIST("CONSTANT_MAP_ADJACENCY_LIST"),
CONSTANT_MOTOR_MAX_ACCELERATION("CONSTANT_MOTOR_MAX_ACCELERATION"),
CONSTANT_MOTOR_MIN_ACCELERATION("CONSTANT_MOTOR_MIN_ACCELERATION"),
CONSTANT_BRAKES_MAX_ACCELERATION("CONSTANT_BRAKES_MAX_ACCELERATION"),
CONSTANT_BRAKES_MIN_ACCELERATION("CONSTANT_BRAKES_MIN_ACCELERATION"),
CONSTANT_STEERING_MAX_ANGLE("CONSTANT_STEERING_MAX_ANGLE"),
CONSTANT_STEERING_MIN_ANGLE("CONSTANT_STEERING_MIN_ANGLE"), CONSTANT_TRAJECTORY_ERROR("CONSTANT_TRAJECTORY_ERROR"),
// ***************************************************************************
// Sensor Entries *
// ***************************************************************************
SENSOR_VELOCITY("SENSOR_VELOCITY"), SENSOR_STEERING("SENSOR_STEERING"),
SENSOR_DISTANCE_TO_RIGHT("SENSOR_DISTANCE_TO_RIGHT"), SENSOR_DISTANCE_TO_LEFT("SENSOR_DISTANCE_TO_LEFT"),
SENSOR_LEFT_FRONT_WHEEL_DISTANCE_TO_STREET_SENSOR("SENSOR_LEFT_FRONT_WHEEL_DISTANCE_TO_STREET_SENSOR"),
SENSOR_RIGHT_FRONT_WHEEL_DISTANCE_TO_STREET_SENSOR("SENSOR_RIGHT_FRONT_WHEEL_DISTANCE_TO_STREET_SENSOR"),
SENSOR_LEFT_BACK_WHEEL_DISTANCE_TO_STREET_SENSOR("SENSOR_LEFT_BACK_WHEEL_DISTANCE_TO_STREET_SENSOR"),
SENSOR_RIGHT_BACK_WHEEL_DISTANCE_TO_STREET_SENSOR("SENSOR_RIGHT_BACK_WHEEL_DISTANCE_TO_STREET_SENSOR"),
SENSOR_GPS_COORDINATES("SENSOR_GPS_COORDINATES"), SENSOR_CURRENT_SURFACE("SENSOR_CURRENT_SURFACE"),
SENSOR_WEATHER("SENSOR_WEATHER"), SENSOR_CAMERA("SENSOR_CAMERA"), SENSOR_COMPASS("SENSOR_COMPASS"),
SENSOR_OBSTACLE("SENSOR_OBSTACLE"), SENSOR_VANISHINGPOINT("SENSOR_VANISHING"), SENSOR_LANE("SENSOR_LANE"),
SENSOR_STREETTYPE("SENSOR_STREETTYPE"), SENSOR_DAYNIGHT("SENSOR_DAYNIGHT"),
SENSOR_LEFT_FRONT_DISTANCE("SENSOR_LEFT_FRONT_DISTANCE"),
SENSOR_RIGHT_FRONT_DISTANCE("SENSOR_RIGHT_FRONT_DISTANCE"),
// ***************************************************************************
// * Actuator Entries *
// ***************************************************************************
// Target Value
ACTUATOR_ENGINE("ACTUATOR_ENGINE"),
// Current Value
ACTUATOR_ENGINE_CURRENT("ACTUATOR_ENGINE_CURRENT"),
// Target Value
ACTUATOR_BRAKE("ACTUATOR_BRAKE"),
// Current Value
ACTUATOR_BRAKE_CURRENT("ACTUATOR_BRAKE_CURRENT"),
// Target Value
ACTUATOR_STEERING("ACTUATOR_STEERING"),
// Current Value
ACTUATOR_STEERING_CURRENT("ACTUATOR_STEERING_CURRENT"),
// Target Value
ACTUATOR_GEAR("ACTUATOR_GEAR"),
// Current Value
ACTUATOR_GEAR_CURRENT("ACTUATOR_GEAR_CURRENT"),
// Target Value
ACTUATOR_CLUTCH("ACTUATOR_CLUTCH"),
// Current Value
ACTUATOR_CLUTCH_CURRENT("ACTUATOR_CLUTCH_CURRENT"),
// Target Value
ACTUATOR_THROTTLE("ACTUATOR_THROTTLE"),
// Current Value
ACTUATOR_THROTTLE_CURRENT("ACTUATOR_THROTTLE_CURRENT"),
// ***************************************************************************
// * Computervision Entries *
// ***************************************************************************
COMPUTERVISION_VANISHING_POINT("COMPUTERVISION_VANISHING_POINT"),
COMPUTERVISION_DETECTED_CARS("COMPUTERVISION_DETECTED_CARS"),
COMPUTERVISION_TRACKED_CARS("COMPUTERVISION_TRACKED_CARS"),
COMPUTERVISION_TRACKED_PEDESTRIANS("COMPUTERVISION_DETECTED_PEDESTRIANS"),
COMPUTERVISION_DETECTED_PEDESTRIANS("COMPUTERVISION_DETECTED_PEDESTRIANS"),
COMPUTERVISION_DETECTED_LANES("COMPUTERVISION_DETECTED_LANES"),
COMPUTERVISION_DETECTED_SIGNS("COMPUTERVISION_DETECTED_SIGNS"),
// // ***************************************************************************
// // Navigation *
// // ***************************************************************************
// NAVIGATION_DETAILED_PATH_WITH_MAX_STEERING_ANGLE("NAVIGATION_DETAILED_PATH_WITH_MAX_STEERING_ANGLE"),
// // x coordinates of the planned trajectory, List<Double>
// PLANNED_TRAJECTORY_X("PLANNED_TRAJECTORY_X"),
// // y coordinates of the planned trajectory, List<Double>
// PLANNED_TRAJECTORY_Y("PLANNED_TRAJECTORY_Y"),
// // ***************************************************************************
// // Constants *
// // ***************************************************************************
// CONSTANT_MAXIMUM_TOTAL_VELOCITY("CONSTANT_MAXIMUM_TOTAL_VELOCITY"),
// CONSTANT_NUMBER_OF_GEARS("CONSTANT_NUMBER_OF_GEARS"), CONSTANT_WHEELBASE("CONSTANT_WHEELBASE"),
// CONSTANT_MAP_ADJACENCY_LIST("CONSTANT_MAP_ADJACENCY_LIST"),
// CONSTANT_MOTOR_MAX_ACCELERATION("CONSTANT_MOTOR_MAX_ACCELERATION"),
// CONSTANT_MOTOR_MIN_ACCELERATION("CONSTANT_MOTOR_MIN_ACCELERATION"),
// CONSTANT_BRAKES_MAX_ACCELERATION("CONSTANT_BRAKES_MAX_ACCELERATION"),
// CONSTANT_BRAKES_MIN_ACCELERATION("CONSTANT_BRAKES_MIN_ACCELERATION"),
// CONSTANT_STEERING_MAX_ANGLE("CONSTANT_STEERING_MAX_ANGLE"),
// CONSTANT_STEERING_MIN_ANGLE("CONSTANT_STEERING_MIN_ANGLE"), CONSTANT_TRAJECTORY_ERROR("CONSTANT_TRAJECTORY_ERROR"),
// // ***************************************************************************
// // Sensor Entries *
// // ***************************************************************************
// SENSOR_VELOCITY("SENSOR_VELOCITY"), SENSOR_STEERING("SENSOR_STEERING"),
// SENSOR_DISTANCE_TO_RIGHT("SENSOR_DISTANCE_TO_RIGHT"), SENSOR_DISTANCE_TO_LEFT("SENSOR_DISTANCE_TO_LEFT"),
// SENSOR_LEFT_FRONT_WHEEL_DISTANCE_TO_STREET_SENSOR("SENSOR_LEFT_FRONT_WHEEL_DISTANCE_TO_STREET_SENSOR"),
// SENSOR_RIGHT_FRONT_WHEEL_DISTANCE_TO_STREET_SENSOR("SENSOR_RIGHT_FRONT_WHEEL_DISTANCE_TO_STREET_SENSOR"),
// SENSOR_LEFT_BACK_WHEEL_DISTANCE_TO_STREET_SENSOR("SENSOR_LEFT_BACK_WHEEL_DISTANCE_TO_STREET_SENSOR"),
// SENSOR_RIGHT_BACK_WHEEL_DISTANCE_TO_STREET_SENSOR("SENSOR_RIGHT_BACK_WHEEL_DISTANCE_TO_STREET_SENSOR"),
// SENSOR_GPS_COORDINATES("SENSOR_GPS_COORDINATES"), SENSOR_CURRENT_SURFACE("SENSOR_CURRENT_SURFACE"),
// SENSOR_WEATHER("SENSOR_WEATHER"), SENSOR_CAMERA("SENSOR_CAMERA"), SENSOR_COMPASS("SENSOR_COMPASS"),
// SENSOR_OBSTACLE("SENSOR_OBSTACLE"), SENSOR_VANISHINGPOINT("SENSOR_VANISHING"), SENSOR_LANE("SENSOR_LANE"),
// SENSOR_STREETTYPE("SENSOR_STREETTYPE"), SENSOR_DAYNIGHT("SENSOR_DAYNIGHT"),
// SENSOR_LEFT_FRONT_DISTANCE("SENSOR_LEFT_FRONT_DISTANCE"),
// SENSOR_RIGHT_FRONT_DISTANCE("SENSOR_RIGHT_FRONT_DISTANCE"),
// // ***************************************************************************
// // * Actuator Entries *
// // ***************************************************************************
// // Target Value
// ACTUATOR_ENGINE("ACTUATOR_ENGINE"),
// // Current Value
// ACTUATOR_ENGINE_CURRENT("ACTUATOR_ENGINE_CURRENT"),
// // Target Value
// ACTUATOR_BRAKE("ACTUATOR_BRAKE"),
// // Current Value
// ACTUATOR_BRAKE_CURRENT("ACTUATOR_BRAKE_CURRENT"),
// // Target Value
// ACTUATOR_STEERING("ACTUATOR_STEERING"),
// // Current Value
// ACTUATOR_STEERING_CURRENT("ACTUATOR_STEERING_CURRENT"),
// // Target Value
// ACTUATOR_GEAR("ACTUATOR_GEAR"),
// // Current Value
// ACTUATOR_GEAR_CURRENT("ACTUATOR_GEAR_CURRENT"),
// // Target Value
// ACTUATOR_CLUTCH("ACTUATOR_CLUTCH"),
// // Current Value
// ACTUATOR_CLUTCH_CURRENT("ACTUATOR_CLUTCH_CURRENT"),
// // Target Value
// ACTUATOR_THROTTLE("ACTUATOR_THROTTLE"),
// // Current Value
// ACTUATOR_THROTTLE_CURRENT("ACTUATOR_THROTTLE_CURRENT"),
// // ***************************************************************************
// // * Computervision Entries *
// // ***************************************************************************
// COMPUTERVISION_VANISHING_POINT("COMPUTERVISION_VANISHING_POINT"),
// COMPUTERVISION_DETECTED_CARS("COMPUTERVISION_DETECTED_CARS"),
// COMPUTERVISION_TRACKED_CARS("COMPUTERVISION_TRACKED_CARS"),
// COMPUTERVISION_TRACKED_PEDESTRIANS("COMPUTERVISION_DETECTED_PEDESTRIANS"),
// COMPUTERVISION_DETECTED_PEDESTRIANS("COMPUTERVISION_DETECTED_PEDESTRIANS"),
// COMPUTERVISION_DETECTED_LANES("COMPUTERVISION_DETECTED_LANES"),
// COMPUTERVISION_DETECTED_SIGNS("COMPUTERVISION_DETECTED_SIGNS"),
VEHICLE_MAX_TEMPORARY_ALLOWED_VELOCITY("VEHICLE_MAX_TEMPORARY_ALLOWED_VELOCITY"),
SIMULATION_DELTA_TIME("SIMULATION_DELTA_TIME"), ENVIRONMENT("ENVIRONMENT");
// VEHICLE_MAX_TEMPORARY_ALLOWED_VELOCITY("VEHICLE_MAX_TEMPORARY_ALLOWED_VELOCITY"),
// SIMULATION_DELTA_TIME("SIMULATION_DELTA_TIME"), ENVIRONMENT("ENVIRONMENT");
/**
* this variable contains the name of the entry
*/
private final String name;
// /**
// * this variable contains the name of the entry
// */
// private final String name;
/**
* constructor for a bus entry
*
* @param name the name of the entry
*/
private BusEntry(String name) {
this.name = name;
}
// /**
// * constructor for a bus entry
// *
// * @param name the name of the entry
// */
// private BusEntry(String name) {
// this.name = name;
// }
/**
* Getter of the name attribute
*
* @return the name of the entry
*/
public String toString() {
return this.name;
}
// /**
// * Getter of the name attribute
// *
// * @return the name of the entry
// */
// public String toString() {
// return this.name;
// }
}
......@@ -14,33 +14,33 @@ package de.rwth.montisim.commons.controller.commons;
* @author Christoph Grüne
*/
public enum NavigationEntry {
// ***************************************************************************
// * Navigation Entries *
// ***************************************************************************
MAP_ADJACENCY_LIST("MAP_ADJACENCY_LIST"), TARGET_NODE("TARGET_NODE"), GPS_COORDINATES("GPS_COORDINATES"),
CONSTANT_WHEELBASE("CONSTANT_WHEELBASE"),
DETAILED_PATH_WITH_MAX_STEERING_ANGLE("DETAILED_PATH_WITH_MAX_STEERING_ANGLE");
// // ***************************************************************************
// // * Navigation Entries *
// // ***************************************************************************
// MAP_ADJACENCY_LIST("MAP_ADJACENCY_LIST"), TARGET_NODE("TARGET_NODE"), GPS_COORDINATES("GPS_COORDINATES"),
// CONSTANT_WHEELBASE("CONSTANT_WHEELBASE"),
// DETAILED_PATH_WITH_MAX_STEERING_ANGLE("DETAILED_PATH_WITH_MAX_STEERING_ANGLE");
/**
* this variable contains the name of the entry
*/
private final String name;
// /**
// * this variable contains the name of the entry
// */
// private final String name;
/**
* constructor for a navigation entry
*
* @param name the name of the entry
*/
private NavigationEntry(String name) {
this.name = name;
}
// /**
// * constructor for a navigation entry
// *
// * @param name the name of the entry
// */
// private NavigationEntry(String name) {
// this.name = name;
// }
/**
* Getter of the name attribute
*
* @return the name of the entry
*/
public String toString() {
return this.name;
}
// /**
// * Getter of the name attribute
// *
// * @return the name of the entry
// */
// public String toString() {
// return this.name;
// }
}
/**
* (c) https://github.com/MontiCore/monticore
*
* The license generally applicable for this project
* can be found under https://github.com/MontiCore/monticore.
*/
package de.rwth.montisim.commons.dynamicinterface;
public class ArrayType extends DataType {
public static enum Dimensionality {
ARRAY,
DYNAMIC
}
public DataType baseType;
public Dimensionality dimension;
///Number of elems for "ARRAY", max size for "DYNAMIC"
public int sizeOrMaxSize;
public ArrayType(DataType baseType, Dimensionality dim, int sizeOrMaxSize){
super(DataType.Type.ARRAY, baseType.getDataSize() * sizeOrMaxSize); //Must give dataSize manually since the default super() calls getDataSize() which is invalid before setting "baseType" & "sizeOrMaxSize".
this.baseType = baseType;
this.dimension = dim;
this.sizeOrMaxSize = sizeOrMaxSize;
}
@Override
public int getDataSize(){
return baseType.getDataSize() * sizeOrMaxSize;
}
@Override
public String toString(){
if (dimension == Dimensionality.ARRAY) return "["+baseType.toString()+"; "+sizeOrMaxSize+"]";
else return "<"+baseType.toString()+"; "+sizeOrMaxSize+">";
}
// Implement hashCode & equals to be able to perform hashmap lookup by type & type comparison
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((baseType == null) ? 0 : baseType.hashCode());
result = prime * result + ((dimension == null) ? 0 : dimension.hashCode());
result = prime * result + Integer.valueOf(sizeOrMaxSize).hashCode();
return result;
}
@Override
public boolean equals(Object o){
if (o == null)
return false;
if (o == this)
return true;
if (this.getClass() != o.getClass())
return false;
ArrayType a = ((ArrayType)o);
return this.baseType.equals(a.baseType) && this.dimension.equals(a.dimension) && this.sizeOrMaxSize == a.sizeOrMaxSize;
}
}
\ No newline at end of file
/**
* (c) https://github.com/MontiCore/monticore
*
* The license generally applicable for this project
* can be found under https://github.com/MontiCore/monticore.
*/
package de.rwth.montisim.commons.dynamicinterface;
public class DataType {
public static enum Type {
DOUBLE,
INT,
STRUCT,
ARRAY
}
public Type type;
/// The virtual message size in bytes
public int dataSize;
public DataType(Type type){
this.type = type;
this.dataSize = getDataSize();
}
protected DataType(Type type, int dataSize){
this.type = type;
this.dataSize = dataSize;
}
public static DataType newDoubleType(){
return new DataType(Type.DOUBLE);
}
public static DataType newIntType(){
return new DataType(Type.INT);
}
public int getDataSize(){
switch (type){
case DOUBLE: return 8;
case INT: return 4;
default:
return -1; //Should not occur
}
}
@Override
public String toString(){
switch(type){
case DOUBLE: return "double";
case INT: return "int";
case STRUCT: return "struct";
case ARRAY: return "array";
default: return "UNKNOWN_TYPE";
}
}
@Override
public int hashCode() {
return type.hashCode();
}
@Override
public boolean equals(Object o){
if (o == null)
return false;
if (o == this)
return true;
if (this.getClass() != o.getClass())
return false;
return this.type == ((DataType)o).type;
}
}
\ No newline at end of file
/**
* (c) https://github.com/MontiCore/monticore
*
* The license generally applicable for this project
* can be found under https://github.com/MontiCore/monticore.
*/
package de.rwth.montisim.commons.dynamicinterface;
public class PortInformation {
public static enum PortDirection {
INPUT,
OUTPUT
}
private String name;
private DataType type;
private PortDirection direction;
public PortInformation(String name, DataType type, PortDirection dir){
this.name = name;
this.type = type;
this.direction = dir;
}
public String getName(){
return name;
}
public DataType getType(){
return type;
}
public PortDirection getDirection() {
return direction;
}
}
\ No newline at end of file
/**
* (c) https://github.com/MontiCore/monticore
*
* The license generally applicable for this project
* can be found under https://github.com/MontiCore/monticore.
*/
package de.rwth.montisim.commons.dynamicinterface;
import java.util.HashMap;
public class StructType extends DataType {
public String name;
public HashMap<String, DataType> components;
public StructType(String name){
super(DataType.Type.STRUCT);
this.name = name;
components = new HashMap<>();
}
/**
* Adds a field to the struct type.
* Note: takes ownership of the name and type.
*/
public void addComponent(String fieldName, DataType fieldType){
components.put(fieldName, fieldType);
}
@Override
public String toString(){
String res = name + "{ ";
boolean first = true;
for (HashMap.Entry<String, DataType> entry : components.entrySet()) {
if (first){
first = false;
} else {
res += ", ";
}
res += entry.getKey() + ": " + entry.getValue();
}
res += "}";
return res;
}
// Implement hashCode & equals to be able to perform hashmap lookup by type & type comparison
@Override
public int hashCode() {
final int prime = 31;
int result = name.hashCode();
for (HashMap.Entry<String, DataType> entry : components.entrySet()) {
result = prime * result + entry.getKey().hashCode();
result = prime * result + entry.getValue().hashCode();
}
return result;
}
@Override
public boolean equals(Object o){
if (o == null)
return false;
if (o == this)
return true;
if (this.getClass() != o.getClass())
return false;
StructType s = ((StructType)o);
if (!this.name.equals(s.name)) return false;
if (this.components.size() != s.components.size()) return false;
for (HashMap.Entry<String, DataType> entry : components.entrySet()) {
DataType t = s.components.get(entry.getKey());
if (t == null) return false;
if (!t.equals(entry.getValue())) return false;