Issues & questions using LSS and Python library

This most likely indicated that both LSS have the same ID still.

And following up, this would happen (answer : None) because both LSS answer at the same time and garble the answer on the bus (due to bus contention, since they have the same ID).

Agreed. It seems like both of them have the same ID. specially ID zero. If I set one of them at ID=0 then both run and if I set one is 1 and another is 2 or whatever number not zero then they don’t work.
So there are 6 ports on the Adapter board. Do they have their own address or we just need to initialize them? Or does it have the driver…? Just thinking
My program is ready for the project but I am stuck with the issue.
I tried to plug motor to different ports and nothing changed. So any port would be a servoID zero as soon as we initialize the ID for it?

1 Like

Hmm, lots of stuff to unpack here… :slight_smile: Let go through your comments/questions one by one:

Indeed, that seems to be the case.

How do you change its ID?

Same question as above, how do you set their IDs? Through an Arduino application? LSS Config? Something else (like xterm, putty, etc.)?

The 6 ports are simply physical connections to one common bus. There are no special electronics on them to differentiate them and no initialization of any kind is required. They are simply electrical connections to each of the 4 pins of the ports all tied together in parallel, thus creating one bus.

No worries, we’ll get down to the real cause shortly I am certain! You have a working LSS Adapter Board, power supply and LSS so this is most likely a simple configuration/use case issue. I.E.: Your hardware seems fine.

See the answer above concerning the ports and how they work. This indeed would not change anything.

I feel there might be a misconception on your end concerning how the LSS ID work and how they are used in practice.

I figure it is always best to make sure we start on some common ground, so let me get into some details about this and then what steps you’ll need to take to fix this issue. I apologize in advance if most of what I write here you already know!

The first step here is to read the details concerning the protocol and the ID of the LSS. You can do so here.
Simply put:

  • Each LSS on a bus that have the same baud rate should have a unique ID assigned to them.
  • Those IDs can be any value from 0 to 250 (inclusively).
  • All LSS are shipped by default with the ID set to 0.
  • To use two or more LSS on the same bus you need to first change their IDs individually (one at a time on the bus).

Then, lets fix those IDs!
In your setup, do the following:

  1. Optional (but recommended: obtain two post its and a pen/pencil first! :slight_smile:
  2. Make sure you have the LSS Adapter connected to your computer and power supply. Remove all LSS from the bus / connectors.
  3. Open up the LSS Config (make sure you have the latest version) and connect to the proper port.
  4. Turn off the power supply power, connect one LSS (doesn’t matter which one) and turn on the power again.
  5. Scan for the LSS on the bus. This should be pretty quick since there is only one to find.
  6. Check the data on the bottom left. You will see the ID. If it is zero, change it to something else.
    (if you did get a post-it and pen/pencil, write the number on it and stick it to that LSS)
  7. Disconnect form the bus in the LSS Config, power it down and remove that LSS from the bus. Connect the other one, power it up and reconnect in the LSS Config. Then, perform another scan.
  8. Once the LSS is found change its ID to something that is not zero and not the value chosen in step 5.
    (if you did get a post-it and pen/pencil, write the number on it and stick it to that LSS)
  9. Disconnect and power down again. Connect the first LSS to the bus. You should now have both connected at the same time. Power everything up and reconnect in the LSS Config. Scan for the LSS. The process should find two LSS. Make sure they are both available and responsive.

If you hit any issues in these steps please report back here at which one and the details before continuing the process!

Looking forward to your reply!

Sincerely,

2 Likes

OK . Will do but still have question.
I connect the LSS adapter to the PC directly? Right now it is connected to the raspberry pi. Or do you mean the pi is a computer…
How to LSS Config? and how do I know I have a latest version?
I thought I change the ID just simply initialize it in creating object by command myLSS = lss.LSS(ID) though :slight_smile:

1 Like

Or do you want me to download the LSS - Configuration Software to the computer then change the ID of LSS then connect them to the raspberry?

1 Like

If you have a Windows-based PC that would be best.

You can obtain a copy here.

Yes, this is a possibility. Since you’ve been trying to do this unsuccessfully though, I think it is time to try a different approach to help you move forward with your project!

Yes! :slight_smile:

Yes.

To be fair, you could do the changes from the Raspberry Pi directly (without using code), too.
From the RPi, open some kind of serial comm terminal to the port at the appropriate baud rate. Plenty of software exist to do this so search online for one that fits your needs and distro.

Then, following the steps above, replace the scans with #254QID\r (since only one LSS is on the bus, only one answer should come back). You can then use a #[id from response]CID[new id]\r to change it. Then send a reset to the LSS using the old ID. Repeat for the second LSS (one on the bus only).

You can then try some D commands and QD to see if they answer properly with their different IDs.

1 Like

Hello,
After scanning and change the ID to 1. I don’t see any UPDATE button or something to apply the change?
Or press scan again?
Thanks

1 Like

Never mind. Found it

1 Like

For reference to anyone else reading this, you can find more details here. The update button is on the bottom right corner of the the LSS Config.

Good morning,
I have changed the ID and made them work as I expected successfully. The issue is solved. Thanks for your help.

There are two motors and every time I turn the power off and turn it back on there is one motor that always moves back to zero from wherever it is and returns the position -1 or -2 (I did not remember what I have done with it) cause I got it from the first order. The another one (I got from the second order) doesn’t. How to set it up so that it moves back to zero from wherever it is? I like both move back to zero from where they are when I turn power on.

Thanks

1 Like

Great!

A LSS going back to 0 (or any other position, really) on power-up means you configured it to use a “first position”. This is a position that is “played back” to the LSS on power-up before accepting any commands. It basically simulates sending a “D” command to the set position. You can read more about that setting here.

As a side note, you should really read that entire page! It is full of useful information about all the features you can use/configure/query of the LSS!

If you manually query both of your LSS with QFD you’ll see what values they are set to. Most likely one is set to 0 and the other will return DIS (i.e.: not set).

If may be worth mentioning that while the LSS is operating the virtual position (the value you use/query with commands like D, QD, CDF, etc.) can go for to very large numbers. But, on power-up, the 0 (or whatever you set the CFD to be) position the LSS will go to, while it will always be the same physically (same angle of the horn vs the case), it may go in an expected direction.

This is due to the absolute magnetic encoder used in the LSS internally. This encoder, at power-up, can only say where it is in relationship to the LSS, but it does not know about how many times it turned previously before the power cycle. Therefore, if using an assembly where the LSS cannot turn freely in both directions (most robots are like that), make sure to power-off the LSS in a position where it will be safe to rotate to your CDF.

At power-up, the LSS will setup/report a position in the range of -1800 to 1800 (centered on the offsets) if you query it with QD. When you set it to go to 0 (ex: by configuring it with CFD0), it will move using the shortest path to the target position. So if during its last operation it ended in a position where it would power-up with the opposite polarity (ex: it powers downs at position 2700 or 270.0° but will power-on at a negative value, since 2700 is outside of the startup range) you may be surprised by the LSS moving in the opposite of the expected direction when CFD is “played back”.

So, basically, try your setup and run a few tests just to see how it goes with your use case! Just keep in mind the position and the potential impact of power cycles to your assembly (i.e.: loosing the virtual position between power cycles).

1 Like

Thank you.
I appreciate it.
Everything is in place now. Just order some more brackets then go…:slight_smile:

1 Like

Good! :slight_smile:
Glad to see this resolved for you… now you get to the fun part: the actual project! :smiley:

You always need more brackets… :sweat_smile:

Feel free to share about your project here. I’m sure others in the community would be interested and if you ever need more help in the future it would probably make it easier for others to get involved, too! :slight_smile:

Good luck and enjoy!

Hello,
I got a problem about the position.
Saying I have two points. A {X=20 (2degrees) Y = 45} and B {X = 55, Y = 60}.
If I start from HOME (zero degree for both motors X and Y), then I can move to point A by using command XLSS.move(20), YLSS.move(45) and the same with B. I can get very close to where A & B are.
If I am at A position and I want to move to B. I use XLSS.move(55), YLSS.move(60) or if I am at B and I want to move back to A by using XLSS.move(20), YLSS.move(45) then I never get to the position as I expected.
Any ideas of where am I missing? (absolute and incremental positioning)

Thanks

1 Like

Yes.

Yes I have. You are moving by 2-3 degrees. Such a small amount of movement will inevitably (in EM=1 [Motion Control Mode], the default mode) never travel at full speed and therefore not get to the exact position due to lack of torque. In DC motors, torque and speed are closely related with the voltage level (used to control the speed).

Therefore, there are a few options:

  1. Increase stiffness, either or both AS and AH (see here)
    This will make motions a bit more “jerky” but also force more power to reach the desired positions. Increase by 1 at a time and test with your setup.
  2. Use EM=0 and play with advanced motion control settings.

I recommend trying option 1 first. Also, you can change AS and AH between moves as needed, too.

1 Like

Thanks Scharette,
Here is my parameter that I set for my both motors before I post the question:
SetMaxSpeed(50)
SetAngularStiffness(2)
SetAngularDeceleration(80)
Are they OK?

1 Like

I’d recommend that you only modify angular stiffness and angular holding stiffness instead. And you’d probably want to increase them (especially holding stiffness) to a value higher than the default.

If I remember correctly the default values are (in EM=1, default control mode):
AS = 0 (all models)
AH = 4 (ST); = 4 (HT); = 2 (HS)

1 Like

Hi,
I got the error this morning:
STraceback (most recent call last):
File “/home/pi/LSS_Library_Python/src/test.py”, line 15, in
lss.initBus(CST_LSS_Port, CST_LSS_Baud)
File “/home/pi/LSS_Library_Python/src/lss.py”, line 21, in initBus
LSS.bus = serial.Serial(portName, portBaud)
File “/usr/lib/python3/dist-packages/serial/serialutil.py”, line 240, in init
self.open()
File “/usr/lib/python3/dist-packages/serial/serialposix.py”, line 268, in open
raise SerialException(msg.errno, “could not open port {}: {}”.format(self._port, msg))
serial.serialutil.SerialException: [Errno 2] could not open port /dev/ttyUSB0: [Errno 2] No such file or directory: ‘/dev/ttyUSB0’

How to reinstall the the file /dev/ttyUSB0?

Thanks

2 Likes

Never mind. The issue is fixed.
Just restart the raspberry. :slight_smile:

2 Likes

:wink: image :wink:

1 Like