How to set Profile_Acceleration(108), Profile_Velocity(112) on XC430 with Dynamixel2arduino library (0.47)

Hello all, first post ever on here, thanks for taking the time to read!

What model(s) of servo are you using?
XC430-W240-(T)

Using Arduino IDE for OSX 10.14.3 (1.8.15) and Dynamixel2arduino (0.47 - latest for now)

Running code on ESP32 (Sparkfun ESP32 Thing plus) with level converter TXB0104 (3.3v/5v) and half-duplex 74LVC2G241DP for TTL comm.

I am looking for a way to set the Profile_Acceleration(RAM position 108) and perhaps Profile_Velocity(RAM position 112) for XC430.

I see some mention as TODO in the Dynamixel2Arduino.h but not yet implemented.

#if 0 //TODO
. . .
. . .
bool setProfileVelocity(uint8_t id, float value, uint8_t unit = UNIT_RAW);
bool setProfileAcceleration(uint8_t id, float value, uint8_t unit = UNIT_RAW);

///

Since it is a RAM position to set, perhaps it could be a simple write command?
any hints on code will be appreciated.

rgs
Pierre/gapzap

Hi @gapzap, thanks for your question and welcome to our Community Page! While I personally am unfortunately not experienced with the ESP32 family of boards, I should be able to provide some information about the libraries that should be helpful based on your question.

The DYNAMIXEL2Arduino libraries currently include an example named “read_write_ControlTableItem.ino” which provides a number of preset Control Table settings listed that can be easily called in the example. In the example, it includes Profile Velocity and Profile Acceleration settings as well.

  if(dxl.writeControlTableItem(GOAL_VELOCITY, DXL_ID, 200)){
delay(500);
DEBUG_SERIAL.println(dxl.readControlTableItem(PRESENT_VELOCITY, DXL_ID));}

In lines 185 - 188 of the example, it shows Goal Velocity being written to- it should be possible to test the example for your uses by replacing the Goal Velocity Control Table Item with one of your desired settings to edit.

Let me know if this works for you, or whether you have any other questions we can help with! For more information about control with ESP32, I’ll tag @Yogurt_Man and @willson for any suggestions they may be able to provide.

1 Like

Hey Andrew, excellent suggestion! I’ll try it and will update here.
As for the ESP32, since I am using the Arduino IDE with ESP32 Arduino core, the ESP is just like another Arduino :wink:

Happy coding!
Best regards
gapzap

You can find various Control Table Items from the eManual below.

If you click on the readControlTableItem() or writeControlTableItem() you’ll see the item index, but please note that not all of them are available as the list is sum of all control table items of all DYNAMIXEL series.

Since XC430 does have Profile Acceleration and Velocity in its control table, you may use PROFILE_ACCELERATION and PROFILE_VELOCITY as below.

const int DXL_DIR_PIN = 2;
Dynamixel2Arduino dxl(Serial1, DXL_DIR_PIN);
const uint8_t DXL_ID = 1;
uint32_t profile_acceleration = 50;
uint32_t profile_velocity = 100;

dxl.writeControlTableItem(PROFILE_ACCELERATION, DXL_ID, profile_acceleration);
dxl.writeControlTableItem(PROFILE_VELOCITY, DXL_ID, profile_velocity);
1 Like

Hello all,
Quick update here to say that the provided solution worked perfectly!
I have to mention that I am now using XM430-W350-R but will be trying this on XC430 later on.

so this worked: (I adjusted the values to my needs)

uint32_t profile_acceleration = 30;
uint32_t profile_velocity = 70;

dxl.writeControlTableItem(PROFILE_ACCELERATION, DXL_ID, profile_acceleration);
dxl.writeControlTableItem(PROFILE_VELOCITY, DXL_ID, profile_velocity);

thanks a million for the quick answers and solution!

rgs
gapzap

1 Like

silly question: how do I set this topic as SOLVED?
thanks
g.

Hi @gapzap, thanks for checking in and notifying us of the solution!
To mark a topic as “solved” you can select the response that solved your issue and click on the three dots for “options” next to the “reply” button:

image

Clicking on the three dots in the top of that picture will expand the menu into the options on the bottom there. You can click the “solution” button with a checkmark to mark the issue as Solved :slight_smile: