Git Product home page Git Product logo

adafruit_circuitpython_servokit's Introduction

Introduction

Documentation Status Discord Build Status Code Style: Black

CircuitPython helper library for the PWM/Servo FeatherWing, Shield and Pi HAT and Bonnet kits.

Dependencies

This driver depends on:

Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle.

Installing from PyPI

On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from PyPI. To install for current user:

pip3 install adafruit-circuitpython-servokit

To install system-wide (this may be required in some cases):

sudo pip3 install adafruit-circuitpython-servokit

To install in a virtual environment in your current project:

mkdir project-name && cd project-name
python3 -m venv .venv
source .venv/bin/activate
pip3 install adafruit-circuitpython-servokit

Usage Example

import time
from adafruit_servokit import ServoKit

# Set channels to the number of servo channels on your kit.
# 8 for FeatherWing, 16 for Shield/HAT/Bonnet.
kit = ServoKit(channels=8)

kit.servo[0].angle = 180
kit.continuous_servo[1].throttle = 1
time.sleep(1)
kit.continuous_servo[1].throttle = -1
time.sleep(1)
kit.servo[0].angle = 0
kit.continuous_servo[1].throttle = 0

Documentation

API documentation for this library can be found on Read the Docs.

For information on building library documentation, please check out this guide.

Contributing

Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.

adafruit_circuitpython_servokit's People

Contributors

brennen avatar dhalbert avatar evaherrada avatar foamyguy avatar jposada202020 avatar kattni avatar ladyada avatar sommersoft avatar spovlot avatar tannewt avatar tekktrik 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

adafruit_circuitpython_servokit's Issues

python3.6

can not i use adafruit-circuitpython-servokit with python3.6?

Hello, i'm trying to use PCA96885 Raspberry Pico running Micropython. it trows an error:- THIS ----ImportError: no module named 'busio'

import time
import busio

from adafruit_servokit import ServoKit
kit = ServoKit(channels=16,i2c=(busio.I2C(board.SCL, board.SDA)))

Tuned for GWS S03T STD Servos

kit.servo[0].set_pulse_width_range(775, 2450)
kit.servo[1].set_pulse_width_range(775, 2450)

Return servos to starting positions

kit.servo[0].angle = 0
kit.servo[1].angle = 180
time.sleep(1)

while True:
for tgtAngle in range(0, 180, 1):
kit.servo[0].angle = tgtAngle
kit.servo[1].angle = 180 - tgtAngle
time.sleep(0.1)
for tgtAngle in range(180, 0, -1):
kit.servo[0].angle = tgtAngle
kit.servo[1].angle = 180 - tgtAngle
time.sleep(0.1)

can you help me ,

Support for python2.7

Hello,
In one of my ros projects, I want to use this library, however there is no support for python 2.7. Do you consider adding it in a near future?

A function to access the current servo angle

If we can add a function to access the current angle of the servo that is commanded, the library will be much more useful. I am using PCA9685 in a robot and I need to access the current angle of the servo to command the next angle via increment.

continuous never stops

Hello,

so far my servo that is labeled continuous never stops.

This makes it turn CCW:
kit.continuous_servo[1].throttle = 1

This turns it CW
kit.continuous_servo[1].throttle = -1

This slows the CW spinning
kit.continuous_servo[1].throttle = 0

the python exits and the servo keeps running.

Can't release servo using Adafruit PCA9685 16-Channel Servo Driver

Hello!

I recently got the same issue as the topic starter. Still can't get around with it.

I got the Adafruit PCA9685 16-Channel Servo Driver connected to Raspberry Pi 4.

On my RPI following packages are installed in venv:

Adafruit-Blinka==7.3.0
adafruit-circuitpython-busdevice==5.1.8
adafruit-circuitpython-motor==3.3.5
adafruit-circuitpython-pca9685==3.4.1
adafruit-circuitpython-register==1.9.8
adafruit-circuitpython-servokit==1.3.8
adafruit-circuitpython-typing==1.7.0
Adafruit-PlatformDetect==3.22.1
Adafruit-PureIO==1.1.9
install==1.3.5
pkg-resources==0.0.0
pyftdi==0.54.0
pyserial==3.5
pyusb==1.2.1
rpi-ws281x==4.3.4
RPi.GPIO==0.7.1
sysv-ipc==1.1.0
typing-extensions==4.2.0

My python code is following:

from adafruit_servokit import ServoKit
import time

kit = ServoKit(channels=16)
kit.servo[0].angle = None
time.sleep(10)

During code execution and after it finish my servo keeps blocked.

Originally posted by @ananasn in #30 (comment)

Facing angular movement issue.

