Rust driver and questions about LSS protocol

Hello!

I am a very happy owner of your new smart servos and I have a few questions!

I bought 4 of your standard servos that I used to build a simple arm. But I plan on using them to build a hexapod or quadruped.
I have previous built a hexapod github link using the Dynamixel AX-12a servos and I have to say that so far I am really impressed with how the LSS servos compare to the dynamixel ones.

Since I want to write my new controller in Rust I started by writing a standalone driver. Link to github here
And I figured I might as well share it with you here in case anyone has a use for it.

This driver is by no means finished. Some commands are still missing, either because I am not sure how they are supposed to work or I simply didn’t need them yet.
I tried to implement all the basic ones in case someone wants to start using it.
If anyone is missing a command they can raise an issue and I will add it.

My questions are:

  1. Do you have some more docs about how the FPC command works? I am using my servos in the EM0 mode and changing AS and AH has an obvious effect but I can’t figure out exactly how FPC works
  2. In the last changelog it noticed that a new command named IPE was added but I can’t find it in the wiki and I am not sure how it works.
  3. The MMD command seems to support two value fields based on the changelog but it’s not documented in the wiki. Is it just #5MMD256,512<cr> ?
  4. Do you have a step file of the motor that I could use for CAD?

Thank you!

1 Like

@DavidMakesRobots Welcome to the RobotShop Community! Nice user name.

I bought 4 of your standard servos that I used to build a simple arm. But I plan on using them to build a hexapod or quadruped.

Certainly, but keep an eye on how much torque will be needed at each joint. You might want to join the following thread:

I have previous built a hexapod github link using the Dynamixel AX-12a servos and I have to say that so far I am really impressed with how the LSS servos compare to the dynamixel ones.

Happy to hear and welcome any feedback you would like to provide. There is a long list of improvements in the queue, but having users request the same improvements or changes tends to help prioritize.

Since I want to write my new controller in Rust I started by writing a standalone driver. Link to github here And I figured I might as well share it with you here in case anyone has a use for it.

We’ll have someone from the programming side take a look. Very nice of you to make it available.

Regarding the questions:

Q1) Do you have some more docs about how the FPC command works? I am using my servos in the EM0 mode and changing AS and AH has an obvious effect but I can’t figure out exactly how FPC works.

Certainly. Details to come from one of the programmers below.

Q2) In the last changelog it noticed that a new command named IPE was added but I can’t find it in the wiki and I am not sure how it works.

Same as the answer above.

Q3) The MMD command seems to support two value fields based on the changelog but it’s not documented in the wiki. Is it just #5MMD256,512 ?

Ok, there’s a theme here… the same programmer will get back to you on all three questions :slight_smile:

Q4) Do you have a step file of the motor that I could use for CAD?

Right here (the CAD for all mechanical components and electronics can be found on the Wiki): https://wiki.lynxmotion.com/info/wiki/lynxmotion/view/servo-erector-set-system/ses-servos/

1 Like

Hey @DavidMakesRobots,
Welcome to the RobotShop community! :smiley:

Sounds neat! Looking forward to see how you progress.
You are also not the only one thinking of an hex or quad using the LSS. You can see a successful quad here and a group of Lynxmotion community members working on a hexapod design (RPi, Teensy 4, etc.) here. Full disclosure, all of them were part of our beta testing program so they did get a to use them before everyone else. :slight_smile:

That is an amazing idea! Thanks for the share! We currently only have official Arduino and Python libraries, but we are always looking to expand where the LSS are used and assist any project with them.

As you are probably already aware, AS and AH will change the response to position error (i.e.: trying to get to the desired/requested position). AS affects all movement response and AH specifically is used to tune the holding component (when the position is reached/in close vicinity). Higher values mean a stronger response (effectively higher duty cycle changes).

Since EM=0 performs no acceleration/deceleration (which means very jerky moves), we’ve added FPC to control a first order filter (exponential weighted average) over the input position from the D command. If FPC >= 2, then the filter will be active. FPC = 1 makes it directly apply the position (effectively not used) and FPC = 0 deactivates it. We recommend using odd numbers for the value.

So, if you send a LSS (where QD = 0, EM = 0, FPC = 5, IPE = 1) a motion command like D900, the filter will absorb this value over a count of 5, therefore passing on to the control a smaller delta. In this case, it would be: ((0 * 4) + 900) / 5 = 180. Then, 20 ms later (or 4 control loop of 5 ms each), the requested position is replayed again, changing the value to: ((180 * 4) + 900) / 5 = 324. This continues until the value passed to the control equals the desired position (original D command). Of course, if you send another D command before this one is completed the new value will be used every 20 ms.

If you want a more responsive LSS, you can try FPC = 3. Alternatively, you can increase the dampening effect of the filter by increasing FPC above the default value of 5.

Since this method requires requesting the position continuously until D[val] = QD, IPE was added to do this for the user internally. Therefore, when in EM = 0 with and FPC >= 2 and an IPE = 1, the LSS, once given a D command will update its filter with an internal repeat of that D command every 20 ms.

If IPE = 0, it will instead apply the position to the filter once (obviously not getting to the actual position, just the intermediary point instead) and holding there. Using IPE = 0 is great if you want to use your own timing/external control code for changing the position / filter value. For most use cases though, IPE = 1 is more practical and also saves your from sending repeated D commands on the bus to all servos (since it repeats internally the last command until the position is reached).

This advance command was added to help in the development of some advance code using ROS for a humanoid using LSS that includes compliance.
It is quite simple to use and yes it can be used in one of two ways:

  • #[id]MMD[val]\r
    In this case, both direction of motion will have their 10 bit value of duty cycle capped at that number.
  • #[id]MMD[val+],[val-]\r
    With this, a different value can be used (separated by a comma) for the positive (or CW) and negative (or CCW) motions.
    Please note there is an enforced minimum of 1/4 (or 255 / 1023), but be careful of setting a cap that is too low for the RPM/load used with the LSS. Using a lower cap than 1023 can create situations where the motor is stalled due to the lower effective voltage when under higher loads, which can easily cause it to overheat.

I think @cbenson provided this info already in his reply.

Feel free to ask any other questions, recommendations, etc. that you may have! We are always glad for feedback from our users.

Sincerely,

Thank you both for your very detailed responses!

I’ve seen the Legged Robots thread and read a lot of it. I’ve noticed that you have Zenta and KurtE in there and it all looks really great! Excited to see what comes out of it!
I’ve seen a lot of other projects pop up that are using these servos which is how I found out about them in the first place.

Thank you for the link to the cad files. It’s really great that you made all of the parts available in both stl and step.

And thank you @scharette for the very detailed explanation of all the commands. This is extremely helpful. I am loving all the options for dampening and compliance.

Cheers

1 Like

:+1:

And, as you may already be aware, this is still an evolving product and more updates are coming in the future. Of course, feel free to provide any feedback concerning the LSS and their use (protocol, button, mechanical, electrical, etc.). We do keep track of all feedback and use it to further improve the LSS experience (and SES v2 kits) for our customers!