Qiang,
To address your questions, I'm assuming you're running the latest version of the
hebi-matlab-examples repository on Github. For working with single actuators, the best place to start is with the
basic examples for the X-Series actuators.
1. I checked the control section, and I am wondering what is the basic Matlab API example for strategy 4? I know there is an example zip folder on the website for x-series_actuator, but could you please tell me if I need to modify the code inside to realize the strategy 4?
The best practice is to make a
Gains XML File for your work and set it every time you run your code. An example of doing this in the Matlab API can be found
here. The gains format is cross-API, so your settings can be easily loaded into the other APIs if you wind up switching later on.
I've noticed now that the example gains file in the matlab examples is for Strategy 3. Sorry, we will fix this shortly. Since your actuators are X8-16s (the example is for an X5-1), you'll want the default gains for that model, which you can find
here.
2. Strategy 4 is specifically for trajectory and velocity tracking as I think. Could you please tell me if you have done some impedance control or admittance control with the X-series motor? If so, could you please share some Matlab code with me?
All the strategies can be used with trajectory tracking, or individually for position / velocity / torque, or any combination of the two.
By my (probably limited) understanding,
Strategy 4 is doing impedance control at the joint level based on commanded positions. The P and D gains are a spring and damper based on the actuator position that commands a torque to the inner torque loop. In addition to the position P and D parameters, you might find it useful to increase the P gain on effort (torque) if you would like the actuator to be more responsive.
You can also implement impedance control yourself at the API level and command efforts to the actuator. In terms of admittance control, we would do this at the API level, but we don't have any examples.
3. Can I increase the feedback frequency? How to set this parameter, in Scope or Matlab command?
Yes, in the Matlab API you can call
HebiGroup.setFeedbackFrequency(). There are similar calls in the other APIs. For reference the full API documentation for the latest version 1.7.3 can be found
here, and also by typing "help hebi" in Matlab.
In Scope there is a slider at the top that controls the feedback frequency for plotting. This also controls the feedback frequency when you take logs from Scope.
Since the actuators are already doing realtime control at the joint level at 1 kHz, we have found that there isn't much benefit from running faster than ~200 Hz at the API level. But feel free to explore. From Windows, you can reliably get feedback and send commands up to about 600 Hz, and on macOS and Linux you can get all the way up to 1 kHz.
Hope this helps,
-Dave