I'm trying to rotate the servo in a while loop by increment of 10 degrees on every iteration. I've set the acutation angle to 180 degrees, but when I tried to rotate the motor to 180 degrees it move upto a certain angle then stopped. I perform check on the angle then I found that whenever I set the angle of motor to 0 degrees it set the value of the servo to -0.36600244001626675.

When I set servo angle to 0-degree

>>> kit.servo[1].angle=0
>>> kit.servo[1].angle
-0.36600244001626675

When I set servo angle to 180-degrees

>>> kit.servo[1].angle=180
>>> kit.servo[1].angle
180.0

Can you please help me out with this?

No module named '_sysconfigdata_m_linux_aarch64-linux-gnu'

jetson@jetson:~$ pip3 install adafruit-circuitpython-servokit

Collecting adafruit-circuitpython-servokit
Using cached https://files.pythonhosted.org/packages/a2/65/5da8d1d4a22701fedf9dbae9094e40185d58be25b86175eb0861d55398a5/adafruit-circuitpython-servokit-1.3.10.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-build-oy6aixzt/adafruit-circuitpython-servokit/setup.py", line 61, in
py_modules=["adafruit_servokit"],
File "/usr/lib/python3/dist-packages/setuptools/init.py", line 128, in setup
_install_setup_requires(attrs)
File "/usr/lib/python3/dist-packages/setuptools/init.py", line 123, in _install_setup_requires
dist.fetch_build_eggs(dist.setup_requires)
File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 513, in fetch_build_eggs
replace_conflicting=True,
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 774, in resolve
replace_conflicting=replace_conflicting
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 1057, in best_match
return self.obtain(req, installer)
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 1069, in obtain
return installer(requirement)
File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 579, in fetch_build_egg
cmd.ensure_finalized()
File "/usr/lib/python3.7/distutils/cmd.py", line 107, in ensure_finalized
self.finalize_options()
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 292, in finalize_options
'site_dirs',
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1402, in _expand
config_vars = self.get_finalized_command('install').config_vars
File "/usr/lib/python3.7/distutils/cmd.py", line 299, in get_finalized_command
cmd_obj.ensure_finalized()
File "/usr/lib/python3.7/distutils/cmd.py", line 107, in ensure_finalized
self.finalize_options()
File "/usr/lib/python3/dist-packages/setuptools/command/install.py", line 38, in finalize_options
orig.install.finalize_options(self)
File "/usr/lib/python3.7/distutils/command/install.py", line 306, in finalize_options
(prefix, exec_prefix) = get_config_vars('prefix', 'exec_prefix')
File "/usr/lib/python3.7/distutils/sysconfig.py", line 508, in get_config_vars
func()
File "/usr/lib/python3.7/distutils/sysconfig.py", line 468, in _init_posix
_temp = import(name, globals(), locals(), ['build_time_vars'], 0)
ModuleNotFoundError: No module named '_sysconfigdata_m_linux_aarch64-linux-gnu'

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-oy6aixzt/adafruit-circuitpython-servokit/

Use unused PCA9685 FeatherWing's pin as inputs.

Hi,
I'm driving two servo motors using a Huzzah Feather esp8266 and a FeatherWing 8-channels PCA9685 board. Since this is leaving me with unused pins on wing board, I'd like to know if it's possible to use them as input pins to catch data from NC/NO switches or ultrasonic distance sensors.

self._button = Pin(5, mode=Pin.IN, pull=Pin.PULL_UP)

If so, how would I define one of those pins?

Thank you

Missing Type Annotations

There are missing type annotations for some functions in this library.

The typing module does not exist on CircuitPython devices so the import needs to be wrapped in try/except to catch the error for missing import. There is an example of how that is done here:

try:
    from typing import List, Tuple
except ImportError:
    pass

Once imported the typing annotations for the argument type(s), and return type(s) can be added to the function signature. Here is an example of a function that has had this done already:

def wrap_text_to_pixels(
    string: str, max_width: int, font=None, indent0: str = "", indent1: str = ""
) -> List[str]:

If you are new to Git or Github we have a guide about contributing to our projects here: https://learn.adafruit.com/contribute-to-circuitpython-with-git-and-github

There is also a guide that covers our CI utilities and how to run them locally to ensure they will pass in Github Actions here: https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/check-your-code In particular the pages: Sharing docs on ReadTheDocs and Check your code with pre-commit contain the tools to install and commands to run locally to run the checks.

If you are attempting to resolve this issue and need help, you can post a comment on this issue and tag both @FoamyGuy and @kattni or reach out to us on Discord: https://adafru.it/discord in the #circuitpython-dev channel.

The following locations are reported by mypy to be missing type annotations:

  • adafruit_servokit.py:65
  • adafruit_servokit.py:136
  • adafruit_servokit.py:139
  • adafruit_servokit.py:160
  • adafruit_servokit.py:163

