Commit 69948b3e authored by Hengwen Zhang's avatar Hengwen Zhang
Browse files

Merge branch 'master' into feature-vehicle-task

# Conflicts:
#	pom.xml
parents dfbdce49 bef97194
Pipeline #362526 failed with stage
in 53 seconds
...@@ -13,10 +13,11 @@ public class JavaAutopilotProperties extends BusUserProperties { ...@@ -13,10 +13,11 @@ public class JavaAutopilotProperties extends BusUserProperties {
public static final String TYPE = "java_autopilot"; public static final String TYPE = "java_autopilot";
public Duration compute_time = Duration.ZERO; public Duration compute_time = Duration.ZERO;
public transient double maxVehicleAccel; public double maxVehicleAccel; // TODO get from properties system
public JavaAutopilotProperties(double maxVehicleAccel) { public JavaAutopilotProperties(double maxVehicleAccel) {
this.maxVehicleAccel = maxVehicleAccel; this.maxVehicleAccel = maxVehicleAccel;
this.name = "JavaAutopilot";
} }
protected JavaAutopilotProperties() { protected JavaAutopilotProperties() {
......
...@@ -15,7 +15,8 @@ public class TestAutopilotProperties extends BusUserProperties { ...@@ -15,7 +15,8 @@ public class TestAutopilotProperties extends BusUserProperties {
public static enum Mode { public static enum Mode {
@JsonEntry("circle") @JsonEntry("circle")
CIRCLE, @JsonEntry("start_stop") CIRCLE,
@JsonEntry("start_stop")
START_STOP START_STOP
} }
......
...@@ -30,12 +30,13 @@ public class Navigation extends EEComponent { ...@@ -30,12 +30,13 @@ public class Navigation extends EEComponent {
// Might give less points if almost at target (or none if at target) // Might give less points if almost at target (or none if at target)
public static final String TRAJECTORY_X_MSG = "trajectory_x"; public static final String TRAJECTORY_X_MSG = "trajectory_x";
public static final String TRAJECTORY_Y_MSG = "trajectory_y"; public static final String TRAJECTORY_Y_MSG = "trajectory_y";
public static final String TRAJECTORY_LENGTH_MSG = "trajectory_length";
public static final String TRAJECTORY_LON_MSG = "trajectory_lon"; public static final String TRAJECTORY_LON_MSG = "trajectory_lon";
public static final String TRAJECTORY_LAT_MSG = "trajectory_lat"; public static final String TRAJECTORY_LAT_MSG = "trajectory_lat";
public static final BasicType AT_TARGET_POS_TYPE = BasicType.BOOLEAN; public static final BasicType AT_TARGET_POS_TYPE = BasicType.BOOLEAN;
public static final BasicType CURRENT_TARGET_POS_TYPE = BasicType.VEC2; public static final BasicType CURRENT_TARGET_POS_TYPE = BasicType.VEC2;
public static final VectorType TRAJECTORY_X_TYPE = new VectorType(BasicType.DOUBLE, 128); public static final VectorType TRAJECTORY_X_TYPE = new VectorType(BasicType.DOUBLE, 10);
public static final VectorType TRAJECTORY_Y_TYPE = TRAJECTORY_X_TYPE; public static final VectorType TRAJECTORY_Y_TYPE = TRAJECTORY_X_TYPE;
public static final VectorType TRAJECTORY_LON_TYPE = TRAJECTORY_X_TYPE; public static final VectorType TRAJECTORY_LON_TYPE = TRAJECTORY_X_TYPE;
public static final VectorType TRAJECTORY_LAT_TYPE = TRAJECTORY_X_TYPE; public static final VectorType TRAJECTORY_LAT_TYPE = TRAJECTORY_X_TYPE;
...@@ -51,6 +52,7 @@ public class Navigation extends EEComponent { ...@@ -51,6 +52,7 @@ public class Navigation extends EEComponent {
transient MessageInformation trajectoryXMsg; transient MessageInformation trajectoryXMsg;
transient MessageInformation trajectoryYMsg; transient MessageInformation trajectoryYMsg;
transient MessageInformation trajectoryLengthMsg;
transient MessageInformation trajectoryLonMsg; transient MessageInformation trajectoryLonMsg;
transient MessageInformation trajectoryLatMsg; transient MessageInformation trajectoryLatMsg;
...@@ -78,6 +80,7 @@ public class Navigation extends EEComponent { ...@@ -78,6 +80,7 @@ public class Navigation extends EEComponent {
this.trajectoryXMsg = addOutput(TRAJECTORY_X_MSG, TRAJECTORY_X_TYPE); this.trajectoryXMsg = addOutput(TRAJECTORY_X_MSG, TRAJECTORY_X_TYPE);
this.trajectoryYMsg = addOutput(TRAJECTORY_Y_MSG, TRAJECTORY_Y_TYPE); this.trajectoryYMsg = addOutput(TRAJECTORY_Y_MSG, TRAJECTORY_Y_TYPE);
this.trajectoryLengthMsg = addOutput(TRAJECTORY_LENGTH_MSG, BasicType.N);
this.trajectoryLonMsg = addOutput(TRAJECTORY_LON_MSG, TRAJECTORY_LON_TYPE); this.trajectoryLonMsg = addOutput(TRAJECTORY_LON_MSG, TRAJECTORY_LON_TYPE);
this.trajectoryLatMsg = addOutput(TRAJECTORY_LAT_MSG, TRAJECTORY_LAT_TYPE); this.trajectoryLatMsg = addOutput(TRAJECTORY_LAT_MSG, TRAJECTORY_LAT_TYPE);
} }
...@@ -154,6 +157,7 @@ public class Navigation extends EEComponent { ...@@ -154,6 +157,7 @@ public class Navigation extends EEComponent {
y[i] = p.trajectoryY[index+i]; y[i] = p.trajectoryY[index+i];
} }
sendMessage(time, trajectoryXMsg, x, 8*size); sendMessage(time, trajectoryXMsg, x, 8*size);
sendMessage(time, trajectoryLengthMsg, size);
sendMessage(time.plus(Duration.ofMillis(10)), trajectoryYMsg, y, 8*size); sendMessage(time.plus(Duration.ofMillis(10)), trajectoryYMsg, y, 8*size);
} }
......
...@@ -11,7 +11,7 @@ public class NavigationProperties extends BusUserProperties { ...@@ -11,7 +11,7 @@ public class NavigationProperties extends BusUserProperties {
public static final String TYPE = "navigation"; public static final String TYPE = "navigation";
public NavigationProperties() { public NavigationProperties() {
this.name = "DefaultNavigation"; this.name = "Navigation";
} }
public NavigationProperties setName(String name) { public NavigationProperties setName(String name) {
......
...@@ -18,7 +18,7 @@ public class ActuatorProperties extends BusUserProperties { ...@@ -18,7 +18,7 @@ public class ActuatorProperties extends BusUserProperties {
public String physical_value_name; public String physical_value_name;
public double change_rate; public double change_rate = Double.POSITIVE_INFINITY;
@JsonEntry("sensor") @JsonEntry("sensor")
public Optional<SensorProperties> sensorProperties; public Optional<SensorProperties> sensorProperties;
......
...@@ -13,6 +13,10 @@ import de.rwth.montisim.simulation.eesimulator.components.EEEventProcessor; ...@@ -13,6 +13,10 @@ import de.rwth.montisim.simulation.eesimulator.components.EEEventProcessor;
public class ConstantBusProperties extends BusProperties { public class ConstantBusProperties extends BusProperties {
public static final String TYPE = "constant_bus"; public static final String TYPE = "constant_bus";
ConstantBusProperties() {
this.name = "DefaultBus";
}
public enum TransmissionMode { public enum TransmissionMode {
/** Messages directly reach their target when sent. */ /** Messages directly reach their target when sent. */
@JsonEntry("instant") @JsonEntry("instant")
...@@ -25,7 +29,7 @@ public class ConstantBusProperties extends BusProperties { ...@@ -25,7 +29,7 @@ public class ConstantBusProperties extends BusProperties {
CONSTANT_TIME CONSTANT_TIME
} }
public TransmissionMode mode; public TransmissionMode mode = TransmissionMode.INSTANT;
/** /**
* If TransmissionMode.CONSTANT_RATE, contains the transmission rate in * If TransmissionMode.CONSTANT_RATE, contains the transmission rate in
......
...@@ -4,8 +4,8 @@ package de.rwth.montisim.simulation.eesimulator; ...@@ -4,8 +4,8 @@ package de.rwth.montisim.simulation.eesimulator;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import de.rwth.montisim.commons.dynamicinterface.ArrayType;
import de.rwth.montisim.commons.dynamicinterface.BasicType; import de.rwth.montisim.commons.dynamicinterface.BasicType;
import de.rwth.montisim.commons.dynamicinterface.VectorType;
import de.rwth.montisim.commons.eventsimulation.DiscreteEventSimulator; import de.rwth.montisim.commons.eventsimulation.DiscreteEventSimulator;
import de.rwth.montisim.simulation.eesimulator.bridge.Bridge; import de.rwth.montisim.simulation.eesimulator.bridge.Bridge;
import de.rwth.montisim.simulation.eesimulator.bridge.BridgeProperties; import de.rwth.montisim.simulation.eesimulator.bridge.BridgeProperties;
...@@ -138,7 +138,7 @@ public class SetupErrorsTest { ...@@ -138,7 +138,7 @@ public class SetupErrorsTest {
++errorsFound; ++errorsFound;
} }
try { try {
c3.addInput("m1", new ArrayType(BasicType.INT, 5)); c3.addInput("m1", new VectorType(BasicType.INT, 5));
} catch (EEMessageTypeException e){ } catch (EEMessageTypeException e){
++errorsFound; ++errorsFound;
} }
......
...@@ -7,7 +7,6 @@ import java.util.Vector; ...@@ -7,7 +7,6 @@ import java.util.Vector;
import de.rwth.montisim.commons.map.Pathfinding; import de.rwth.montisim.commons.map.Pathfinding;
import de.rwth.montisim.commons.simulation.*; import de.rwth.montisim.commons.simulation.*;
import de.rwth.montisim.commons.utils.json.Json; import de.rwth.montisim.commons.utils.json.Json;
import de.rwth.montisim.commons.utils.json.SerializationException;
import de.rwth.montisim.simulation.eecomponents.autopilots.JavaAutopilotProperties; import de.rwth.montisim.simulation.eecomponents.autopilots.JavaAutopilotProperties;
import de.rwth.montisim.simulation.eecomponents.autopilots.TestAutopilotProperties; import de.rwth.montisim.simulation.eecomponents.autopilots.TestAutopilotProperties;
import de.rwth.montisim.simulation.eecomponents.navigation.NavigationProperties; import de.rwth.montisim.simulation.eecomponents.navigation.NavigationProperties;
...@@ -174,14 +173,9 @@ public class Simulator implements ISimulator, Updatable { ...@@ -174,14 +173,9 @@ public class Simulator implements ISimulator, Updatable {
} }
static { static {
try { Json.registerType(NavigationProperties.class);
Json.registerType(NavigationProperties.class); Json.registerType(JavaAutopilotProperties.class);
Json.registerType(JavaAutopilotProperties.class); Json.registerType(TestAutopilotProperties.class);
Json.registerType(TestAutopilotProperties.class);
} catch (SerializationException e) {
e.printStackTrace();
System.exit(-1);
}
} }
public Vector<Updatable> getUpdatables() { public Vector<Updatable> getUpdatables() {
......
...@@ -25,7 +25,6 @@ public class PhysicsDebug extends JFrame implements SimulationRunner { ...@@ -25,7 +25,6 @@ public class PhysicsDebug extends JFrame implements SimulationRunner {
} }
private static final Vec3 START_DIR = new Vec3(1, 0, 0); private static final Vec3 START_DIR = new Vec3(1, 0, 0);
private static final Vec3 START_CROSS = new Vec3(0, 1, 0);
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
...@@ -3,7 +3,6 @@ package de.rwth.montisim.simulation.simulator.visualization; ...@@ -3,7 +3,6 @@ package de.rwth.montisim.simulation.simulator.visualization;
import javax.swing.*; import javax.swing.*;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.event.*;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Files; import java.nio.file.Files;
......
...@@ -3,18 +3,11 @@ package de.rwth.montisim.simulation.simulator.visualization.plotter; ...@@ -3,18 +3,11 @@ package de.rwth.montisim.simulation.simulator.visualization.plotter;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.RenderingHints; import java.awt.RenderingHints;
import java.awt.event.MouseEvent;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale;
import javax.swing.JPanel; import javax.swing.JPanel;
...@@ -88,8 +81,8 @@ public class TimePlotter extends JPanel { ...@@ -88,8 +81,8 @@ public class TimePlotter extends JPanel {
private int drawLegend(Graphics2D g) { private int drawLegend(Graphics2D g) {
// Get legend size // Get legend size
final int height = g.getFont().getSize(); //final int height = g.getFont().getSize();
final int offset = height + UIInfo.LINE_SPACE; //final int offset = height + UIInfo.LINE_SPACE;
int size = 0; int size = 0;
// Draw legend // Draw legend
return size; return size;
......
/* (c) https://github.com/MontiCore/monticore */ /* (c) https://github.com/MontiCore/monticore */
package de.rwth.montisim.simulation.simulator.visualization.ui; package de.rwth.montisim.simulation.simulator.visualization.ui;
import java.time.Instant;
import de.rwth.montisim.commons.simulation.Updatable; import de.rwth.montisim.commons.simulation.Updatable;
public interface SimulationRunner extends Updatable { public interface SimulationRunner extends Updatable {
......
...@@ -24,13 +24,13 @@ import de.rwth.montisim.commons.utils.*; ...@@ -24,13 +24,13 @@ import de.rwth.montisim.commons.utils.*;
*/ */
public class Viewer2D extends JPanel implements MouseInputListener, MouseWheelListener { public class Viewer2D extends JPanel implements MouseInputListener, MouseWheelListener {
private static final long serialVersionUID = 4687042051904715366L; private static final long serialVersionUID = 4687042051904715366L;
private static final ImageIcon a; // private static final ImageIcon a;
static { // static {
java.net.URL imgURL = Control.class.getResource("/images/a.gif"); // java.net.URL imgURL = Control.class.getResource("/images/a.gif");
if (imgURL != null) // if (imgURL != null)
a = new ImageIcon(imgURL); // a = new ImageIcon(imgURL);
else a = null; // else a = null;
} // }
private static final DecimalFormat format = new DecimalFormat("##0.00", private static final DecimalFormat format = new DecimalFormat("##0.00",
DecimalFormatSymbols.getInstance(Locale.ENGLISH)); DecimalFormatSymbols.getInstance(Locale.ENGLISH));
......
...@@ -137,12 +137,7 @@ public class VehicleBuilder { ...@@ -137,12 +137,7 @@ public class VehicleBuilder {
} }
static { static {
try { Json.registerType(ElectricalPTProperties.class);
Json.registerType(ElectricalPTProperties.class); Json.registerType(FuelPTProperties.class);
Json.registerType(FuelPTProperties.class);
} catch (SerializationException e) {
e.printStackTrace();
System.exit(-1);
}
} }
} }
\ No newline at end of file
/* (c) https://github.com/MontiCore/monticore */ /* (c) https://github.com/MontiCore/monticore */
package de.rwth.montisim.simulation.vehicle.physicalvalues; package de.rwth.montisim.simulation.vehicle.physicalvalues;
import de.rwth.montisim.commons.dynamicinterface.BasicType;
import de.rwth.montisim.commons.dynamicinterface.DataType;
import de.rwth.montisim.commons.physicalvalue.PhysicalValueDouble; import de.rwth.montisim.commons.physicalvalue.PhysicalValueDouble;
import de.rwth.montisim.commons.simulation.*; import de.rwth.montisim.commons.simulation.*;
import de.rwth.montisim.commons.utils.*; import de.rwth.montisim.commons.utils.*;
......
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