Robot S-bus protocol

The project is a simple 3 wheel robot.
two traction wheels (two nema17) and one free --- Controller motors are DRV8825
a friend programmed me the arduino Uno
the robot is managed by a control with protocol S.bus (radiolink AT10)

the robot responds, but not well
there is loss of steps, and great vibrations in the step motors
the movement is not correct.

to test the electronics and the correct amount of current I loaded in arduino a tester of step motors, and the motors moved perfectly without vibrations and without losing steps

the code

#include <sbus.h>

// used pins
#define SBUS_PIN 3   // D3

SBUS sbus;

int dirA = 12;
int stepA = 13;

int dirB = 10;
int stepB = 11;

void setup()
{
  //Serial.begin(115200);

  pinMode(dirA, OUTPUT);
  pinMode(stepA, OUTPUT);
  pinMode(dirB, OUTPUT);
  pinMode(stepB, OUTPUT);
  
  //sbus.begin(SBUS_PIN, sbusNonBlocking);
  sbus.begin(SBUS_PIN, sbusBlocking);
}

unsigned long currentTime = 0;

const int maxPulses = 70;
const int minPulses = 1;

const int minAnalogStart = 1400;
const int minAnalogEnd = 1000;

const int maxAnalogStart = 1600;
const int maxAnalogEnd = 2000;

int currChannel1 = 0; //joystick derecho, eje horizontal
int currChannel2 = 0; //joystick derecho, eje vertical
int currChannel3 = 0; //joystick izquierdo, eje vertical (throotrle)
int currChannel4 = 0; //joystick izquierdo, eje horizontal (throotrle)
int currChannel5 = 0; //llave izquierda abajo abajo

int currChannel6 = 0; //
int currChannel7 = 0; //
int currChannel8 = 0; //
int currChannel9 = 0; //llave izquierda frente derecha
int currChannel10 = 0; //llave izquierda frente izquierda
int currChannel11 = 0; //llave derecha frente derecha