can't release servo's after using them

What ever I tried, i can't find a way to release the servo's once they have been used without pulling the power of the PCA9585 board. But after pulling power and putting it back the servo's keep release until they are activated again.

Problem with ServoKit in Nvidia Xavier NX board.

I am using Nvidia Xavier NX board with PCA9685. Not sure if ServoKit has updated the version? Or The Nvidia Xavier NX Jetpack 4.4 does not support ServoKit library anymore...
I followed this youtube and his code works.
https://youtu.be/JSlJ8NVVWfQ?list=PLGs0VKk2DiYw_Xx7c3M_9HMEcn9hPhFJV&t=2773
I just used the example code, but in the line kit=ServoKit(channels=16), it gives error said ModuleNotFoundError: No module named 'machine'.
The error starts from adafriut_servokit.py --> ..python3.6/site-packages/busio.py...
Thx.
IMG_3853

"ValueError: SCL in use" occur when using Adafruit PCA9685 16-Channel Servo Driver

Hi!
I'm currently trying to drive some servos by using Adafruit PCA9685 16-Channel Servo Driver and Featherwing M4 Express. And I am using the example code in the Adafruit Learning System. However, although I ran the exact same code (with some changes to the I2C address because the PCA9685 board I'm using had been modified), I still get the error
Traceback (most recent call last): File "code.py", line 21, in <module> File "adafruit_servokit.py", line 88, in _ _init_ _ ValueError: SCL in use

And this is the code:
import board
import busio
import time
import adafruit_pca9685
i2c = busio.I2C(board.SCL, board.SDA)
from adafruit_servokit import ServoKit
kit = ServoKit(channels=16)
kit.servo[0].angle = 180
kit.continuous_servo[1].throttle = 1
time.sleep(1)
kit.continuous_servo[1].throttle = -1
time.sleep(1)
kit.servo[0].angle = 0
kit.continuous_servo[1].throttle = 0

I wonder where I did wrong. Thank you!

image

cannot import name 'Servokit' from 'adafruit_servokit'

I try to run this code:

from adafruit_servokit import Servokit

myKit = ServoKit(channels=16)
myKit.servo[0].angle = 90

but it gives me this error:
Screenshot from 2022-02-18 21-31-57
I've installed the library using sudo pip3 install adafruit-circuitpython-servokit and running the code with python 3.8

Delay using the I2C communication with ROS

I am using the Adafruit ServoKit library to send the signals to move my steering and motor conroller on the RC Autonomous Car. The Hardware used is PCA9685. I am generating the signal commands using MATLAB and sending it using ROS. Then the signals are passed from ROS to the hardware by using the adafruit library using python as the coding language. There is a build up of a delay every time I try to send the messages using the above described method.

Angle-Servo Moves but Continuous servo motor doesn't move

Describe the issue
I have one servo motor is connected to the first channel and another continuous motor is connected to channel 2 to the pca_9685

I've set up this library on my Jetson Xavier Nx and I managed to command an angle-servo motor but when I've commanded a continuous servo motor, it didn't move.

NVIDIA Jetson Hardware

  • [ X] Jetson Xavier Nx.

I"ve used this code

from adafruit_servokit import ServoKit
import board
import busio
import time
print("Initializing Servos")
Initializing Servos
i2c_bus0=(busio.I2C(board.SCL_1, board.SDA_1))
print("Initializing ServoKit")
Initializing ServoKit
kit = ServoKit(channels=16, address=0x41, i2c=i2c_bus0)

And when use this kit.servo[0].angle=30 the motor moves but when use this command kit.continuous_servo[1].throttle=0.5 the motor doesn't move.

Any help, please?

Added type annotations on latest update is not backwards compatible with python3.6>

Got this error:

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python3.5/py_compile.py", line 129, in compile
raise py_exc
py_compile.PyCompileError: File "./prog.py", line 1
from future import annotations
^
SyntaxError: future feature annotations is not defined

Fixed it by upgrading python but would be great to have an update that is backwards compatible with python 3.6 and below if possible. Thanks!

Using Adafruit_CircuitPython_ServoKit in a container

Hello,
I have no issues installing and enabling and using Adafruit_CircuitPython_ServoKit locally (outside container) on Jetson Nano.
I run this simple code (and servos move):

from adafruit_servokit import ServoKit

_kit = ServoKit(channels=16)
pan = 90
tilt = 90

kit.servo[0].angle = pan
kit.servo[1].angle = tilt_

But when installing it inside container and running the same code, I get the next message:

