This commit is contained in:
xuzhiheng
2025-06-05 12:21:31 +08:00
parent 8c508f3a74
commit 503771fe7c
64 changed files with 2911 additions and 537 deletions

View File

@@ -26,6 +26,8 @@ dependencies {
implementation group: 'de.huxhorn.sulky', name: 'de.huxhorn.sulky.ulid', version: '8.3.0'
runtimeOnly group: 'org.slf4j', name: 'slf4j-jdk14', version: '2.0.16'
//fastjson
implementation 'com.alibaba:fastjson:1.2.83'
}
distributions {
@@ -47,6 +49,14 @@ task release {
dependsOn installDist
}
tasks.withType(JavaCompile){
options.encoding="utf-8"
}
tasks.withType(Javadoc){
options.encoding="utf-8"
}
run {
systemProperties(['java.util.logging.config.file':'./config/logging.config',\
'opentcs.base':'.',\

View File

@@ -7,6 +7,7 @@ import static java.util.Objects.requireNonNull;
import com.google.common.util.concurrent.Uninterruptibles;
import com.google.inject.Provider;
import jakarta.inject.Inject;
import java.io.IOException;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
@@ -17,11 +18,13 @@ import org.opentcs.access.Kernel;
import org.opentcs.access.Kernel.State;
import org.opentcs.access.KernelStateTransitionEvent;
import org.opentcs.access.LocalKernel;
import org.opentcs.communication.mqtt.MqttBrokerServer;
import org.opentcs.components.kernel.KernelExtension;
import org.opentcs.components.kernel.services.NotificationService;
import org.opentcs.customizations.ApplicationEventBus;
import org.opentcs.customizations.kernel.KernelExecutor;
import org.opentcs.data.notification.UserNotification;
import org.opentcs.manage.AdapterManage;
import org.opentcs.util.event.EventBus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -70,6 +73,14 @@ public class StandardKernel
* The kernel implementing the actual functionality for the current mode.
*/
private KernelState kernelState;
/**
* MQTT 服务
*/
private MqttBrokerServer mqttBrokerServer = new MqttBrokerServer();
/**
* 通讯适配器管理类
*/
private AdapterManage adapterManage = new AdapterManage();
/**
* Creates a new kernel.
@@ -108,6 +119,13 @@ public class StandardKernel
// Initial state is modelling.
setState(State.MODELLING);
//开启MQTT服务
// mqttBrokerServer.startMqtt();
//开启通讯适配器自动管理
adapterManage.START();
LOG.info("Communication adapter auto management started successfully");
initialized = true;
LOG.debug("Starting kernel thread");
Thread kernelThread = new Thread(this, "kernelThread");
@@ -127,6 +145,13 @@ public class StandardKernel
// Note that the actual shutdown of extensions should happen when the kernel
// thread (see run()) finishes, not here.
// Set the terminated flag and wake up this kernel's thread for termination.
//关闭MQTT服务
// mqttBrokerServer.stopMqtt();
//关闭通讯适配器管理类
adapterManage.STOP();
initialized = false;
terminationSemaphore.release();
}

View File

@@ -51,6 +51,8 @@ import org.opentcs.data.order.TransportOrder;
import org.opentcs.data.peripherals.PeripheralJob;
import org.opentcs.data.peripherals.PeripheralOperation;
import org.opentcs.drivers.vehicle.LoadHandlingDevice;
import org.opentcs.park.ParkStrategy;
import org.opentcs.park.entity.Park;
import org.opentcs.util.event.EventHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -1383,6 +1385,14 @@ public class PlantModelManager
private Point createPoint(PointCreationTO to)
throws ObjectExistsException {
// Get a unique ID for the new point and create an instance.
if (to.getType() == Point.Type.PARK_POSITION) {
//是休息点,记录
Park park = new Park();
park.setName(to.getName());
park.setStatus(false);
ParkStrategy.setPark(park);
}
Point newPoint = new Point(to.getName())
.withPose(new Pose(to.getPose().getPosition(), to.getPose().getOrientationAngle()))
.withType(to.getType())
@@ -1500,6 +1510,7 @@ public class PlantModelManager
throws ObjectUnknownException,
ObjectExistsException {
LocationType type = getObjectRepo().getObject(LocationType.class, to.getTypeName());
System.out.println("test print location:" + to.getName() + ", type:" + type.getName());
Location newLocation = new Location(to.getName(), type.getReference())
.withPosition(to.getPosition())
.withLocked(to.isLocked())