void loop()
{
  // Check whether we keep receving data, or we have a connection between the two modules
  currentTime = millis();

  //if (sbus.signalLossActive() == false && sbus.failsafeActive() == false)
  if (sbus.waitFrame() == true)
  {
    currChannel1 = sbus.getChannel(1); //joystick derecho, eje horizontal
    currChannel2 = sbus.getChannel(2); //joystick derecho, eje vertical
    currChannel3 = sbus.getChannel(3); //joystick izquierdo, eje vertical (throotrle)
    currChannel4 = sbus.getChannel(4); //joystick izquierdo, eje horizontal (throotrle)
    currChannel5 = sbus.getChannel(5); //llave izquierda abajo abajo
    
    currChannel6 = sbus.getChannel(6); //
    currChannel7 = sbus.getChannel(7); //
    currChannel8 = sbus.getChannel(8); //
    currChannel9 = sbus.getChannel(9); //llave izquierda frente derecha
    currChannel10 = sbus.getChannel(10); //llave izquierda frente izquierda
    currChannel11 = sbus.getChannel(11); //llave derecha frente derecha
  
    //if (sbus.signalLossActive())
    //  Serial.print("SIGNAL_LOSS ");
      
    //if (sbus.failsafeActive())
    //  Serial.print("FAILSAFE");
  }
  

  int motorPulsesA = 0;
  int motorPulsesB = 0;
  
  // Y-axis used for forward and backward control
  if (currChannel2 < minAnalogStart)
  {
    // Set Motor A backward
    digitalWrite(dirA, HIGH);
    // Set Motor B foward
    digitalWrite(dirB, LOW);

    // Convert the declining Y-axis readings for going backward from 110 to 0 into 0 to 255 value for the PWM signal for increasing the motor speed
    motorPulsesA = map(currChannel2, minAnalogEnd, minAnalogStart, maxPulses, minPulses);
    motorPulsesB = motorPulsesA;
  }
  else if (currChannel2 > maxAnalogStart)
  {
    // Set Motor A forward
    digitalWrite(dirA, LOW);
    // Set Motor B forward
    digitalWrite(dirB, HIGH);

    // Convert the increasing Y-axis readings for going forward from 140 to 255 into 0 to 255 value for the PWM signal for increasing the motor speed
    motorPulsesA = map(currChannel2, maxAnalogStart, maxAnalogEnd, minPulses, maxPulses);
    motorPulsesB = motorPulsesA;
  }
  else
  {
    if (currChannel1 < minAnalogStart)
    {
      // Set Motor A backward
      digitalWrite(dirA, LOW);
      // Set Motor B forward
      digitalWrite(dirB, LOW);

      motorPulsesA = map(currChannel1, minAnalogEnd, minAnalogStart, maxPulses, minPulses);
      motorPulsesB = motorPulsesA;
    }
    else if (currChannel1 > maxAnalogStart)
    {
      // Set Motor A forward
      digitalWrite(dirA, HIGH);
      // Set Motor B backward
      digitalWrite(dirB, HIGH);

      motorPulsesA = map(currChannel1, maxAnalogStart, maxAnalogEnd, minPulses, maxPulses);
      motorPulsesB = motorPulsesA;
    }
  }

  if ((currChannel2 < minAnalogStart || currChannel2 > maxAnalogStart) && (currChannel1 < minAnalogStart || currChannel1 > maxAnalogStart))
  {
    if (currChannel1 < minAnalogStart)
    {
      int xMapped = map(currChannel1, minAnalogEnd, minAnalogStart, maxPulses, minPulses);

      motorPulsesA += xMapped;
      motorPulsesB -= xMapped;

      if (motorPulsesA > maxPulses)
        motorPulsesA = maxPulses;

      if (motorPulsesB < minPulses)
        motorPulsesB = minPulses;
    }
    else if (currChannel1 > maxAnalogStart)
    {
      int xMapped = map(currChannel1, maxAnalogStart, maxAnalogEnd, minPulses, maxPulses);

      motorPulsesA -= xMapped;
      motorPulsesB += xMapped;

      if (motorPulsesA < minPulses)
        motorPulsesA = minPulses;

      if (motorPulsesB > maxPulses)
        motorPulsesB = maxPulses;
    }
  }

  int pulses;
  
  for (pulses = minPulses; pulses<=maxPulses; pulses++)
  {
    if (motorPulsesA >= pulses)
      digitalWrite(stepA, HIGH); // Send HIGH (STEP) signal to motor A
    
    if (motorPulsesB >= pulses)
      digitalWrite(stepB, HIGH); // Send HIGH (STEP) signal to motor B    
    
    delayMicroseconds(2);
    
    digitalWrite(stepA, LOW); // Send LOW signal to motor A
    digitalWrite(stepB, LOW); // Send LOW signal to motor B
    
    delayMicroseconds(900);
  }
  
  
  /*
  Serial.print("ch1: ");
  Serial.print(currChannel1);

  Serial.print(" - ch2: ");
  Serial.print(currChannel2);

  Serial.print(" - ch3: ");
  Serial.print(currChannel3);

  Serial.print(" - ch4: ");
  Serial.print(currChannel4);

  Serial.print(" - ch5: ");
  Serial.print(currChannel5);

  
  Serial.print(" - ch6: ");
  Serial.print(currChannel6);

  Serial.print(" - ch7: ");
  Serial.print(currChannel7);

  Serial.print(" - ch8: ");
  Serial.print(currChannel8);

  Serial.print(" - ch9: ");
  Serial.print(currChannel9);

  Serial.print(" - ch10: ");
  Serial.print(currChannel10);

  Serial.print(" - ch11: ");
  Serial.print(currChannel11);
  */
  
  //Serial.println();

  //delay(200);
}

I hope you can help me - thanks

i find that but not understand all Generate S.Bus with Arduino in a simple way | QuadMeUp