_Traceback (most recent call last):
File "/home/marko/Desktop/pyProg/NVIDIA/servotest.py", line 1, in
from adafruit_servokit import ServoKit
File "/usr/local/lib/python3.6/dist-packages/adafruit_servokit.py", line 35, in
import board
File "/usr/local/lib/python3.6/dist-packages/board.py", line 33, in
from adafruit_blinka.agnostic import board_id, detector
File "/usr/local/lib/python3.6/dist-packages/adafruit_blinka/agnostic/init.py", line 18, in
chip_id = detector.chip.id
File "/usr/local/lib/python3.6/dist-packages/adafruit_platformdetect/chip.py", line 350, in getattr
if self.id == attr:
File "/usr/local/lib/python3.6/dist-packages/adafruit_platformdetect/chip.py", line 350, in getattr
if self.id == attr:
File "/usr/local/lib/python3.6/dist-packages/adafruit_platformdetect/chip.py", line 350, in getattr
if self.id == attr:
[Previous line repeated 320 more times]
File "/usr/local/lib/python3.6/dist-packages/adafruit_platformdetect/chip.py", line 154, in id
self._chip_id = self._linux_id()
File "/usr/local/lib/python3.6/dist-packages/adafruit_platformdetect/chip.py", line 235, in linux_id
hardware = self.detector.get_cpuinfo_field("Hardware")
File "/usr/local/lib/python3.6/dist-packages/adafruit_platformdetect/init.py", line 49, in get_cpuinfo_field
with open("/proc/cpuinfo", "r") as infile:
File "/usr/lib/python3.6/codecs.py", line 309, in init
IncrementalDecoder.init(self, errors)
RecursionError: maximum recursion depth exceeded

What else am I missing in my container?

"i2cdetect -y -r 1" shows me that PCF9685 controler is visible inside container.
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: 40 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

Servos stuck when run servokit_all_servos_synchronised.

Hi, I run this example: servokit_all_servos_synchronised.py to rotate several servos MG996R through PCA9685 but it works partially. Sometimes, some of the servos stop moving and stop reacting to the angle changes. They stuck. Servos can do it by one or in couples. More servos I use - more probability of stopping. I use external power so I don't think that it's power-related.

I follow servokit_all_servos_synchronised example. If I connect 6 servos then this code will make at least one servo unresponsive during the first run. During the second run there may be one more unresponsive servo appear.
for i in range(len(kit.servo)):
kit.servo[i].angle = 180

I noticed that if I add delay then it works fine. For example:
for i in range(len(kit.servo)):
kit.servo[i].angle = 180
time.sleep(0.2)

0.2s is a small value that makes the servos move together but not exactly how I want it.
Do you have any idea why this happens? Is this example valid for PCA9685 ?

Servos don't travel nearly close to 180 degrees

I'm a bit new to CircuitPython, but when testing the servos (a few different brands) and the PCA9685, I change the angle about 90 degrees (from say 45 to 135), but it won't traverse the full 90 degrees. In practice I have to send about 120 degree change to the servo to get about 90 degrees of real-world rotation. (so if I want it to go from 0 to 90, I have to send 120).

Any ideas on why this is happening? Is there some way I can calibrate it or get closer to the full rotation of the servo?

kept having this after runnning my code

from adafruit_servokit import ServoKit
File "/usr/local/lib/python3.6/dist-packages/adafruit_servokit.py", line 35, in
import board
File "/home/jetson/.local/lib/python3.6/site-packages/board.py", line 39, in
import adafruit_platformdetect.constants.boards as ap_board
File "/home/jetson/.local/lib/python3.6/site-packages/adafruit_platformdetect/init.py", line 10, in
from .board import Board
File "/home/jetson/.local/lib/python3.6/site-packages/adafruit_platformdetect/board.py", line 24
from future import annotations
^
SyntaxError: future feature annotations is not defined

python3.6.9

usr/bin/python3 /home/nano/Desktop/PyProjects/teste_servos.py
Traceback (most recent call last):
File "/home/nano/Desktop/PyProjects/teste_servos.py", line 1, in
from adafruit_servokit import ServoKit
File "/usr/local/lib/python3.6/dist-packages/adafruit_servokit.py", line 35, in
import board
File "/usr/local/lib/python3.6/dist-packages/board.py", line 39, in
import adafruit_platformdetect.constants.boards as ap_board
File "/usr/local/lib/python3.6/dist-packages/adafruit_platformdetect/init.py", line 10, in
from .board import Board
File "/usr/local/lib/python3.6/dist-packages/adafruit_platformdetect/board.py", line 24
from future import annotations
^
SyntaxError: future feature annotations is not defined

I've already tryed to upgrade to 3.8 for example, but i have others issues, like just install opencv on the 3.6. or pip continue using the previous one.

How can i update my jetson? I'm using one by "yahboom" store.

