Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modifications for noetic/python3 and switched output to DAE. #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

simchanu29
Copy link

@simchanu29 simchanu29 commented Oct 23, 2020

Hi, since in my team we already made the changes to make your package compatible with ROS noetic. I thought that it would be nice to share it.

Changes :

  • Python3 support
  • The mesh has been changed from stl to dae :
    In python3 it was easier to generate a COLLADA file. I noticed as well that gazebo seems to prefer COLLADA files as a mesh.

@simchanu29
Copy link
Author

Solves #1

@aniskoubaa
Copy link

Hi
Thanks for sharing the PY3 solution. I tried it in my ROS Noetic but I am getting this error
#I started my map
rosrun map_server map_server riotulab_map.yaml

#I try to convert it but I get an error. I have used map2gazebo_py3.py in the launch file
roslaunch map2gazebo map2gazebo.launch export_dir:=/home/akoubaa/

... logging to /home/akoubaa/.ros/log/106d5a8c-15f8-11eb-9e77-fd1ed3a393c5/roslaunch-ubuntu-26846.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://ubuntu:40743/

SUMMARY

PARAMETERS

  • /map2gazebo/box_height: 2.0
  • /map2gazebo/export_dir: /home/akoubaa/
  • /map2gazebo/map_topic: map
  • /map2gazebo/mesh_type: stl
  • /map2gazebo/occupied_thresh: 1
  • /rosdistro: noetic
  • /rosversion: 1.15.8

NODES
/
map2gazebo (map2gazebo/map2gazebo_py3.py)

ROS_MASTER_URI=http://localhost:11311

process[map2gazebo-1]: started with pid [26860]
[INFO] [1603544933.114252]: map2gazebo running
[INFO] [1603544933.168979]: Received map
[ERROR] [1603544936.225797]: bad callback: <bound method MapConverter.map_callback of <main.MapConverter object at 0x7f4bb50cc1c0>>
Traceback (most recent call last):
File "/opt/ros/noetic/lib/python3/dist-packages/rospy/topics.py", line 750, in _invoke_callback
cb(msg)
File "/home/akoubaa/catkin_ws/src/map2gazebo/src/map2gazebo_py3.py", line 43, in map_callback
mesh.export(f, "stl")
File "/home/akoubaa/.local/lib/python3.8/site-packages/trimesh/base.py", line 2551, in export
return export_mesh(mesh=self,
File "/home/akoubaa/.local/lib/python3.8/site-packages/trimesh/exchange/export.py", line 81, in export_mesh
result = util.write_encoded(file_obj, export)
File "/home/akoubaa/.local/lib/python3.8/site-packages/trimesh/util.py", line 2133, in write_encoded
file_obj.write(stuff.decode(encoding))
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 86: invalid start byte

@malwaru
Copy link

malwaru commented Jun 8, 2022

Hi Thanks for sharing the PY3 solution. I tried it in my ROS Noetic but I am getting this error #I started my map rosrun map_server map_server riotulab_map.yaml

#I try to convert it but I get an error. I have used map2gazebo_py3.py in the launch file roslaunch map2gazebo map2gazebo.launch export_dir:=/home/akoubaa/

... logging to /home/akoubaa/.ros/log/106d5a8c-15f8-11eb-9e77-fd1ed3a393c5/roslaunch-ubuntu-26846.log Checking log directory for disk usage. This may take a while. Press Ctrl-C to interrupt Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://ubuntu:40743/

SUMMARY

PARAMETERS

  • /map2gazebo/box_height: 2.0
  • /map2gazebo/export_dir: /home/akoubaa/
  • /map2gazebo/map_topic: map
  • /map2gazebo/mesh_type: stl
  • /map2gazebo/occupied_thresh: 1
  • /rosdistro: noetic
  • /rosversion: 1.15.8

NODES / map2gazebo (map2gazebo/map2gazebo_py3.py)

ROS_MASTER_URI=http://localhost:11311

process[map2gazebo-1]: started with pid [26860] [INFO] [1603544933.114252]: map2gazebo running [INFO] [1603544933.168979]: Received map [ERROR] [1603544936.225797]: bad callback: <bound method MapConverter.map_callback of <main.MapConverter object at 0x7f4bb50cc1c0>> Traceback (most recent call last): File "/opt/ros/noetic/lib/python3/dist-packages/rospy/topics.py", line 750, in _invoke_callback cb(msg) File "/home/akoubaa/catkin_ws/src/map2gazebo/src/map2gazebo_py3.py", line 43, in map_callback mesh.export(f, "stl") File "/home/akoubaa/.local/lib/python3.8/site-packages/trimesh/base.py", line 2551, in export return export_mesh(mesh=self, File "/home/akoubaa/.local/lib/python3.8/site-packages/trimesh/exchange/export.py", line 81, in export_mesh result = util.write_encoded(file_obj, export) File "/home/akoubaa/.local/lib/python3.8/site-packages/trimesh/util.py", line 2133, in write_encoded file_obj.write(stuff.decode(encoding)) UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 86: invalid start byte

Here you have to change from stl to dae in the config/default.yaml file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants