Coder Social home page Coder Social logo

ccourson / xarmservocontroller Goto Github PK

View Code? Open in Web Editor NEW
55.0 5.0 28.0 89 KB

LewanSoul-Lobot-HiWonder 6-DOF xArm servo controller libraries

Home Page: https://ccourson.github.io/xArmServoController/

License: MIT License

C++ 45.99% Python 38.24% Makefile 0.13% Visual Basic .NET 15.64%
xarm robotics arduino-library python arduino pc raspberry-pi cpp

xarmservocontroller's People

Contributors

ccourson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

xarmservocontroller's Issues

List index out of range Index error when getting servo position

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?

OSError: open failed

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?

Can we use the USB port for programming?

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 cant get this to work for python or arduino is this outdated or broken?

image

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

Installation error for python

I followed the instruction to install necessary packages and I found that pip didn't work.
Whenever I used pip3, it worked well.

module 'hid' has no attribute 'device'.

device
I've been trapped by this bug for a long time. And I've tried many methods, such as uninstall hid and install hidap, but it will reflect new bug like no module named hid. What should I do now? Thank you very much!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.