XH430-W210 Velocity Control

I have successfully implemented position control with the aforementioned servo.
However, i cannot graps velocity control.
Is there some code example for velocity control, for this servo, which i could study?

These are the values for the position control of the servo.

if MY_DXL == 'X_SERIES' or MY_DXL == 'MX_SERIES':
       ADDR_TORQUE_ENABLE          = 64
       ADDR_GOAL_POSITION          = 116
       ADDR_PRESENT_POSITION       = 132
       DXL_MINIMUM_POSITION_VALUE  = 0
       DXL_MAXIMUM_POSITION_VALUE  = 4095
       BAUDRATE                    = 57600

I am not sure what has to be changed…

OK, after further reading, some things are clearer now…

But still i don’t get the servos to rotate.
Initially i set up the addresses:

ADDR_OPERATING_MODE = 11
ADDR_GOAL_VELOCITY = 104

Then i set up the velocity mode:

dxl_comm_result, dxl_error = packetHandler.write1ByteTxRx(portHandler, DXL_ID_SERVO0, ADDR_OPERATING_MODE, 1)
if dxl_comm_result != COMM_SUCCESS:
    print("%s" % packetHandler.getTxRxResult(dxl_comm_result))
elif dxl_error != 0:
    print("%s" % packetHandler.getRxPacketError(dxl_error))
else:
    print("Dynamixel has been successfully connected for Servo 0")

I manage to get the ‘Dynamixel has been successfully connected’ message.

Then i enable the torque , and finally i start the rotation with:

dxl_comm_result, dxl_error = packetHandler.write4ByteTxRx(portHandler, DXL_ID_SERVO0, ADDR_GOAL_VELOCITY, 1000)

The servo does not rotate.
I tried commenting out the torque part, but still it didn’t work… Any help would be appreciated.

1 Like

Make sure the XH430-W210’s default is 210

In other words, your code should be as follows.

dxl_comm_result, dxl_error = packetHandler.write4ByteTxRx(portHandler, DXL_ID_SERVO0, ADDR_GOAL_VELOCITY, 210)

NOTE !! You can extend the value above it, as long as you are reconfiguring Velocity Limit(44).

However, this does not imply you can really apply all range of value The proper range should be set under your DYNAMIXEL specification. i.e, the XH430-W210’s no load speed is 50 rpm, Goal Velocity may properly works under 218 (50 / 0229) only.

Thanks. I am a bit confused… I have to initially set it at 210 and then change it? What do i do with the velocity Limit?

Also, in velocity control mode, i have to make the operation just once right? No need to be in a constant loop…

And how do i stop it? do i set the speed to 0?

Thanks!!! Putting the value 210 worked!!!
Three questions arised…

  1. The torque should be turned off, is that correct?
  2. How do i change speed? If i have to set it at 210, then how do i change the speed?
  3. How do i stop them? Do i call the same function, with the speed value at zero?
  1. The Torque Enable is used to control wether or not the motor inside the servo will be supplied power, to control wether or not it moves. Torque will need to be enabled to generate any movement at all, but some values in the DYNAMIXEL control table are protected from being written while torque is enabled.

    Usually, it is safest to keep tourque disabled as often as possible, and only enable it when you need the servos to move.

2/3. Controlling the servo’s speed is done through specifiying the Goal Velocity, with higher goal velocities correlating to higher speed, and 0 meaning a complete stop. The Velocity Limit is used to set the maximum allowable velocity in your program.

I am confused… The Velocity Limit is 0 ~ 1,023… However, yogurt man said that “Goal Velocity may properly works under 218”.
After testing, not even 218 works…

So since the values are 0-1023, how come this does not work? What are the true limits to the velocity? How does this thing work? Can it be calculated somehow?

In the Goal Velocity link above, it is mentioned that the units for the velocity are measured in units of 0.299 RPM. You can use this, along with the maximum RPM of your particular servo to calculate valid Goal Velocity values.

1 Like

As said, you can put the value in that address, but the DYNAMIXEL does not exceed the RPM over specification.

I guess, as you know, the DC motor or such device converts the direct current to mechanical energy. And the more powering the device gets , the greater energy it gets.

The RPM can differ what voltage (9 or 12 or 14 depending on you) you are putting in motor, and that is one of the primary reasons why the velocity limits are so wide. For the convention and terms in the company, they might choose the max limit as 1023 in all X series. (Not guranteed)

Thanks.

Hi,

i have just posted another question similar to this but using sync_write to do it. Can i clarify that the reason why you have asked him to change 210 is because we have to set the goal_velocity → speed limit first (210) before adjusting the velocity?

" ```
dxl_comm_result, dxl_error = packetHandler.write4ByteTxRx(portHandler, DXL_ID_SERVO0, ADDR_GOAL_VELOCITY, 210)