#include "remote_cmd.h"


int8_t Gimbal_Cmd( Gimbal_CMD_t *g_cmd, DR16_t *dr16) 
{

    switch (dr16->data.sw_l)
    {
    case DR16_SW_DOWN:
        g_cmd->mode=  GIMBAL_MODE_RELAX;   /* 放松模式 */  
        break;
      case DR16_SW_MID:
        g_cmd->ctrl_mode=  GIMBAL_MODE_REMOTE;   /* 遥控器模式 */
        g_cmd->mode=  GIMBAL_MODE_ABSOLUTE;    
        g_cmd->delta_yaw=1.5*dr16->data.ch_r_x; /* 云台Yaw速度设定 */			
        g_cmd->delta_pit=0.4*dr16->data.ch_r_y; /* 云台Pitch速度设定 */
        break;  
     case DR16_SW_UP:
       g_cmd->ctrl_mode=  GIMBAL_MODE_AI;   /* 遥控器模式 */
        g_cmd->mode=  GIMBAL_MODE_ABSOLUTE;   
        break;
    }

}

int8_t Shoot_Cmd(Shoot_CMD_t *s_cmd,DR16_t *dr16) 
{

    switch (dr16->data.sw_r)
    {
    case DR16_SW_DOWN:
				s_cmd->firecmd=false;
				s_cmd->ready=false;
        break;
      case DR16_SW_MID:
        s_cmd->firecmd=false;
				s_cmd->ready=true;
        break;  
     case DR16_SW_UP:
        s_cmd->firecmd=true;
        s_cmd->ready=true;
        break;
    }

}

int8_t Chassis_Cmd(Chassis_CMD_t *c_cmd,DR16_t *dr16) 
{

    switch (dr16->data.sw_r)
    {
    case DR16_SW_DOWN:
				c_cmd->mode=CHASSIS_MODE_BREAK;
        break;
      case DR16_SW_MID:
				c_cmd->mode=CHASSIS_MODE_FOLLOW_GIMBAL;
				c_cmd->ctrl_vec.vx=dr16->data.ch_l_x*1000;
				c_cmd->ctrl_vec.vx=dr16->data.ch_l_y*1000;		
        break;  
     case DR16_SW_UP:
//				c_cmd->mode=CHASSIS_MODE_INDEPENDENT;
//				c_cmd->mode_rotor=ROTOR_MODE_CCW;		 
        break;
    }

}




