Die Migration der Bereiche "Docker Registry" und "Artifiacts" ist fast abgeschlossen. Die letzten Daten werden im Laufe des heutigen Abend (05.08.2021) noch vollständig hochgeladen. Das Anlegen neuer Images und Artifacts funktioniert bereits wieder.

Commit 5d11c0ed authored by Hengwen Zhang's avatar Hengwen Zhang
Browse files

Move task attribute into VehicleProperties class.

parent 6b03e2f5
......@@ -14,6 +14,7 @@ import de.rwth.montisim.simulation.vehicle.powertrain.electrical.ElectricalPTPro
import de.rwth.montisim.simulation.vehicle.powertrain.electrical.battery.BatteryProperties;
import de.rwth.montisim.simulation.vehicle.powertrain.electrical.battery.BatteryProperties.BatteryType;
import de.rwth.montisim.simulation.vehicle.powertrain.electrical.motor.ElectricMotorProperties;
import de.rwth.montisim.simulation.vehicle.task.Task;
public class DefaultVehicleConfig {
public final VehicleProperties properties;
......@@ -87,4 +88,9 @@ public class DefaultVehicleConfig {
return this;
}
public DefaultVehicleConfig setTask(Task task) {
this.properties.setTask(task);
return this;
}
}
\ No newline at end of file
......@@ -9,10 +9,8 @@ import de.rwth.montisim.commons.simulation.TimeUpdate;
import de.rwth.montisim.simulation.vehicle.VehicleBuilder;
import de.rwth.montisim.simulation.vehicle.VehicleProperties;
import de.rwth.montisim.simulation.vehicle.task.Task;
import de.rwth.montisim.simulation.vehicle.task.goal.GoalBuilder;
import de.rwth.montisim.simulation.vehicle.task.goal.MetricGoal;
import de.rwth.montisim.simulation.vehicle.task.goal.PathGoal;
import de.rwth.montisim.simulation.vehicle.task.goal.VehicleProperty;
import org.junit.*;
import de.rwth.montisim.commons.map.Pathfinding;
......@@ -42,9 +40,6 @@ public class IntegrationTest {
Simulator simulator = new Simulator(config, world, pathfinding, mtManager);
SimulationLoop loop = new SimulationLoop(simulator, config);
DefaultVehicleConfig vConf = DefaultVehicleConfig.withJavaAutopilot();
Vehicle vehicle = simulator.getVehicleBuilder(vConf.properties).setName("TestVehicle").build();
Task task = new Task();
task.addGoal(PathGoal.newBuilder()
.eventually()
......@@ -52,11 +47,13 @@ public class IntegrationTest {
.withInRange(10)
.build());
task.addGoal(MetricGoal.newBuilder()
.setProperty(VehicleProperty.SPEED)
.setProperty("speed")
.never()
.greater(1000, "m/s")
.build());
vehicle.setTask(task);
DefaultVehicleConfig vConf = DefaultVehicleConfig.withJavaAutopilot().setTask(task);
Vehicle vehicle = simulator.getVehicleBuilder(vConf.properties).setName("TestVehicle").build();
vehicle.physicsModel.setGroundPosition(new Vec3(0, 0, 0), new Vec2(START_DIR.x, START_DIR.y));
......
......@@ -113,12 +113,19 @@ public class Vehicle extends SimulationObject implements Updatable, Destroyable,
return w.getString();
}
public void setTask(Task task) {
this.task = task;
}
public Task getTask() {
return task;
}
/**
* For tests
*
* @return
*/
public PhysicalValueRegistry getPhysicalValues() {
return physicalValues;
}
}
\ No newline at end of file
/* (c) https://github.com/MontiCore/monticore */
package de.rwth.montisim.simulation.vehicle;
import java.util.Objects;
import java.util.Optional;
import java.util.Vector;
......@@ -23,6 +24,7 @@ import de.rwth.montisim.simulation.vehicle.physicsmodel.PhysicsProperties;
import de.rwth.montisim.simulation.vehicle.physicsmodel.rigidbody.RigidbodyPhysicsProperties;
import de.rwth.montisim.simulation.vehicle.powertrain.PowerTrainProperties;
import de.rwth.montisim.simulation.vehicle.powertrain.electrical.ElectricalPTProperties;
import de.rwth.montisim.simulation.vehicle.task.Task;
/**
* General properties of the Vehicle. All lengths are given in Meters. All
......@@ -46,6 +48,8 @@ public class VehicleProperties /* implements JsonSerializable */ {
public Vec2 start_coords = new Vec2();
public Vec2 end_coords;
public Task task;
public VehicleProperties(){
body = new BodyProperties();
wheels = new WheelProperties();
......@@ -118,6 +122,10 @@ public class VehicleProperties /* implements JsonSerializable */ {
components.add(properties);
}
public void setTask(Task task) {
this.task = task;
}
public static class BuildContext {
public final MessageTypeManager mtManager;
public final Pathfinding pathfinding;
......@@ -174,6 +182,9 @@ public class VehicleProperties /* implements JsonSerializable */ {
target.powerTrain.steeringActuator = cm.getActuator(PowerTrainProperties.STEERING_ACTUATOR_NAME).get();
target.eesystem.finalizeSetup();
Objects.requireNonNull(task);
target.task = task;
return target;
}
......
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