Skip to content

Commit

Permalink
Update openTCS dependency to 5.17.1
Browse files Browse the repository at this point in the history
Co-authored-by: Stefan Walter <stefan.walter@iml.fraunhofer.de>
Merged-by: Stefan Walter <stefan.walter@iml.fraunhofer.de>
  • Loading branch information
sebo001 and swltr committed Aug 6, 2024
1 parent 0c767ce commit 89b8ac1
Show file tree
Hide file tree
Showing 17 changed files with 163 additions and 75 deletions.
2 changes: 1 addition & 1 deletion gradle/dependency-versions.gradle
Original file line number Diff line number Diff line change
@@ -1 +1 @@
project.ext.openTcsBaselineVersion = '5.11.0'
project.ext.openTcsBaselineVersion = '5.17.1'
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ public CommAdapterImpl(
super(
new ProcessModelImpl(vehicle),
getPropertyInteger(PROPKEY_VEHICLE_MAX_STEPS_BASE, vehicle).orElse(2) + 1,
getPropertyInteger(PROPKEY_VEHICLE_MAX_STEPS_BASE, vehicle).orElse(2),
getProperty(PROPKEY_VEHICLE_RECHARGE_OPERATION, vehicle)
.orElse(DestinationOperations.CHARGE),
kernelExecutor
Expand Down Expand Up @@ -264,11 +263,11 @@ public CommAdapterImpl(
public void initialize() {
super.initialize();
orderMapper = componentsFactory.createOrderMapper(
getProcessModel().getVehicleReference(),
getProcessModel().getReference(),
isActionExecutable
);
vehiclePositionResolver = componentsFactory.createVehiclePositionResolver(
getProcessModel().getVehicleReference()
getProcessModel().getReference()
);
}

Expand Down Expand Up @@ -372,7 +371,7 @@ public final ProcessModelImpl getProcessModel() {
@Override
protected VehicleProcessModelTO createCustomTransferableProcessModel() {
return new ProcessModelImplTO()
.setVehicleRef(getProcessModel().getVehicleReference())
.setVehicleRef(getProcessModel().getReference())
.setCurrentState(getProcessModel().getCurrentState())
.setPreviousState(getProcessModel().getPreviousState())
.setLastOrderSent(getProcessModel().getLastOrderSent())
Expand All @@ -398,7 +397,7 @@ public synchronized void sendCommand(MovementCommand cmd)
public boolean canAcceptNextCommand() {
return super.canAcceptNextCommand() && distanceInAdvanceController.canAcceptNextCommand(
Stream
.concat(getCommandQueue().stream(), getSentQueue().stream())
.concat(getUnsentCommands().stream(), getSentCommands().stream())
.collect(Collectors.toList())
);
}
Expand Down Expand Up @@ -483,7 +482,7 @@ public void onDisconnect() {
getProcessModel().setBrokerConnected(false);
getProcessModel().setCommAdapterConnected(false);
getProcessModel().setVehicleIdle(true);
getProcessModel().setVehicleState(Vehicle.State.UNKNOWN);
getProcessModel().setState(Vehicle.State.UNKNOWN);
});
}

Expand Down Expand Up @@ -575,11 +574,11 @@ private void onConnectionMessage(Connection message) {
if (message.getConnectionState() == ConnectionState.OFFLINE
|| message.getConnectionState() == ConnectionState.CONNECTIONBROKEN) {
getProcessModel().setCommAdapterConnected(false);
getProcessModel().setVehicleState(Vehicle.State.UNKNOWN);
getProcessModel().setState(Vehicle.State.UNKNOWN);
}
else if (message.getConnectionState() == ConnectionState.ONLINE) {
getProcessModel().setCommAdapterConnected(true);
getProcessModel().setVehicleState(Vehicle.State.IDLE);
getProcessModel().setState(Vehicle.State.IDLE);
}
getProcessModel().setCurrentConnection(message);
}
Expand All @@ -596,41 +595,41 @@ private void onStateMessage(State state) {
getProcessModel().setCurrentState(state);

String newVehiclePosition = vehiclePositionResolver.resolveVehiclePosition(
getProcessModel().getVehiclePosition(), getProcessModel().getCurrentState()
getProcessModel().getPosition(), getProcessModel().getCurrentState()
);
if (!Objects.equals(newVehiclePosition, getProcessModel().getVehiclePosition())) {
if (!Objects.equals(newVehiclePosition, getProcessModel().getPosition())) {
LOG.debug("{}: Vehicle is now at point {}", getName(), newVehiclePosition);
getProcessModel().setVehiclePosition(newVehiclePosition);
getProcessModel().setPosition(newVehiclePosition);
}

if (state.getAgvPosition() != null) {
processVehiclePosition(state.getAgvPosition());
}

getProcessModel().setVehicleLoadHandlingDevices(toLoadHandlingDevices(state));
getProcessModel().setVehicleEnergyLevel(state.getBatteryState().getBatteryCharge().intValue());
getProcessModel().setVehicleProperty(
getProcessModel().setLoadHandlingDevices(toLoadHandlingDevices(state));
getProcessModel().setEnergyLevel(state.getBatteryState().getBatteryCharge().intValue());
getProcessModel().setProperty(
PROPKEY_VEHICLE_ERRORS_FATAL,
StateMappings.toErrorPropertyValue(state, ErrorLevel.FATAL)
);
getProcessModel().setVehicleProperty(
getProcessModel().setProperty(
PROPKEY_VEHICLE_ERRORS_WARNING,
StateMappings.toErrorPropertyValue(state, ErrorLevel.WARNING)
);
getProcessModel().setVehicleProperty(
getProcessModel().setProperty(
PROPKEY_VEHICLE_INFORMATIONS_INFO,
StateMappings.toInfoPropertyValue(state, InfoLevel.INFO)
);
getProcessModel().setVehicleProperty(
getProcessModel().setProperty(
PROPKEY_VEHICLE_INFORMATIONS_DEBUG,
StateMappings.toInfoPropertyValue(state, InfoLevel.DEBUG)
);
getProcessModel().setVehicleProperty(
getProcessModel().setProperty(
PROPKEY_VEHICLE_PAUSED,
StateMappings.toPausedPropertyValue(state)
);
getProcessModel().setVehicleState(toVehicleState(state));
getProcessModel().setVehicleLength(
getProcessModel().setState(toVehicleState(state));
getProcessModel().setLength(
toVehicleLength(state, vehicleLengthUnloaded, vehicleLengthLoaded)
);

Expand All @@ -643,9 +642,9 @@ private void onMovementCommandExecuted(@Nonnull
MovementCommand finishedCommand) {
requireNonNull(finishedCommand, "finishedCommand");

MovementCommand oldestCommand = getSentQueue().peek();
MovementCommand oldestCommand = getSentCommands().peek();
if (Objects.equals(finishedCommand, oldestCommand)) {
getSentQueue().poll();
getSentCommands().poll();
getProcessModel().commandExecuted(oldestCommand);
}
else {
Expand All @@ -670,7 +669,7 @@ private void processVehicleOperatingMode(State state) {
getName(),
state.getOperatingMode()
);
getProcessModel().setVehiclePosition(null);
getProcessModel().setPosition(null);
}

configuration.onOpModeChangeDoUpdateIntegrationLevel()
Expand Down Expand Up @@ -704,14 +703,14 @@ private ConfigOperatingMode mapToConfigOperatingMode(OperatingMode opMode) {
}

private void processVehiclePosition(AgvPosition position) {
getProcessModel().setVehiclePrecisePosition(
getProcessModel().setPrecisePosition(
new Triple(
(long) (position.getX() * 1000.0),
(long) (position.getY() * 1000.0),
0
)
);
getProcessModel().setVehicleOrientationAngle(Math.toDegrees(position.getTheta()));
getProcessModel().setOrientationAngle(Math.toDegrees(position.getTheta()));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public static Optional<PropertyAction> fromMovementCommand(
requireNonNull(destinationLocation, "destinationLocation");
requireNonNull(destinationType, "destinationType");

if (command.isWithoutOperation()) {
if (command.hasEmptyOperation()) {
return Optional.empty();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ private Optional<PropertyAction> movementCommandPropAction(
@Nonnull
Vehicle vehicle
) {
if (command.isWithoutOperation() || command.getOpLocation() == null) {
if (command.hasEmptyOperation() || command.getOpLocation() == null) {
return Optional.empty();
}

Expand Down Expand Up @@ -350,12 +350,12 @@ private void mapHorizon(Order order, MovementCommand command, Vehicle vehicle) {
int maxRouteIndex = Math.min(
command.getStep().getRouteIndex()
+ getPropertyInteger(ObjectProperties.PROPKEY_VEHICLE_MAX_STEPS_HORIZON, vehicle)
.orElse(command.getRoute().getSteps().size()),
command.getRoute().getSteps().size()
.orElse(command.getDriveOrder().getRoute().getSteps().size()),
command.getDriveOrder().getRoute().getSteps().size()
);

for (int i = command.getStep().getRouteIndex() + 1; i < maxRouteIndex; i++) {
Step step = command.getRoute().getSteps().get(i);
Step step = command.getDriveOrder().getRoute().getSteps().get(i);

order.getEdges().add(mapHorizonEdge(command, step, vehicle));

Expand Down Expand Up @@ -407,7 +407,7 @@ private Node mapHorizonNode(
command,
vehicle,
step,
step.getRouteIndex() == command.getRoute().getSteps().size() - 1
step.getRouteIndex() == command.getDriveOrder().getRoute().getSteps().size() - 1
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ public CommAdapterImpl(
super(
new ProcessModelImpl(vehicle),
getPropertyInteger(PROPKEY_VEHICLE_MAX_STEPS_BASE, vehicle).orElse(2) + 1,
getPropertyInteger(PROPKEY_VEHICLE_MAX_STEPS_BASE, vehicle).orElse(2),
getProperty(PROPKEY_VEHICLE_RECHARGE_OPERATION, vehicle)
.orElse(DestinationOperations.CHARGE),
kernelExecutor
Expand Down Expand Up @@ -265,11 +264,11 @@ public CommAdapterImpl(
public void initialize() {
super.initialize();
orderMapper = componentsFactory.createOrderMapper(
getProcessModel().getVehicleReference(),
getProcessModel().getReference(),
isActionExecutable
);
vehiclePositionResolver = componentsFactory.createVehiclePositionResolver(
getProcessModel().getVehicleReference()
getProcessModel().getReference()
);
}

Expand Down Expand Up @@ -377,7 +376,7 @@ public final ProcessModelImpl getProcessModel() {
@Override
protected VehicleProcessModelTO createCustomTransferableProcessModel() {
return new ProcessModelImplTO()
.setVehicleRef(getProcessModel().getVehicleReference())
.setVehicleRef(getProcessModel().getReference())
.setCurrentState(getProcessModel().getCurrentState())
.setPreviousState(getProcessModel().getPreviousState())
.setLastOrderSent(getProcessModel().getLastOrderSent())
Expand All @@ -403,7 +402,7 @@ public synchronized void sendCommand(MovementCommand cmd)
public boolean canAcceptNextCommand() {
return super.canAcceptNextCommand() && distanceInAdvanceController.canAcceptNextCommand(
Stream
.concat(getCommandQueue().stream(), getSentQueue().stream())
.concat(getUnsentCommands().stream(), getSentCommands().stream())
.collect(Collectors.toList())
);
}
Expand Down Expand Up @@ -488,7 +487,7 @@ public void onDisconnect() {
getProcessModel().setBrokerConnected(false);
getProcessModel().setCommAdapterConnected(false);
getProcessModel().setVehicleIdle(true);
getProcessModel().setVehicleState(Vehicle.State.UNKNOWN);
getProcessModel().setState(Vehicle.State.UNKNOWN);
});
}

Expand Down Expand Up @@ -583,11 +582,11 @@ private void onConnectionMessage(Connection message) {
if (message.getConnectionState() == ConnectionState.OFFLINE
|| message.getConnectionState() == ConnectionState.CONNECTIONBROKEN) {
getProcessModel().setCommAdapterConnected(false);
getProcessModel().setVehicleState(Vehicle.State.UNKNOWN);
getProcessModel().setState(Vehicle.State.UNKNOWN);
}
else if (message.getConnectionState() == ConnectionState.ONLINE) {
getProcessModel().setCommAdapterConnected(true);
getProcessModel().setVehicleState(Vehicle.State.IDLE);
getProcessModel().setState(Vehicle.State.IDLE);
}
getProcessModel().setCurrentConnection(message);
}
Expand All @@ -604,41 +603,41 @@ private void onStateMessage(State state) {
getProcessModel().setCurrentState(state);

String newVehiclePosition = vehiclePositionResolver.resolveVehiclePosition(
getProcessModel().getVehiclePosition(), getProcessModel().getCurrentState()
getProcessModel().getPosition(), getProcessModel().getCurrentState()
);
if (!Objects.equals(newVehiclePosition, getProcessModel().getVehiclePosition())) {
if (!Objects.equals(newVehiclePosition, getProcessModel().getPosition())) {
LOG.debug("{}: Vehicle is now at point {}", getName(), newVehiclePosition);
getProcessModel().setVehiclePosition(newVehiclePosition);
getProcessModel().setPosition(newVehiclePosition);
}

if (state.getAgvPosition() != null) {
processVehiclePosition(state.getAgvPosition());
}

getProcessModel().setVehicleLoadHandlingDevices(toLoadHandlingDevices(state));
getProcessModel().setVehicleEnergyLevel(state.getBatteryState().getBatteryCharge().intValue());
getProcessModel().setVehicleProperty(
getProcessModel().setLoadHandlingDevices(toLoadHandlingDevices(state));
getProcessModel().setEnergyLevel(state.getBatteryState().getBatteryCharge().intValue());
getProcessModel().setProperty(
PROPKEY_VEHICLE_ERRORS_FATAL,
StateMappings.toErrorPropertyValue(state, ErrorLevel.FATAL)
);
getProcessModel().setVehicleProperty(
getProcessModel().setProperty(
PROPKEY_VEHICLE_ERRORS_WARNING,
StateMappings.toErrorPropertyValue(state, ErrorLevel.WARNING)
);
getProcessModel().setVehicleProperty(
getProcessModel().setProperty(
PROPKEY_VEHICLE_INFORMATION_INFO,
StateMappings.toInfoPropertyValue(state, InfoLevel.INFO)
);
getProcessModel().setVehicleProperty(
getProcessModel().setProperty(
PROPKEY_VEHICLE_INFORMATION_DEBUG,
StateMappings.toInfoPropertyValue(state, InfoLevel.DEBUG)
);
getProcessModel().setVehicleProperty(
getProcessModel().setProperty(
PROPKEY_VEHICLE_PAUSED,
StateMappings.toPausedPropertyValue(state)
);
getProcessModel().setVehicleState(toVehicleState(state));
getProcessModel().setVehicleLength(
getProcessModel().setState(toVehicleState(state));
getProcessModel().setLength(
toVehicleLength(state, vehicleLengthUnloaded, vehicleLengthLoaded)
);

Expand All @@ -653,9 +652,9 @@ private void onMovementCommandExecuted(
) {
requireNonNull(finishedCommand, "finishedCommand");

MovementCommand oldestCommand = getSentQueue().peek();
MovementCommand oldestCommand = getSentCommands().peek();
if (Objects.equals(finishedCommand, oldestCommand)) {
getSentQueue().poll();
getSentCommands().poll();
getProcessModel().commandExecuted(oldestCommand);
}
else {
Expand All @@ -680,7 +679,7 @@ private void processVehicleOperatingMode(State state) {
getName(),
state.getOperatingMode()
);
getProcessModel().setVehiclePosition(null);
getProcessModel().setPosition(null);
}

configuration.onOpModeChangeDoUpdateIntegrationLevel()
Expand Down Expand Up @@ -714,14 +713,14 @@ private ConfigOperatingMode mapToConfigOperatingMode(OperatingMode opMode) {
}

private void processVehiclePosition(AgvPosition position) {
getProcessModel().setVehiclePrecisePosition(
getProcessModel().setPrecisePosition(
new Triple(
(long) (position.getX() * 1000.0),
(long) (position.getY() * 1000.0),
0
)
);
getProcessModel().setVehicleOrientationAngle(Math.toDegrees(position.getTheta()));
getProcessModel().setOrientationAngle(Math.toDegrees(position.getTheta()));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public static Optional<PropertyAction> fromMovementCommand(
requireNonNull(destinationLocation, "destinationLocation");
requireNonNull(destinationType, "destinationType");

if (command.isWithoutOperation()) {
if (command.hasEmptyOperation()) {
return Optional.empty();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ private Optional<PropertyAction> movementCommandPropAction(
@Nonnull
Vehicle vehicle
) {
if (command.isWithoutOperation() || command.getOpLocation() == null) {
if (command.hasEmptyOperation() || command.getOpLocation() == null) {
return Optional.empty();
}

Expand Down Expand Up @@ -350,12 +350,12 @@ private void mapHorizon(Order order, MovementCommand command, Vehicle vehicle) {
int maxRouteIndex = Math.min(
command.getStep().getRouteIndex()
+ getPropertyInteger(ObjectProperties.PROPKEY_VEHICLE_MAX_STEPS_HORIZON, vehicle)
.orElse(command.getRoute().getSteps().size()),
command.getRoute().getSteps().size()
.orElse(command.getDriveOrder().getRoute().getSteps().size()),
command.getDriveOrder().getRoute().getSteps().size()
);

for (int i = command.getStep().getRouteIndex() + 1; i < maxRouteIndex; i++) {
Step step = command.getRoute().getSteps().get(i);
Step step = command.getDriveOrder().getRoute().getSteps().get(i);

order.getEdges().add(mapHorizonEdge(command, step, vehicle));

Expand Down Expand Up @@ -407,7 +407,7 @@ private Node mapHorizonNode(
command,
vehicle,
step,
step.getRouteIndex() == command.getRoute().getSteps().size() - 1
step.getRouteIndex() == command.getDriveOrder().getRoute().getSteps().size() - 1
)
);
}
Expand Down
Loading

0 comments on commit 89b8ac1

Please sign in to comment.