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.
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:
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!
Sincerely,
Thank you for your information. Just to be clear if I write:
myLSS1.move(D900T2000)
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 example_sweep.py 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:
The genericWrite function already supports writing a modifier after a command. By default, the modifier is empty. You can view this in /src/lss.py (lines 30-37). This function is the one used by all other functions to actually send commands to the LSS.
The move(self, pos) command (lines 135-136) can be used as a reference point to add the time modifier feature.
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 lss.py, 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.
Sincerely,
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))))
myLSS.moveTime(-300,2000)
and it shows this error :
Traceback (most recent call last):
File “/home/pi/LSS_Library_Python/src/example_sweep.py”, line 30, in
myLSS.moveTime(-300,2000)
File “/home/pi/LSS_Library_Python/src/lss.py”, 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
Indeed, that is wrong!
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!
Sincerely,