Procházet zdrojové kódy

保存云台数据

shiwn před 4 měsíci
rodič
revize
381b19ea67

+ 58 - 0
src/main/java/com/sw/patroleditor/domain/dto/AimDTO.java

@@ -0,0 +1,58 @@
+package com.sw.patroleditor.domain.dto;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+/**
+ * Created by shiwn on 2024/7/30 10:53
+ */
+@Data
+@TableName("aim")
+public class AimDTO {
+    private Long id;
+    /**
+     * 云台滚转角
+     */
+    private Integer roll;
+    /**
+     * 云台俯仰角
+     */
+    private Integer pitch;
+    /**
+     * 云台方位角
+     */
+    private Integer yaw;
+    /**
+     * ???
+     */
+    private Integer height;
+    /**
+     * 云台焦距
+     */
+    private Integer focus;
+    /**
+     * 云台放大倍数
+     */
+    private Integer ratio;
+    /**
+     * 云台光圈大小
+     */
+    private Integer aperture;
+
+    /**
+     * 目标框选左上角X坐标
+     */
+    private Integer topleftX;
+    /**
+     * 目标框选左上角Y坐标
+     */
+    private Integer topleftY;
+    /**
+     * 目标框选右下角X坐标
+     */
+    private Integer botrightX;
+    /**
+     * 目标框选右下角Y坐标
+     */
+    private Integer botrightY;
+}

+ 54 - 0
src/main/java/com/sw/patroleditor/domain/dto/ZoominDTO.java

@@ -0,0 +1,54 @@
+package com.sw.patroleditor.domain.dto;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+/**
+ * Created by shiwn on 2024/7/30 10:53
+ */
+@Data
+@TableName("zoomin")
+public class ZoominDTO {
+    private Long id;
+    /**
+     * 云台滚转角
+     */
+    private Integer roll;
+    /**
+     * 云台俯仰角
+     */
+    private Integer pitch;
+    /**
+     * 云台方位角
+     */
+    private Integer yaw;
+    /**
+     * 云台焦距
+     */
+    private Integer focus;
+    /**
+     * 云台放大倍数
+     */
+    private Integer ratio;
+    /**
+     * 云台光圈大小
+     */
+    private Integer aperture;
+
+    /**
+     * 目标框选左上角X坐标
+     */
+    private Integer topleftX;
+    /**
+     * 目标框选左上角Y坐标
+     */
+    private Integer topleftY;
+    /**
+     * 目标框选右下角X坐标
+     */
+    private Integer botrightX;
+    /**
+     * 目标框选右下角Y坐标
+     */
+    private Integer botrightY;
+}

+ 12 - 0
src/main/java/com/sw/patroleditor/mapper/AimMapper.java

@@ -0,0 +1,12 @@
+package com.sw.patroleditor.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.sw.patroleditor.domain.dto.AimDTO;
+import org.springframework.stereotype.Component;
+
+/**
+ * Created by shiwn on 2024/7/30 10:59
+ */
+@Component
+public interface AimMapper extends BaseMapper<AimDTO> {
+}

+ 12 - 0
src/main/java/com/sw/patroleditor/mapper/ZoominMapper.java

@@ -0,0 +1,12 @@
+package com.sw.patroleditor.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.sw.patroleditor.domain.dto.ZoominDTO;
+import org.springframework.stereotype.Component;
+
+/**
+ * Created by shiwn on 2024/7/30 10:58
+ */
+@Component
+public interface ZoominMapper extends BaseMapper<ZoominDTO> {
+}

+ 29 - 0
src/main/java/com/sw/patroleditor/service/impl/LocationServiceImpl.java

@@ -2,6 +2,8 @@ package com.sw.patroleditor.service.impl;
 
 import com.sw.patroleditor.component.rosBridge.RobotDataCallBack;
 import com.sw.patroleditor.component.rosBridge.RobotDataModel;
+import com.sw.patroleditor.domain.dto.AimDTO;
+import com.sw.patroleditor.domain.dto.ZoominDTO;
 import com.sw.patroleditor.service.LocationService;
 import org.springframework.stereotype.Service;
 
@@ -23,6 +25,33 @@ public class LocationServiceImpl implements LocationService {
     @Override
     public int save() {
         RobotDataModel robotDataModel = robotDataCallBack.getRobotDataModel();
+        Long id = System.currentTimeMillis();
+        AimDTO aimDTO = new AimDTO();
+        aimDTO.setId(id);
+        aimDTO.setRoll(robotDataModel.getRoll());
+        aimDTO.setPitch(robotDataModel.getPitch());
+        aimDTO.setYaw(robotDataModel.getYaw());
+//        aimDTO.setHeight();
+        aimDTO.setFocus(robotDataModel.getFocalDistance());
+        aimDTO.setRatio(robotDataModel.getRatio());
+        aimDTO.setAperture(robotDataModel.getDiaphragm());
+//        aimDTO.setTopleftX();
+//        aimDTO.setTopleftY();
+//        aimDTO.setBotrightX();
+//        aimDTO.setBotrightY();
+
+        ZoominDTO zoominDTO = new ZoominDTO();
+        zoominDTO.setId(id);
+        zoominDTO.setRoll(robotDataModel.getRoll());
+        zoominDTO.setPitch(robotDataModel.getPitch());
+        zoominDTO.setYaw(robotDataModel.getYaw());
+        zoominDTO.setFocus(robotDataModel.getFocalDistance());
+        zoominDTO.setRatio(robotDataModel.getRatio());
+        zoominDTO.setAperture(robotDataModel.getDiaphragm());
+//        zoominDTO.setTopleftX();
+//        zoominDTO.setTopleftY();
+//        zoominDTO.setBotrightX();
+//        zoominDTO.setBotrightY();
         return 1;
     }
 }

+ 1 - 1
src/main/resources/application-dev.properties

@@ -1,6 +1,6 @@
 ### Mysql\u6570\u636E\u5E93\u914D\u7F6E\u4FE1\u606F\uFF08\u7528\u6237\u6570\u636E\u6301\u4E45\u5316\u5B58\u50A8\uFF09
 spring.datasource.drive-class-name=com.mysql.cj.jdbc.Driver
-spring.datasource.url=jdbc:mysql://192.168.1.144:3306/bird_db_v1?serverTimezone=GMT%2B8&characterSetResults=UTF-8&characterEncoding=UTF-8&useUnicode=yes&useSSL=false
+spring.datasource.url=jdbc:mysql://192.168.1.144:3306/agvdb?serverTimezone=GMT%2B8&characterSetResults=UTF-8&characterEncoding=UTF-8&useUnicode=yes&useSSL=false
 #\u6570\u636E\u5E93\u8D26\u53F7
 spring.datasource.username=root
 #\u6570\u636E\u5E93\u8BBF\u95EE\u5BC6\u7801