good day,

how can I control the speed of “Lynxmotion (LSS) - 4 DoF Robotic Arm” in python codes. Note that we used the same codes as the Test file library.

Please help.

Thank you.

Hi @KhaledAlharbi,

Welcome to the RobotShop community!

There are two main ways to control the speed of an LSS and therefore a LSS 4DoF robotic arm:

  1. Set a maximum speed in the settings of each joint. This can be done either as a limit for the session or as a permanent configuration (survives power cycles). You can find a list of the commands available to do this here. The ones you would primarily look at in this case are: SD/CSD and SR/CSR. Both of these can be used to change the maximum speed of a joint for the session or set the default maximum speed for the LSS.
  2. You can send a speed or time constraint in as a modifier to a motion command (ex: D900 could become D900T1000, taking now 1000 ms or 1 s to complete). These modifiers are T and S, which can also be replaced with SD for speed in degrees/s.

So, in practice, you’d either pre-configure your joint with appropriate maximum speed, send maximum speed settings before groups of motions or send speed/time modifiers to motions… or a mix of all of those depending on your use case.

I hope this info helps!


Thank you for your information. Just to be clear if I write:


this means that the motor 1 will move 90 degrees and will take 2000 ms or in other word 2s. right?

should we add another library to make this happen? We are using time, serial, lss, and lss_const.

Thank you.

No problem!

That is a good approximation but somewhat off the real use.
You can have a look at the examples found here, such as that shows the use of the .move() function here (line 37, 43).

As you can see a LSS object - in this case myLSS - is used to call the function move(). The only parameter is the position in tenths of degrees (ex: 150.7° = 1507).

The current library does not have a version of the move() function that allows for a T modifier. That being said, it would be pretty simple to add this to the current LSS Python library.

Here are the key points:

  1. The genericWrite function already supports writing a modifier after a command. By default, the modifier is empty. You can view this in /src/ (lines 30-37). This function is the one used by all other functions to actually send commands to the LSS.

  2. The move(self, pos) command (lines 135-136) can be used as a reference point to add the time modifier feature.

  3. If you look at function getAngularStiffness() (line 235) (and many other queries) you’ll notice they call the genericWrite() function with the “param” field having a value. You could do the same thing to add the T parameter in.

Maybe something along the lines of (to be added in, near the original move() function):

	def moveTime(self, pos, duration):
		return (genericWrite(self.servoID, lssc.LSS_ActionMove, (str(pos) +lssc.LSS_ActionParameterTime + str(duration))))

You would then use it in the following manner:
myLSS.moveTime(900, 2000)

Please note I didn’t actually try the code above. It is just a rough idea of what seems like a simple way to implement this.


EDIT: Fixed the code above. The signature for genericWrite was not respected.

I used the same code you sent to us

def moveTime(self, pos, duration):
return (genericWrite(self.servoID, lssc.LSS_ActionMove, pos, (lssc.LSS_ActionParameterTime + str(duration))))


and it shows this error :

Traceback (most recent call last):
File “/home/pi/LSS_Library_Python/src/”, line 30, in
File “/home/pi/LSS_Library_Python/src/”, line 138, in moveTime
return (genericWrite(self.servoID, lssc.LSS_ActionMove, pos, (lssc.LSS_ActionParameterTime + str(duration))))
TypeError: genericWrite() takes from 2 to 3 positional arguments but 4 were given

1 Like

Indeed, that is wrong! :smiley:

My original call to genericWrite() was using 4 parameters instead of 3. I’ve edited the code above to fix the “param” value:

That will probably fix it. It should be noted that:

So do keep that in mind and experiment with the code if you get more errors during use! :slight_smile: