ccourson / xarmservocontroller Goto Github PK
View Code? Open in Web Editor NEWLewanSoul-Lobot-HiWonder 6-DOF xArm servo controller libraries
Home Page: https://ccourson.github.io/xArmServoController/
License: MIT License
LewanSoul-Lobot-HiWonder 6-DOF xArm servo controller libraries
Home Page: https://ccourson.github.io/xArmServoController/
License: MIT License
I am using xarm to try and control my LeArm 6-DOF robotic arm via a USB connection. I am running on a Windows 10 machine and have pip installed the xarm library, and the libapi library. I am able to connect to the arm and print out the serial number. However when I try and get the position of one of the servos (it doesn't matter which one) I get the following error:
Traceback (most recent call last):
File "C:\Users\aaron\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\aaron\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "c:\Users\aaron.vscode\extensions\ms-python.python-2022.4.1\pythonFiles\lib\python\debugpy_main.py", line 45, in
cli.main()
File "c:\Users\aaron.vscode\extensions\ms-python.python-2022.4.1\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 444, in main
run()
File "c:\Users\aaron.vscode\extensions\ms-python.python-2022.4.1\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 285, in run_file
runpy.run_path(target_as_str, run_name=compat.force_str("main"))
File "C:\Users\aaron\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 268, in run_path
return _run_module_code(code, init_globals, run_name,
File "C:\Users\aaron\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "C:\Users\aaron\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "c:\Users\aaron\Documents\SeatSpy\GitHubRepos\robot-arm\main.py", line 7, in
position = arm.getPosition(1)
File "c:\Users\aaron\Documents\SeatSpy\GitHubRepos\robot-arm\venv\lib\site-packages\xarm\controller.py", line 91, in getPosition
data = self._recv(self.CMD_GET_SERVO_POSITION)
File "c:\Users\aaron\Documents\SeatSpy\GitHubRepos\robot-arm\venv\lib\site-packages\xarm\controller.py", line 174, in _recv
if self._input_report[0] == self.SIGNATURE and self._input_report[1] == self.SIGNATURE and self._input_report[3] == cmd:
IndexError: list index out of range
The code I am attempting to run is as follows:
import xarm
arm = xarm.Controller('USB')
servo1 = xarm.Servo(1)
position = arm.getPosition(1)
print('Servo 1 position:', position)
I have inspected the self._input_report
variable and it is set to an empty list
Any help would be appreciated!
Additionally, I am also confused about how the setPosition function works, when I pass an angle of 0.0 the servo moves to its minimum value, and when I set 125.0 (which seems to be the max value from the docs) the servo only moves about 45 degrees from the 0.0 position, and any negative value I pass does nothing. Is there something I am misunderstanding, why can't I get the full range of motion for the servos?
xarm
doesn't work with learm I bought on Amazon.
File "/home/engineer/workspace/learm/demo.py", line 5, in <module>
arm = xarm.Controller('USB')
File "/home/engineer/.local/lib/python3.10/site-packages/xarm/controller.py", line 27, in __init__
self._device.open(DID, VID)
File "hid.pyx", line 142, in hid.device.open
OSError: open failed
Code snippet
import xarm
arm = xarm.Controller('USB')
How I can fix this?
I have a LeArm robot arm. Usually before programming with Arduino IDE I check the com port of the board. But it doesn't show up after connecting USB. Not sure if it's possible to program the board via USB?
My question basically is: when connecting with USB, which port should we use in arduino IDE?
i keep getting this problem and all attempts to fix it seem to just make more problems and when trying to do it the arduino way the arm would just beep then just not do anything getposition would always return 500 for all servos (even when the servos werent at 500) and get voltage always showed -1 but it wasnt exactly clear how you connect the arm to the arduino so maybe i messed something up there
I followed the instruction to install necessary packages and I found that pip didn't work.
Whenever I used pip3, it worked well.
Good afternoon,
i am not too familiar with HID manipulation but i keep receiving this issue when i try to run test.py
import pywinusb.hid as hid
ModuleNotFoundError: No module named 'pywinusb'
i do have pywinusb installed but it for some reason is not catching it
any help is appreciated. Thanks
when the script strips serial number from USB, it strip part of the serial number if it contains B like below
arm = xarm.Controller('USBMM32F103RB',debug=True)
MM32F103R
fix it the below line to replace and the strip
serial_number = com_port.replace('USB','').strip()
import xarm
arm = xarm.Controller('USB')
battery_voltage = arm.getBatteryVoltage()
print('Battery voltage (volts):', battery_voltage)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.