stevej52 / ros2_pca9685

ROS2 Package to convert /cmd_vel topic to PWM signals using a PCA9685
Apache License 2.0
9 stars 3 forks source link

error while building : error: can't copy 'resource/ros2_pca9685': doesn't exist or not a regular file #1

Open vibhubithar opened 2 years ago

vibhubithar commented 2 years ago

Thanks for the driver

when trying to use I am getting error message

error: can't copy 'resource/ros2_pca9685': doesn't exist or not a regular file

My setup: RPI4 PCA9685 Ubuntu 20 LTS server ROS2 FOxy

Steps to reproduce:

  1. I setup my system based on ros2 Debian package wiki
  2. then tested the setup with listener and talker example
  3. Copied the ros2_pca9685 package into the "src" folder
  4. I get the error

ubuntu@ubuntu:~/ros2_ws$ colcon build --packages-select ros2_pca9685 Starting >>> ros2_pca9685 --- stderr: ros2_pca9685
error: can't copy 'resource/ros2_pca9685': doesn't exist or not a regular file

Failed <<< ros2_pca9685 [2.16s, exited with code 1]

Summary: 0 packages finished [2.60s] 1 package failed: ros2_pca9685 1 package had stderr output: ros2_pca9685

joncamp commented 2 years ago

Adding an empty ros2_pca9685/resource/ros2_pca9685 seems to bypass the build issue

HusamZain commented 2 years ago

now it works. I created a folder with name 'resource' inside the 'pca9685' folder along with the package file and ... inside the resource folder created an empty file and named it as 'pca9685' then build .

FPSychotic commented 2 years ago

I had the same error , made the folder and file and it compiled. but when I run the model it says doesn't exist ROS2 Humble RPI4 22.04 Help would be appreciated I need this working to can make my robot runs, It is built I cannot modify it only solution would be go to 20.04 but it is a problem for other reasons.