I'm a beginner user.

ModuleNotFoundError: No module named 'setuptools.command.build'

jetson@jetson:~$ pip3 install adafruit-circuitpython-servokit
Collecting adafruit-circuitpython-servokit
Using cached https://files.pythonhosted.org/packages/a2/65/5da8d1d4a22701fedf9dbae9094e40185d58be25b86175 eb0861d55398a5/adafruit-circuitpython-servokit-1.3.10.tar.gz
Collecting Adafruit-Blinka>=7.0.0 (from adafruit-circuitpython-servokit)
Collecting adafruit-circuitpython-busdevice (from adafruit-circuitpython-servokit)
Collecting adafruit-circuitpython-register (from adafruit-circuitpython-servokit)
Downloading https://files.pythonhosted.org/packages/ab/6f/538ef9e9f7ac5c045287e3894d59963a1723e4fde7321d8 7d6d521071cc2/adafruit-circuitpython-register-1.9.10.tar.gz
Collecting adafruit-circuitpython-pca9685 (from adafruit-circuitpython-servokit)
Downloading https://files.pythonhosted.org/packages/0d/08/a2b02758b6467e43810cfefb654fabf0db94f53c035d3cd 75625d6206fd4/adafruit-circuitpython-pca9685-3.4.3.tar.gz
Collecting adafruit-circuitpython-motor (from adafruit-circuitpython-servokit)
Downloading https://files.pythonhosted.org/packages/30/1a/36eb785a4e82ef3209eb4db0c1013d2509a6c65fbfca205 75b5b0f8343c8/adafruit-circuitpython-motor-3.4.2.tar.gz
Collecting Jetson.GPIO (from Adafruit-Blinka>=7.0.0->adafruit-circuitpython-servokit)
Collecting Adafruit-PlatformDetect>=3.13.0 (from Adafruit-Blinka>=7.0.0->adafruit-circuitpython-servokit)
Collecting adafruit-circuitpython-typing (from Adafruit-Blinka>=7.0.0->adafruit-circuitpython-servokit)
Collecting pyftdi>=0.40.0 (from Adafruit-Blinka>=7.0.0->adafruit-circuitpython-servokit)
Using cached https://files.pythonhosted.org/packages/17/ce/a97811c3e7e2d5a9520b88801dcc70ac1b553ed31b9819 b2fce14ffa9aa3/pyftdi-0.54.0-py3-none-any.whl
Collecting Adafruit-PureIO>=1.1.7 (from Adafruit-Blinka>=7.0.0->adafruit-circuitpython-servokit)
Collecting typing-extensions; python_version <= "3.7" (from adafruit-circuitpython-typing->Adafruit-Blinka> =7.0.0->adafruit-circuitpython-servokit)
Using cached https://files.pythonhosted.org/packages/75/e1/932e06004039dd670c9d5e1df0cd606bf46e29a28e65d5 bb28e894ea29c9/typing_extensions-4.2.0-py3-none-any.whl
Collecting pyusb!=1.2.0,>=1.0.0 (from pyftdi>=0.40.0->Adafruit-Blinka>=7.0.0->adafruit-circuitpython-servok it)
Using cached https://files.pythonhosted.org/packages/15/a8/4982498b2ab44d1fcd5c49f07ea3795eab01601dc143b0 09d333fcace3b9/pyusb-1.2.1-py3-none-any.whl
Collecting pyserial>=3.0 (from pyftdi>=0.40.0->Adafruit-Blinka>=7.0.0->adafruit-circuitpython-servokit)
Using cached https://files.pythonhosted.org/packages/07/bc/587a445451b253b285629263eb51c2d8e9bcea4fc97826 266d186f96f558/pyserial-3.5-py2.py3-none-any.whl
Building wheels for collected packages: adafruit-circuitpython-servokit, adafruit-circuitpython-register, a dafruit-circuitpython-pca9685, adafruit-circuitpython-motor
Running setup.py bdist_wheel for adafruit-circuitpython-servokit ... done
Stored in directory: /home/jetson/.cache/pip/wheels/9a/8a/58/e96be07e59cbfe89bfd5236fe7b81841501b429ee455 67a3a4
Running setup.py bdist_wheel for adafruit-circuitpython-register ... done
Stored in directory: /home/jetson/.cache/pip/wheels/11/d2/b6/8084921c4e523d6deb345cb81c2df1f3da09aa51e768 b41015
Running setup.py bdist_wheel for adafruit-circuitpython-pca9685 ... done
Stored in directory: /home/jetson/.cache/pip/wheels/0f/58/bc/f8c6af6a09410abba78f345858391a76cdc8962e1fd7 716f77
Running setup.py bdist_wheel for adafruit-circuitpython-motor ... done
Stored in directory: /home/jetson/.cache/pip/wheels/f7/95/0c/1e04540b0d61ba8b47cec19532256d936d530ccc12f9 17089f
Successfully built adafruit-circuitpython-servokit adafruit-circuitpython-register adafruit-circuitpython-p ca9685 adafruit-circuitpython-motor
Installing collected packages: Jetson.GPIO, Adafruit-PlatformDetect, typing-extensions, adafruit-circuitpyt hon-busdevice, adafruit-circuitpython-typing, pyusb, pyserial, pyftdi, Adafruit-PureIO, Adafruit-Blinka, ad afruit-circuitpython-register, adafruit-circuitpython-pca9685, adafruit-circuitpython-motor, adafruit-circu itpython-servokit
Exception:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 360, in run
prefix=options.prefix_path,
File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 784, in install
**kwargs
File "/usr/lib/python3/dist-packages/pip/req/req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/usr/lib/python3/dist-packages/pip/req/req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "/usr/lib/python3/dist-packages/pip/wheel.py", line 247, in move_wheel_files
prefix=prefix,
File "/usr/lib/python3/dist-packages/pip/locations.py", line 153, in distutils_scheme
i.finalize_options()
File "/usr/share/python-wheels/setuptools-39.0.1-py2.py3-none-any.whl/setuptools/command/install.py", lin e 38, in finalize_options
orig.install.finalize_options(self)
File "/usr/lib/python3.7/distutils/command/install.py", line 390, in finalize_options
('build_lib', 'build_lib'))
File "/usr/lib/python3.7/distutils/cmd.py", line 286, in set_undefined_options
src_cmd_obj = self.distribution.get_command_obj(src_cmd)
File "/usr/lib/python3.7/distutils/dist.py", line 857, in get_command_obj
klass = self.get_command_class(command)
File "/usr/share/python-wheels/setuptools-39.0.1-py2.py3-none-any.whl/setuptools/dist.py", line 634, in g et_command_class
self.cmdclass[command] = cmdclass = ep.load()
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/init.py", line 2324, in load
return self.resolve()
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/init.py", line 2330, in resolve
module = import(self.module_name, fromlist=['name'], level=0)
ModuleNotFoundError: No module named 'setuptools.command.build'

