56 lines
1.1 KiB
C
56 lines
1.1 KiB
C
#include "dji_task.h"
|
||
#include "TopDefine.h"//事件组的一些东西
|
||
#include "FreeRTOS.h"
|
||
#include "attrTask.h"
|
||
#include <cmsis_os2.h>
|
||
#include "remote_control.h"
|
||
#include "dji.h"
|
||
#include "vofa.h"
|
||
|
||
extern RC_mess_t RC_mess;
|
||
extern int16_t result;
|
||
extern motor_measure_t *motor_3508_data;
|
||
float vofa[8];
|
||
/**
|
||
* \brief 电机任务
|
||
*
|
||
* \param argument 未使用
|
||
*/
|
||
|
||
int speed=0;
|
||
float angle=0;
|
||
float m;
|
||
void Task_Motor(void *argument)
|
||
{
|
||
(void)argument; /* 未使用argument,消除警告 */
|
||
|
||
// const uint32_t delay_tick = osKernelGetTickFreq() / TASK_FREQ_CTRL_CHASSIS;
|
||
|
||
motor_init();
|
||
|
||
uint32_t tick = osKernelGetTickCount();
|
||
|
||
while(1)
|
||
{
|
||
//收到消息队列新数据
|
||
|
||
//电机控制
|
||
//motor_speed(speed);
|
||
m=angle*(8191/360);
|
||
motor_pos(m);
|
||
//CAN_cmd_200(result[MOTOR_UP],result[MOTOR_UP],result[MOTOR_UP],result[MOTOR_UP],&hcan1);
|
||
CAN_cmd_200(result,0,0,0,&hcan1);
|
||
osDelay(2);
|
||
|
||
// vofa[0]=motor_3508_data->speed_rpm;
|
||
// vofa[1]=speed;
|
||
// vofa_tx_main(vofa);
|
||
|
||
// tick += delay_tick;
|
||
// osDelayUntil(tick);
|
||
|
||
|
||
}
|
||
|
||
}
|