<pre>Starting &gt;&gt;&gt; ros2_pca9685
/usr/local/lib/python3.10/dist-packages/setuptools/dist.py:771: UserWarning: Usage of dash-separated &apos;script-dir&apos; will not be supported in future versions. Please use the underscore name &apos;script_dir&apos; instead
  warnings.warn(
/usr/local/lib/python3.10/dist-packages/setuptools/dist.py:771: UserWarning: Usage of dash-separated &apos;install-scripts&apos; will not be supported in future versions. Please use the underscore name &apos;install_scripts&apos; instead
  warnings.warn(
--- stderr: ros2_pca9685                   
/usr/local/lib/python3.10/dist-packages/setuptools/dist.py:771: UserWarning: Usage of dash-separated &apos;script-dir&apos; will not be supported in future versions. Please use the underscore name &apos;script_dir&apos; instead
  warnings.warn(
/usr/local/lib/python3.10/dist-packages/setuptools/dist.py:771: UserWarning: Usage of dash-separated &apos;install-scripts&apos; will not be supported in future versions. Please use the underscore name &apos;install_scripts&apos; instead
  warnings.warn(
/usr/local/lib/python3.10/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
---
Finished &lt;&lt;&lt; ros2_pca9685 [9.01s]

Summary: 1 package finished [9.88s]
  1 package had stderr output: ros2_pca9685
<font color="#26A269"><b>pioneer@pioneer-desktop</b></font>:<font color="#12488B"><b>~/ros2_pca9685_ws</b></font>$ source ./install/setup.bash
<font color="#26A269"><b>pioneer@pioneer-desktop</b></font>:<font color="#12488B"><b>~/ros2_pca9685_ws</b></font>$ ros2 run ros2_pca9685 listener
Package &apos;ros2_pca9685&apos; not found
</pre>
FPSychotic commented 2 years ago

Fixed the above with colon build symlink install argument.

but now I enter on this error :~/ros2_pca9685_ws$ ros2 run ros2_pca9685 listener Initializing IO System - import Traceback (most recent call last): File "/home/pioneer/ros2_pca9685_ws/install/ros2_pca9685/lib/ros2_pca9685/listener", line 33, in <module> sys.exit(load_entry_point('ros2-pca9685', 'console_scripts', 'listener')()) File "/home/pioneer/ros2_pca9685_ws/install/ros2_pca9685/lib/ros2_pca9685/listener", line 25, in importlib_load_entry_point return next(matches).load() File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 171, in load module = import_module(match.group('module')) File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1050, in _gcd_import File "<frozen importlib._bootstrap>", line 1027, in _find_and_load File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 688, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 883, in exec_module File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed File "/home/pioneer/ros2_pca9685_ws/build/ros2_pca9685/ros2_pca9685/subscriber_member_function.py", line 32, in <module> kit = ServoKit(channels=16, address=0x40) File "/home/pioneer/.local/lib/python3.10/site-packages/adafruit_servokit.py", line 88, in __init__ i2c = board.I2C() File "/usr/local/lib/python3.10/dist-packages/board.py", line 296, in I2C return busio.I2C(SCL, SDA) File "/usr/local/lib/python3.10/dist-packages/busio.py", line 35, in __init__ self.init(scl, sda, frequency) File "/usr/local/lib/python3.10/dist-packages/busio.py", line 117, in init self._i2c = _I2C(portId, mode=_I2C.MASTER, baudrate=frequency) File "/usr/local/lib/python3.10/dist-packages/adafruit_blinka/microcontroller/generic_linux/i2c.py", line 27, in __init__ self._i2c_bus = smbus.SMBus(bus_num) File "/home/pioneer/.local/lib/python3.10/site-packages/Adafruit_PureIO/smbus.py", line 125, in __init__ self.open(bus) File "/home/pioneer/.local/lib/python3.10/site-packages/Adafruit_PureIO/smbus.py", line 151, in open self._device = open("/dev/i2c-{0}".format(bus), "r+b", buffering=0) PermissionError: [Errno 13] Permission denied: '/dev/i2c-1' [ros2run]: Process exited with failure 1 I reinstalled I think everything with sudo, not sure if forgot something.

FPSychotic commented 2 years ago

OK, I could get forward fixing the issues of permissions but it looks some issue with circuitpyton in 22.04 as similar error happens with the official examples, if someone get it work in 22.04 and read this post please let me know.

FPSychotic commented 2 years ago

My actual error message running the node.

` ros2 run ros2_pca9685 listener
Initializing IO System - import
Traceback (most recent call last):
  File "/home/pioneer/.local/lib/python3.10/site-packages/adafruit_bus_device/i2c_device.py", line 176, in __probe_for_device
    self.i2c.writeto(self.device_address, b"")
  File "/usr/local/lib/python3.10/dist-packages/busio.py", line 169, in writeto
    return self._i2c.writeto(address, buffer, stop=stop)
  File "/usr/local/lib/python3.10/dist-packages/adafruit_blinka/microcontroller/generic_linux/i2c.py", line 52, in writeto
    self._i2c_bus.write_bytes(address, buffer[start:end])
  File "/home/pioneer/.local/lib/python3.10/site-packages/Adafruit_PureIO/smbus.py", line 314, in write_bytes
    self._device.write(buf)
OSError: [Errno 121] Remote I/O error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pioneer/.local/lib/python3.10/site-packages/adafruit_bus_device/i2c_device.py", line 182, in __probe_for_device
    self.i2c.readfrom_into(self.device_address, result)
  File "/usr/local/lib/python3.10/dist-packages/busio.py", line 159, in readfrom_into
    return self._i2c.readfrom_into(address, buffer, stop=stop)
  File "/usr/local/lib/python3.10/dist-packages/adafruit_blinka/microcontroller/generic_linux/i2c.py", line 59, in readfrom_into
    readin = self._i2c_bus.read_bytes(address, end - start)
  File "/home/pioneer/.local/lib/python3.10/site-packages/Adafruit_PureIO/smbus.py", line 181, in read_bytes
    return self._device.read(number)
OSError: [Errno 121] Remote I/O error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pioneer/ros2_pca9685_ws/install/ros2_pca9685/lib/ros2_pca9685/listener", line 33, in <module>
    sys.exit(load_entry_point('ros2-pca9685', 'console_scripts', 'listener')())
  File "/home/pioneer/ros2_pca9685_ws/install/ros2_pca9685/lib/ros2_pca9685/listener", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/pioneer/ros2_pca9685_ws/build/ros2_pca9685/ros2_pca9685/subscriber_member_function.py", line 32, in <module>
    kit = ServoKit(channels=16, address=0x40)
  File "/home/pioneer/.local/lib/python3.10/site-packages/adafruit_servokit.py", line 89, in __init__
    self._pca = PCA9685(
  File "/home/pioneer/.local/lib/python3.10/site-packages/adafruit_pca9685.py", line 141, in __init__
    self.i2c_device = i2c_device.I2CDevice(i2c_bus, address)
  File "/home/pioneer/.local/lib/python3.10/site-packages/adafruit_bus_device/i2c_device.py", line 63, in __init__
    self.__probe_for_device()
  File "/home/pioneer/.local/lib/python3.10/site-packages/adafruit_bus_device/i2c_device.py", line 185, in __probe_for_device
    raise ValueError("No I2C device at address: 0x%x" % self.device_address)
ValueError: No I2C device at address: 0x40
[ros2run]: Process exited with failure 1
pioneer@pioneer-desktop:~$ i2cdetect -y 0
     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: 70 -- -- -- -- -- -- --                         
pioneer@pioneer-desktop:~$ 

`
Brac24 commented 1 year ago

Just to give my experience here. I was also getting the No I2C device at address 0x40. I also had the board connected onto I2C Bus 0 on Jetson Nano (i.e Pin 27 = SDA and Pin 28 = SCL). I just got around this by connecting the PCA9685 to I2C Bus 1 where Pin 3 = SDA and Pin 5 = SCL. Before switching to Bus1 I did try the fix in the following issue I found here https://github.com/adafruit/Adafruit_Blinka/issues/344 but that didn't work for me.

joncamp commented 1 year ago

Just to give my experience here. I was also getting the No I2C device at address 0x40. I also had the board connected onto I2C Bus 0 on Jetson Nano (i.e Pin 27 = SDA and Pin 28 = SCL). I just got around this by connecting the PCA9685 to I2C Bus 1 where Pin 3 = SDA and Pin 5 = SCL. Before switching to Bus1 I did try the fix in the following issue I found here adafruit/Adafruit_Blinka#344 but that didn't work for me.

FYI - for those using a Jetson Xavier, you might end up in a similar situation since the 40 pin header puts different I2C bus ports on the same pins. More specifically, the functionality of the pinout is consistent but the port number of the bus is different between the nano and the xavier