RobotWebTools / rosbridge_suite

Server Implementations of the rosbridge v2 Protocol
https://robotwebtools.github.io
BSD 3-Clause "New" or "Revised" License
866 stars 506 forks source link

OccupancyGrid' object has no attribute '_slot_types' #638 #885

Open jesusramondovale opened 8 months ago

jesusramondovale commented 8 months ago

I'm using ros3djs on my ASP.NET webpage (cshtml) and when I try to visualize a 3D map the ros_server service executed in my ROS machine stops and gives the error :

"OccupancyGrid' object has no attribute '_slot_types'"

`File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosbridge_library/capabilities/subscribe.py", line 159, in _publish
    self.publish(message, self.fragment_size, self.compression)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosbridge_library/capabilities/subscribe.py", line 318, in publish
    outgoing_msg = message.get_cbor(outgoing_msg)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosbridge_library/internal/outgoing_message.py", line 38, in get_cbor
    outgoing_msg["msg"] = self.get_cbor_values()
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosbridge_library/internal/outgoing_message.py", line 33, in get_cbor_values
    self._cbor_values = extract_cbor_values(self._message)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosbridge_library/internal/cbor_conversion.py", line 53, in extract_cbor_values
    for slot, slot_type in zip(msg.__slots__, msg._slot_types):
AttributeError: 'OccupancyGrid' object has no attribute '_slot_types'`
dzw-tw commented 3 months ago

I also have this problem, have you solved it?

chanhhoang99 commented 2 months ago

For whom who get this error, I believe you are installing your rosbridge_suite from apt which is out of date. I tried building rosbridge_suite from source, seems to work fine at least with ros3djs. Of it's still not working, you may try to set compression value to false

jesusramondovale commented 1 month ago

I also have this problem, have you solved it?

It was a .js file versions conflict

luojinzhang commented 2 weeks ago

I am having the same thing, I indeed installed it using sudo apt-get install ros-humble-rosbridge-suite, any official fixing on this ? For workaround I guess it would be building the latest rosbridge_suite locally ? Thank you.

jesusramondovale commented 2 weeks ago

The problem was a conflict between versions on client side (ros3djs JavaScript imported files) nothing to do with ros-bridge installation on server side.

jesusramondovale commented 2 weeks ago

I am having the same thing, I indeed installed it using sudo apt-get install ros-humble-rosbridge-suite, any official fixing on this ? For workaround I guess it would be building the latest rosbridge_suite locally ? Thank you.

My case isn't a problem of ROS-Bridge, but you could try increasing the parameter "maximum fragment size" on ros-bridge configuration (or something like that)

When a map is bigger than the fragment size, it needs more than one fragment and the Ros JS client side doesn't work well with that. I think you have to manually rebuild the data of multiple fragments into one on client side, or basically increase the fragment size on server side in order to avoid this