Could not find a version that satisfies the requirement Adafruit-Blinka>=7.0.0

hey im trying to install adafruit-circuitpython-servokit but i keep getting this error:
Collecting Adafruit-Blinka>=7.0.0 (from adafruit-circuitpython-servokit)
Could not find a version that satisfies the requirement Adafruit-Blinka>=7.0.0 (from adafruit-circuitpython-servokit) (from versions: 0.1.3, 0.1.4, 0.1.5, 0.1.6, 0.1.7, 0.1.8, 0.1.9, 0.1.10, 0.2, 0.2.1, 0.2.2, 0.2.3, 0.2.4, 0.2.5, 0.2.6, 0.2.7, 0.3.0, 0.3.1, 0.3.2, 0.4.0, 1.0.2, 1.1.0, 1.1.1, 1.2.0, 1.2.1, 1.2.3, 1.2.4, 1.2.5, 1.2.6, 1.2.7, 1.2.8, 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 2.0.0, 2.0.1, 2.0.2, 2.1.0, 2.1.1, 2.1.2, 2.1.3, 2.1.4, 2.1.5, 2.1.6, 2.2.0, 2.2.1, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.4.0, 2.4.1, 2.5.0, 2.5.1, 2.5.2, 2.5.3, 2.6.0, 2.6.1, 3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.0.6, 3.0.7, 3.0.8, 3.1.0, 3.1.1, 3.1.2, 3.2.0, 3.3.0, 3.3.1, 3.3.2, 3.3.3, 3.3.4, 3.3.5, 3.3.6, 3.3.7, 3.3.8, 3.3.9, 3.3.10, 3.4.0, 3.4.1, 3.5.0, 3.5.1, 3.5.2, 3.6.0, 3.6.1, 3.7.0, 3.7.1, 3.8.0, 3.9.0, 3.10.0, 4.0.0, 4.1.0, 4.2.0, 4.3.0, 4.4.0, 4.5.0, 4.6.0, 4.7.0, 4.8.0, 4.8.1, 4.9.0, 4.10.0, 4.10.1, 5.0.0, 5.0.1, 5.1.0, 5.2.0, 5.2.1, 5.2.2, 5.2.3, 5.2.4, 5.3.0, 5.3.1, 5.3.2, 5.3.3, 5.3.4, 5.4.0, 5.4.1, 5.5.0, 5.5.1, 5.5.2, 5.5.3, 5.5.4, 5.6.0, 5.7.0, 5.8.0, 5.8.1, 5.8.2, 5.9.0, 5.9.1, 5.9.2, 5.10.0, 5.11.0, 5.12.0, 5.13.0, 5.13.1, 6.0.0, 6.0.1, 6.0.2, 6.1.0, 6.2.0, 6.2.1, 6.2.2, 6.3.0, 6.3.1, 6.3.2, 6.4.0, 6.4.1, 6.4.2, 6.5.0, 6.6.0, 6.6.1, 6.6.2, 6.7.0, 6.8.0, 6.8.1, 6.8.2, 6.8.3, 6.9.0, 6.9.1, 6.9.2, 6.10.0, 6.10.1, 6.10.2, 6.10.3, 6.11.0, 6.11.1, 6.12.0, 6.13.0, 6.13.1, 6.14.0, 6.14.1, 6.15.0)
No matching distribution found for Adafruit-Blinka>=7.0.0 (from adafruit-circuitpython-servokit)

