| | |
| | | import com.ard.tianyu.model.dto.converter.UavSignalInfoConverter; |
| | | import com.ard.tianyu.model.dto.converter.UavStateConverter; |
| | | import com.ard.tianyu.model.dto.converter.UavTelemetryDataConverter; |
| | | import com.ard.tianyu.model.dto.manual.SwitchUavControlDTO; |
| | | import com.ard.tianyu.model.dto.manual.TakeOffDTO; |
| | | import com.ard.tianyu.model.dto.signal.SignalInfo; |
| | | import com.ard.tianyu.model.dto.state.UavState; |
| | | import com.ard.tianyu.model.dto.telemetry.TelemetryData; |
| | |
| | | import com.ard.tianyu.netty.command.control.AbsAngleControlCmd; |
| | | import com.ard.tianyu.netty.command.control.AngleControlCmd; |
| | | import com.ard.tianyu.netty.command.control.SpeedControlCmd; |
| | | import com.ard.tianyu.netty.command.manual.SwitchUavControlCmd; |
| | | import com.ard.tianyu.netty.command.manual.TakeOffCmd; |
| | | import com.ard.tianyu.netty.command.manual.TakeOffReplyCmd; |
| | | import com.ard.tianyu.netty.command.notice.BoxPowerStatusReplyCmd; |
| | | import com.ard.tianyu.netty.command.notice.FlyWayEndReplyCmd; |
| | | import com.ard.tianyu.netty.command.notice.UavReadyReplyCmd; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 切换无人机控制权 |
| | | */ |
| | | @Override |
| | | public void switchUavControl(SwitchUavControlDTO switchUavControlDTO) { |
| | | SwitchUavControlCmd switchUavControlCmd = new SwitchUavControlCmd(switchUavControlDTO); |
| | | this.sendMessage(tyConfiguration.getIpPort(), switchUavControlCmd); |
| | | } |
| | | |
| | | /** |
| | | * 起飞 |
| | | */ |
| | | @Override |
| | | public void takeOff(TakeOffDTO takeOffDTO) { |
| | | TakeOffCmd takeOffCmd = new TakeOffCmd(takeOffDTO); |
| | | this.sendMessage(tyConfiguration.getIpPort(), takeOffCmd); |
| | | } |
| | | |
| | | /** |
| | | * 获取无人机状态 |
| | | */ |
| | | @Override |
| | |
| | | RecordStopReplyCmd recordStopReplyCommand = (RecordStopReplyCmd) tyCommand; |
| | | log.info("收到无人机停止录像回复:{} 错误码:{}", String.format("0x%02X", recordStopReplyCommand.getResult() & 0xFF), recordStopReplyCommand.getErrorCode()); |
| | | } |
| | | //起飞回复 |
| | | if (tyCommand instanceof TakeOffReplyCmd) { |
| | | TakeOffReplyCmd takeOffReplyCommand = (TakeOffReplyCmd) tyCommand; |
| | | log.info("收到无人机起飞回复:{} 错误码:{}", String.format("0x%02X", takeOffReplyCommand.getResult() & 0xFF), takeOffReplyCommand.getErrorCode()); |
| | | } |
| | | break; |
| | | default: |
| | | // 处理其他消息 |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 定时3秒发送心跳指令 |
| | | */ |
| | | @Scheduled(fixedRate = 3000) |
| | | public void sendHeartBeat() { |
| | | long timestamp = System.currentTimeMillis(); |