<template>
  <div>
    <MMCDataTransferPanel
      class="data-panel"
      :device="device"
      :throttleValue="throttleValue"
      :uav-battery="battery"
      :uav-data="uavData"
    ></MMCDataTransferPanel>
    <!-- 一键任务 返航 安全降落 手动 -->
    <ControlBottom></ControlBottom>
    <!-- 健康管理-挂载-警灯-无人机  -->
    <ControlRight></ControlRight>
    <!-- 任务 智能识别 -->
    <ControlLeft></ControlLeft>
  </div>
</template>

<script>
import { mapState } from "vuex";
import Moment from "moment";
import ControlBottom from './components/controlBottom';
import ControlRight from './components/controlRight';
import ControlLeft from './components/controlLeft';

export default {
  name: 'ControlPanel',
  components: {
    ControlBottom,
    ControlRight,
    ControlLeft
  },
  data() {
    return {
      device: {
        cateName: "px4",
      },
      throttleValue: 500,
      battery: {
        voltage: 0,
        id: "",
      },
      
    };
  },
  computed: {
    ...mapState("MMCFlightControlCenter/uavApplications", ["uavRealTimeData"]),
    uavData() {
      // console.log("this.uavRealTimeData", this.uavRealTimeData);
      return {
        relativeAlt:
          Number(this.uavRealTimeData?.gps?.relativeAlt)?.toFixed(0) || "-",
        absoluteAlt:
          Number(this.uavRealTimeData?.gps?.absoluteAlt)?.toFixed(0) || "-",
        flyDistance:
          Number(this.uavRealTimeData?.flyDistance)?.toFixed(0) || "-",
        flyTime: Number(this.uavRealTimeData?.flyTime)?.toFixed(0) || "-", //飞行时间
        groundSpeed:
          Number(this.uavRealTimeData?.groundSpeed)?.toFixed(0) || "-", //飞行速度
        distanceToHome:
          Number(this.uavRealTimeData?.distanceToHome)?.toFixed(0) || "-",
        velocityX: this.uavRealTimeData?.velocityX || 0,
        velocityY: this.uavRealTimeData?.velocityY || 0,
        velocityZ: Number(this.uavRealTimeData?.velocityZ)?.toFixed(0) || "-", //爬升率
      };
    },
  },
};
</script>

<style lang="scss" scoped>
.data-panel {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translate(-50%, 0);
  z-index: 100;
}
</style>