sphinx does not properly link to adafruit_motor classes

Something is not quite right with the Sphinx links for adafruit_motor. The servokit API page has the strings :py:class:~adafruit_motor.servo.ContinuousServo and :py:class:~adafruit_motor.servo.Servo rather than linking to the class docs for ContinuousServo and Servo.

I was looking at this a bit, and I can't figure out how to make Sphinx link those classes, but maybe someone has some idea?

no module named 'adafruit_servokit'

Hi there,

I have already used HAT or Bonnet channel PWM over the past few month and now I am configuring an new raspberry PI.

I did follow the instructions here :https://learn.adafruit.com/adafruit-16-channel-pwm-servo-hat-for-raspberry-pi/using-the-python-library (I already enabled i2c, the raspberry can detect my board)

And then I ran :sudo pip3 install adafruit-circuitpython-servokit
which gives me logs :
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Requirement already satisfied: adafruit-circuitpython-servokit in /usr/local/lib/python3.5/dist-packages (1.3.0) Requirement already satisfied: adafruit-circuitpython-busdevice in /usr/local/lib/python3.5/dist-packages (from adafruit-circuitpython-servokit) (5.0.1) Requirement already satisfied: Adafruit-Blinka in /usr/local/lib/python3.5/dist-packages (from adafruit-circuitpython-servokit) (5.4.0) Requirement already satisfied: adafruit-circuitpython-motor in /usr/local/lib/python3.5/dist-packages (from adafruit-circuitpython-servokit) (3.2.3) Requirement already satisfied: adafruit-circuitpython-pca9685 in /usr/local/lib/python3.5/dist-packages (from adafruit-circuitpython-servokit) (3.3.2) Requirement already satisfied: adafruit-circuitpython-register in /usr/local/lib/python3.5/dist-packages (from adafruit-circuitpython-servokit) (1.9.0) Requirement already satisfied: RPi.GPIO in /usr/lib/python3/dist-packages (from Adafruit-Blinka->adafruit-circuitpython-servokit) (0.6.5) Requirement already satisfied: sysv-ipc in /usr/local/lib/python3.5/dist-packages (from Adafruit-Blinka->adafruit-circuitpython-servokit) (1.0.1) Requirement already satisfied: rpi-ws281x>=4.0.0 in /usr/local/lib/python3.5/dist-packages (from Adafruit-Blinka->adafruit-circuitpython-servokit) (4.2.4) Requirement already satisfied: Adafruit-PlatformDetect>=2.15.1 in /usr/local/lib/python3.5/dist-packages (from Adafruit-Blinka->adafruit-circuitpython-servokit) (2.17.0) Requirement already satisfied: Adafruit-PureIO>=1.1.5 in /usr/local/lib/python3.5/dist-packages (from Adafruit-Blinka->adafruit-circuitpython-servokit) (1.1.5) Requirement already satisfied: pyftdi>=0.40.0 in /usr/local/lib/python3.5/dist-packages (from Adafruit-Blinka->adafruit-circuitpython-servokit) (0.52.0) Requirement already satisfied: pyserial>=3.0 in /usr/lib/python3/dist-packages (from pyftdi>=0.40.0->Adafruit-Blinka->adafruit-circuitpython-servokit) (3.2.1) Requirement already satisfied: aenum>=2.1.0; python_version == "3.5" in /usr/local/lib/python3.5/dist-packages (from pyftdi>=0.40.0->Adafruit-Blinka->adafruit-circuitpython-servokit) (2.2.4) Requirement already satisfied: pyusb>=1.0.0 in /usr/local/lib/python3.5/dist-packages (from pyftdi>=0.40.0->Adafruit-Blinka->adafruit-circuitpython-servokit) (1.1.0) You are using pip version 19.0.3, however version 20.2.3 is available. You should consider upgrading via the 'pip install --upgrade pip' command.

Which clearly make me think that the servokit module is installed but once I launch my little project, I get the following issue :
Traceback (most recent call last):
File "server.py", line 7, in
from servos import Servos
File "/home/pi/backup excell/servos.py", line 9, in
from adafruit_servokit import ServoKit
ImportError: No module named 'adafruit_servokit'

Can someone help me please ? I cannot see what I did wrong

No Way to Reset PWM_hat.

Hello!
I followed this tutorial off the adafruit webpage:
https://cdn-learn.adafruit.com/downloads/pdf/adafruit-16-channel-pwm-servo-hat-for-raspberry-pi.pdf

I am making a robotic arm and after my code stops the pwm_hat is still broadcasting the PWM signal to the servos. I am looking for a way to stop the signal.
On page 17 of the linked documentation it says to substantiate the pwm object

pwm = PWM(0x40)

and then call the method setPWM(). I wanted to use the method

pwm.setPWM(servo, 0, 0)

to make the signal low on all ticks. The issue is non of the libraries have the class PWM. I even did

from PCA9865 import *

and still nada.

Could this servo kit library give a way to reset the PWM Hat to stop broadcasting?

AttributeError: module 'board' has no attribute 'I2C'

Summary of Issue

Attempting to initialize the class object from ServoKit results in the following error:

Traceback (most recent call last):
  File "servo_test.py", line 3, in <module>
    kit = ServoKit(channels=16)
  File "/usr/local/lib/python3.5/dist-packages/adafruit_servokit.py", line 85, in __init__
    i2c = board.I2C()
AttributeError: module 'board' has no attribute 'I2C'

Hardware

  • Raspberry Pi 3 Model B
  • Adafruit 16-Channel 12-bit PWM/Servo Driver - I2C interface - PCA9685
  • (2x) GWS S03T STD Servos

Software and Environment

servo_test.py

import time
from adafruit_servokit import ServoKit
kit = ServoKit(channels=16)

# Tuned for GWS S03T STD Servos
kit.servo[0].set_pulse_width_range(775, 2450)
kit.servo[1].set_pulse_width_range(775, 2450)

# Return servos to starting positions
kit.servo[0].angle = 0
kit.servo[1].angle = 180
time.sleep(1)

while True:
    for tgtAngle in range(0, 180, 1):
        kit.servo[0].angle = tgtAngle
        kit.servo[1].angle = 180 - tgtAngle
        time.sleep(0.1)
    for tgtAngle in range(180, 0, -1):
        kit.servo[0].angle = tgtAngle
        kit.servo[1].angle = 180 - tgtAngle
        time.sleep(0.1)

Notes

  • I previously had CircuitPython ServoKit working with the Python code sample and two servos one week ago
  • This morning, I had to completely reformat and re-setup my Raspberry Pi due to an unrelated issue
  • After reinstalling CircuitPython ServoKit and all dependencies from scratch, I found that my existing code no longer works and instead returned the titular error message, so I presume there was a change in adafruit_servokit.py between my two installations
  • Examining adafruit_servokit.py, I noticed that line 85 was previously (828a46c) defined as i2c = busio.I2C(board.SCL, board.SDA) instead of the current i2c = board.I2C(); perhaps this line may be of interest
  • The blinkatest.py example currently still works because it uses the older i2c = busio.I2C(board.SCL, board.SDA)

Zero Division Error

Hey There, i am trying to control a servo via PCA9685 and having this error from servo example scripts :
`Traceback (most recent call last):
File "/home/pi/Desktop/tri.py", line 33, in
servo7 = servo.Servo(pca.channels[7])
File "/home/pi/.local/lib/python3.5/site-packages/adafruit_motor/servo.py", line 103, in init
super().init(pwm_out, min_pulse=min_pulse, max_pulse=max_pulse)
File "/home/pi/.local/lib/python3.5/site-packages/adafruit_motor/servo.py", line 45, in init
self.set_pulse_width_range(min_pulse, max_pulse)
File "/home/pi/.local/lib/python3.5/site-packages/adafruit_motor/servo.py", line 49, in set_pulse_width_range
self._min_duty = int((min_pulse * self._pwm_out.frequency) / 1000000 * 0xffff)
File "/home/pi/.local/lib/python3.5/site-packages/adafruit_pca9685.py", line 71, in frequency
return self._pca.frequency
File "/home/pi/.local/lib/python3.5/site-packages/adafruit_pca9685.py", line 145, in frequency
return self.reference_clock_speed / 4096 / self.prescale_reg
ZeroDivisionError: float division by zero

`

It might happen cause of PCA gets clock speed as 0.
What shall i do to fix this ?
Thanks.

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.