I am trying to implement LSS HT1 for rotational control of a coupling device. Using the python library found within this tutorial here. The example_sweep.py code is able to be compiled and ran on the RPi 4B. However, the servo does not respond to commands within the loop. I know the code is running due to the ‘helloWorld’ statement inserted into the while loop. Essentially, when the code is compiled nothing happens other than the repeated statement. I know the library was intended for use with RPi model 3, however, it is unclear why the servo is inoperative on the model 4.
I am able to control the servo as intended by using both the Configuration Software and an Arduino Uno. However, when trying to control the servo using the RPi 4 I am unsuccessful. Below is a figure with the attached source code being tested as well as the command shell.
Any input on using the LSS library with the RPi 4 would be greatly appreciated.
Well, the library is in Python and therefore - provided you have the Python and the pySerial - it should work fine without any further requirements. Actually, when I coded the first iteration of the library my RPi was not even working so I tested it on a PC! Once we tried it on the RPi it worked just as well with no modifications.
This brings us to the next point:
What is not working, then?
That is great! At least we know part of your setup is working well. I’ll make some assumptions here so let me know if any of those are wrong:
You have one (or more) LSS connected to a LSS Adapter.
This LSS Adapter is connected by USB to your Raspberry Pi 4.
This LSS Adapter is also connected to the official 12 V DC power supply.
Possible issues:
Wrong/missing/faulty library: probably not the case since the code runs. As a side note, Python is interpreted, not compiled.
Wrong port: again, would probably show up as an error (unless there are more than one valid port and the one chosen is the wrong one!)
Wrong ID selected: you’ve changed your LSS’ ID to something other than 0 (default value)
Electrical connection issue on data path: the TX/RX/GND connection is not proper with the LSS, the LSS Adapter Board or the TX/RX <> USB interface. This also seems quite unlikely since you are able to use the LSS Config and Arduino.
Since you have it running with Arduino (which were created to be the exact same examples as the Python one), please confirm the ID of your LSS is 0. If that is the case then I’d propose you’ve simply selected the wrong (but a valid) port.
Could you share how you used the Arduino uno to control the smart servo as it’s not working with me, I am trying to command the servo to go to a certain position however it’s not accepting the input by the user
@Skyscraper04 Welcome to the RobotShop Community. You’ll need to provide a lot more information - ideally photos of your setup so we can see what you’re doing and what you have connected. Please also share the code and how you’re trying to operate the servos.