Kinematic Inverse Solution and Gait Planning for Quadruped Robot Using XR806

This article is from the Jishu community, and it mainly shares how to use the XR806 to achieve the kinematic inverse solution of a single leg of a parallel quadruped robot and overall gait planning.

1 Project Introduction

Using the RX806 serial protocol to communicate with the DJI A board’s STM32, we achieve the kinematic inverse solution of a single leg of a parallel quadruped robot and overall gait planning.

Kinematic Inverse Solution and Gait Planning for Quadruped Robot Using XR806

Figure 1 Physical Image

2 Related Algorithms

2.1 Single Leg Kinematic Inverse Solution

Control 2 brushless motors (each represented by a red arrow) to form a single leg in parallel, calculating the foot trajectory through angle closed-loop control, and creating a cycloidal trajectory at the foot end (the green part in the image below) to simulate the motion of animals like cats and dogs.

Kinematic Inverse Solution and Gait Planning for Quadruped Robot Using XR806

Figure 2

% Cycloid Equation (matlab) sigma=2*pi*t/(Ts);xep=(xf-xs)*((sigma-sin(sigma))/(2*pi))+xs;zep=h*(1-cos(sigma))/2+zs;x=[x,xep];z=[z,zep];

2.2 Gait Planning (Currently Mainly Using Walk Gait)

The Walk gait is a static gait, meaning that during movement, three legs are always in a support phase, with at most one leg in a swing phase. The most common rotation order of the four legs in the Walk gait for quadrupedal animals is 1→3→4→2→1.

Kinematic Inverse Solution and Gait Planning for Quadruped Robot Using XR806

Figure 3

2.3 Brushless Motor Angular Velocity PID Closed Loop

Using P proportional, I integral, and D differential through incremental PID to enable the brushless motor to stably control speed and angle, the pd control function is as follows:

int Balance(float Angle,float Gyro,int Middle,float Balance_Kp,float Balance_Kd){     float Angle_bias,Gyro_bias;  int balance;  Angle_bias=Middle-Angle;                         Gyro_bias=0-Gyro;                                balance=Balance_Kp*Angle_bias+Gyro_bias*Balance_Kd;   return balance;}

3 Code Implementation

XR806:

Initializing serial port configuration:

static int uart_init(void){ UART_InitParam param;
 param.baudRate = 115200; param.dataBits = UART_DATA_BITS_8; param.stopBits = UART_STOP_BITS_1; param.parity = UART_PARITY_NONE; param.isAutoHwFlowCtrl = 0;
 if(HAL_UART_Init(UARTID, &param) != HAL_OK)  return -1; /* Enable DMA */ if (HAL_UART_EnableTxDMA(UARTID) != HAL_OK)  return -2; if (HAL_UART_EnableRxDMA(UARTID) != HAL_OK)  return -3;
 return 0;}

In the main function, the while loop sends the corresponding data using the following function.

HAL_UART_Transmit_DMA(UARTID, (uint8_t *)buffer,sizeof(buffer));

In STM32, the serial port 3 receive callback executes the corresponding forward and backward commands.

void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart){     if(huart->Instance == USART3) {  HAL_UART_Receive_IT(&huart3,&RxBuffer_control,1);
 switch(RxBuffer_control) {  case 'W': Motor_Control( 1,  1,  1,  1); break;  case 'S': Motor_Control(-1, -1, -1, -1);  break;  case 'A': Motor_Control(-1, -1,  1,  1);  break;  case 'D': Motor_Control( 1,  1, -1, -1);  break;  case 'P': Motor_Control( 0,  0,  0,  0);  break; }}

4 Physical Display

4.1 Stationary

4.2 Omnidirectional Movement

Copyright belongs to the original author. If there is any infringement, please contact for deletion.


END








关于安芯教育



安芯教育是聚焦AIoT(人工智能+物联网)的创新教育平台,提供从中小学到高等院校的贯通式AIoT教育解决方案。
安芯教育依托Arm技术,开发了ASC(Arm智能互联)课程及人才培养体系。已广泛应用于高等院校产学研合作及中小学STEM教育,致力于为学校和企业培养适应时代需求的智能互联领域人才。


Leave a Comment