pyrealsense issues when being run in ROS catkin package
I am trying to run a program in ROS that uses an intel real sense camera, but let me go back first.
I initially ran script for the camera from the home directory on my raspberry pi 4. I got the issue "AttributeError: module 'pyrealsense2' has no attribute 'pipeline'. I then solved this by copying the three pyrealsense ".so" files to the home directory (The same as the python file I am trying to run.
Once I got it working by itself, I then tried moving everything into my larger ROS python script. I then moved everything (including the .so files) into my source folder (/catkin_workspace/src/ros_kortex/kortex_examples/src/full_arm). This directory is where my ROS python file is located, so I assumed it would have the same positive affect by moving everything here, but when I run my script I get the original error of ""AttributeError: module 'pyrealsense2' has no attribute 'pipeline'". In the header of my ROS file I have,
sys.path.append('/home/pi/catkin_workspace/src/ros_kortex/kortex_examples/src/full_arm') and this helps when importing external python scripts to my main file.
I then have
import realsense_depth #Class with camera functions
If adding the .so files helped when the files were in the home directory, then why is it not working when I move everything into this new directory? any ideas?
There have been several discussions previously in RealSense Community and GitHub about this issue. It seems like copying the library files next to the script tends to solve the issue. But it does not happen in your subsequent attempts.
I share a couple of cases here:
AttributeError: module 'pyrealsense2' has no attribute 'pipeline'
Raspberry Pi ModuleNotFoundError: No module named 'pyrealsense2'
On another note, for questions related to RealSense SDK 2.0 in future, I suggest you post in the General Discussion Community (or in D400 Series Community or L515 Community according to your camera model).
Intel Customer Support
Please sign in to leave a comment.