RMD-X8 PRO actuator

  • Hi! I am a newbie in robotics and I am trying to control RMD-X8 PRO motor. I use CAN protocol and ESP32 microcontroller to command the motor.


    I also have this: Servo Motor Control Protocol, but the commands doesn't work properly. I think there is another version of this document but I can not find it. It appears in this video at 4 minute.

    I have tried A5 command (Position tracking control command with speed limit )and some of the results are:

    for send command of 0 degrees it reply 39 degrees

    for send command of 1 degrees it reply 179 degrees

    for send command of 2 degrees it reply 331 degrees

    for send command of 3 degrees it reply 479 degrees

    for send command of 4 degrees it reply 645 degrees

    I noticed that the numbers are increasing, but I con not find a rule.

    In document is an example that I don't understand completely that say:

    The composite data of Data[6] and Data[/] 0x002D is 45 in decimal, which means that the motor output shaft moves 45 degrees in the positive direction relative to the zero position. The position of the motor output shaft is related to the number of motor encoder lines and the reduction ratio. For example, if the number of motor encoder lines is 16384 and the reduction ratio is 6, then 360 degrees of the motor output shaft corresponds to 16384*6 = 98304 pulses.



    My arduino code is similar to this one:

    #include <ESP32CAN.h>

    #include <CAN_config.h>


    /* the variable name CAN_cfg is fixed, do not change */

    CAN_device_t CAN_cfg;


    void setup() {

    Serial.begin(115200);

    Serial.println("iotsharing.com CAN demo");

    /* set CAN pins and baudrate */

    CAN_cfg.speed=CAN_SPEED_1000KBPS;

    CAN_cfg.tx_pin_id = GPIO_NUM_5;

    CAN_cfg.rx_pin_id = GPIO_NUM_4;

    /* create a queue for CAN receiving */

    CAN_cfg.rx_queue = xQueueCreate(10,sizeof(CAN_frame_t));

    //initialize CAN Module

    ESP32Can.CANInit();


    }


    void loop() {

    CAN_frame_t rx_frame;



    if(xQueueReceive(CAN_cfg.rx_queue,&rx_frame, 3*portTICK_PERIOD_MS)==pdTRUE){


    //do stuff!

    if(rx_frame.FIR.B.FF==CAN_frame_std)

    printf("New standard frame");

    else

    printf("New extended frame");


    if(rx_frame.FIR.B.RTR==CAN_RTR)

    printf(" RTR from 0x%08x, DLC %d\r\n",rx_frame.MsgID, rx_frame.FIR.B.DLC);

    else{

    printf(" from 0x%08x, DLC %d\n",rx_frame.MsgID, rx_frame.FIR.B.DLC);

    for(int i = 0; i < 8; i++){

    printf("%d\t", rx_frame.data.u8[i]);

    // Serial.print( rx_frame.data.u8[i], HEX);

    }

    printf("\n");

    }

    }



    else {

    rx_frame.FIR.B.FF = CAN_frame_std;

    rx_frame.MsgID = 0x142;

    rx_frame.FIR.B.DLC = 8;

    rx_frame.data.u8[0] = 0x9C;

    rx_frame.data.u8[1] = 0x00;

    rx_frame.data.u8[2] = 0x00;

    rx_frame.data.u8[3] = 0x00;

    rx_frame.data.u8[4] = 0x00;

    rx_frame.data.u8[5] = 0x00;

    rx_frame.data.u8[6] = 0x00;

    rx_frame.data.u8[7] = 0x00;

    ESP32Can.CANWriteFrame(&rx_frame);

    }

    }

  • massula

    Approved the thread.
  • Please share your full Tx array and Rx array (in hex) so that I can verify the send/reply values you wrote above for 39 degrees (for example).
    note: candump will also have these one frame array lines listed as suffix T and R.

Advertising from our partners