package com.ard.web.controller.work; import com.ard.common.core.domain.AjaxResult; import com.ard.work.domain.dto.control.AbsAngleControlDTO; import com.ard.work.domain.dto.control.AngleControlDTO; import com.ard.work.domain.dto.control.SpeedControlDTO; import com.ard.work.service.ITyService; import com.ard.work.service.impl.GimbalSpeedService; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; /** * UavGimbalController * * @author liusuyi * @date 2024年10月21日13:52 **/ @Api(tags = "无人机云台控制接口") @RequestMapping("/uav/gimbal") @RestController public class UavGimbalController { @Resource private ITyService tyService; @Resource private GimbalSpeedService gimbalSpeedService; @ApiOperation(value = "云台转动(基于角度)", notes = "actionCode值:0-回中,1-上,2-右上,3-右,4-右下,5-下,6-左下,7-左,8-左上,254-停止 \r\n rotationAngle值:取值范围:0~255【云台实际转动角度= 转动角度/100+2.5 单位:度】") @ApiOperationSupport(order = 1) @PostMapping("/angleControl") public AjaxResult angleControl(@RequestBody AngleControlDTO angleControlDto) { tyService.angleControl(angleControlDto); return AjaxResult.success(); } @ApiOperation(value = "云台绝对值控制(基于角度)", notes = "俯仰pitch范围:[-120°至+30°] 平移yaw范围:[-180°至+180°] 横滚roll范围:[-90°至+60°]") @ApiOperationSupport(order = 2) @PostMapping("/absAngleControl") public AjaxResult absAngleControl(@RequestBody @Validated AbsAngleControlDTO angleControlDto) { tyService.absAngleControl(angleControlDto); return AjaxResult.success(); } @ApiOperation(value = "云台转动(基于速度)", notes = "俯仰转动速度:上正下负 平移转动速度:右正左负 横滚转动速度:顺时针正,逆时针负") @ApiOperationSupport(order = 3) @PostMapping("/speedControl") public AjaxResult speedControl(@RequestBody @Validated SpeedControlDTO speedControlDto) { tyService.speedControl(speedControlDto); return AjaxResult.success(); } @ApiOperation(value = "云台速度控制(开始/停止统一接口)") @ApiOperationSupport(order = 4) @PostMapping("/speedControlSimple") public AjaxResult speedControlSimple(@RequestBody @Validated SpeedControlDTO speedControlDto) { if (speedControlDto.isStart()) { gimbalSpeedService.startControl(speedControlDto); } else { gimbalSpeedService.stopControl(speedControlDto.getBoxSn()); } return AjaxResult.success(); } }