pypcd icon indicating copy to clipboard operation
pypcd copied to clipboard

Error when using pypcd with Python 3.8

Open RaviBeagle opened this issue 3 years ago • 3 comments

Hi @DanielPollithy I am using your python pypcd package as per your suggestion in the tutorial.

But I am getting this error:

[ERROR] [1655964681.574969]: bad callback: <bound method Subscriber.callback of <message_filters.Subscriber object at 0x7f16ddc51760>>
Traceback (most recent call last):
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/topics.py", line 750, in _invoke_callback
    cb(msg)
  File "/opt/ros/noetic/lib/python3/dist-packages/message_filters/__init__.py", line 76, in callback
    self.signalMessage(msg)
  File "/opt/ros/noetic/lib/python3/dist-packages/message_filters/__init__.py", line 58, in signalMessage
    cb(*(msg + args))
  File "/opt/ros/noetic/lib/python3/dist-packages/message_filters/__init__.py", line 330, in add
    self.signalMessage(*msgs)
  File "/opt/ros/noetic/lib/python3/dist-packages/message_filters/__init__.py", line 58, in signalMessage
    cb(*(msg + args))
  File "/home/sxv1kor/rospy_tutorial_ws/src/message_synchrozier/src/rosBagMessageSynchronizer.py", line 57, in callback
    pc = pypcd.PointCloud.from_msg(pointcloud)
  File "/home/sxv1kor/.local/lib/python3.8/site-packages/pypcd/pypcd.py", line 807, in from_msg
    raise NotImplementedError('ROS sensor_msgs not found')
NotImplementedError: ROS sensor_msgs not found

This should not happen as the numpy_pc2 is alredy there:

 ll
total 84
drwxrwxr-x  3 sxv1kor sxv1kor  4096 Jun 23 10:47 ./
drwx------ 74 sxv1kor sxv1kor  4096 Jun 23 10:47 ../
-rw-rw-r--  1 sxv1kor sxv1kor    43 Jun 23 10:47 __init__.py
-rw-rw-r--  1 sxv1kor sxv1kor 10113 Jun 23 10:47 nea_pc_format.py
-rw-rw-r--  1 sxv1kor sxv1kor 13802 Jun 23 10:47 numpy_pc2.py
-rw-rw-r--  1 sxv1kor sxv1kor  1133 Jun 23 10:47 pdutil.py
drwxrwxr-x  2 sxv1kor sxv1kor  4096 Jun 23 10:47 __pycache__/
-rw-rw-r--  1 sxv1kor sxv1kor 28920 Jun 23 10:47 pypcd.py
-rw-rw-r--  1 sxv1kor sxv1kor  2506 Jun 23 10:47 sautil.py

RaviBeagle avatar Jun 23 '22 09:06 RaviBeagle

Hi there!

Can you import the following requirements without error?

import numpy.lib.recfunctions as recfuncs
from sensor_msgs.msg import PointField
from sensor_msgs.msg import PointCloud2

DanielPollithy avatar Jun 24 '22 12:06 DanielPollithy

@DanielPollithy Hi I'm also facing the same problem and can also import above dependencies.

However, my traceback is different than above issue.!!

`

NotImplementedError Traceback (most recent call last) Cell In[5], line 1 ----> 1 pc = pypcd.PointCloud.from_msg(velodyne_data)

File ~/venv/lib/python3.8/site-packages/pypcd-0.1.3-py3.8.egg/pypcd/pypcd.py:807, in PointCloud.from_msg(msg, squeeze) 803 """ from pointcloud2 msg 804 squeeze: fix when clouds get 1 as first dim 805 """ 806 if not HAS_SENSOR_MSGS: --> 807 raise NotImplementedError('ROS sensor_msgs not found') 808 md = {'version': .7, 809 'fields': [], 810 'size': [], (...) 816 'type': [], 817 'data': 'binary_compressed'} 818 for field in msg.fields:

NotImplementedError: ROS sensor_msgs not found `

AbhiKhoyani avatar Feb 04 '23 16:02 AbhiKhoyani

Hey @RaviBeagle Try the following script to extract the point cloud data https://gist.github.com/Merwanski/bef218ff3b7472d5ac787e1392116fd7

Merwanski avatar Jul 19 '24 09:07 Merwanski