ros-melodic-arch / ros-melodic-gazebo-msgs

ros-melodic-gazebo-msgsAUR package
0 stars 0 forks source link

Can't spawn model, error in _SpawnModel.py script. #2

Open amirulmenjeni opened 5 years ago

amirulmenjeni commented 5 years ago

I believe this is a problem that's somehow concerned with this package since pacman -Ql | grep _SpawnModel.py gives:

ros-melodic-gazebo-msgs /opt/ros/melodic/lib/python3.7/site-packages/gazebo_msgs/srv/_SpawnModel.py

When I tried to spawn a model, I got this error message:

Traceback (most recent call last):
  File "/opt/ros/melodic/lib/gazebo_ros/spawn_model", line 232, in <module>
    exit_code = sm.run()
  File "/opt/ros/melodic/lib/gazebo_ros/spawn_model", line 182, in run
    self.args.gazebo_namespace)
  File "/opt/ros/melodic/lib/python3.7/site-packages/gazebo_ros/gazebo_interface.py", line 20, in spawn_sdf_model_client
    resp = spawn_sdf_model(model_name, model_xml, robot_namespace, initial_pose, reference_frame)
  File "/opt/ros/melodic/lib/python3.7/site-packages/rospy/impl/tcpros_service.py", line 439, in __call__
    return self.call(*args, **kwds)
  File "/opt/ros/melodic/lib/python3.7/site-packages/rospy/impl/tcpros_service.py", line 516, in call
    transport.send_message(request, self.seq)
  File "/opt/ros/melodic/lib/python3.7/site-packages/rospy/impl/tcpros_base.py", line 668, in send_message
    serialize_message(self.write_buff, seq, msg)
  File "/opt/ros/melodic/lib/python3.7/site-packages/rospy/msg.py", line 152, in serialize_message
    msg.serialize(b)
  File "/opt/ros/melodic/lib/python3.7/site-packages/gazebo_msgs/srv/_SpawnModel.py", line 103, in serialize
    _x = _x.encode('utf-8')
AttributeError: 'bytes' object has no attribute 'encode'
[spawn_sdf-1] process has died [pid 821993, exit code 1, cmd /opt/ros/melodic/lib/gazebo_ros/spawn_model -file /home/amenji/git/ros_ws/src/exmpl_models/rect_prism/model-1_4.sdf -sdf -model rect_prism -x 0 -y 0 -z 4 __name:=spawn_sdf __log:=/home/amenji/.ros/log/7ebdf562-e450-11e9-aae7-d46d6d3bb0b9/spawn_sdf-1.log].
log file: /home/amenji/.ros/log/7ebdf562-e450-11e9-aae7-d46d6d3bb0b9/spawn_sdf-1*.log

https://aur.archlinux.org/packages/gazebo/?setlang=nb&comments=all&O=0&PP=10#comment-699042 has a fix for this.

acxz commented 5 years ago

Hello @amirulmenjeni, I have come across this issue myself and it needs to be patched (haven't done so yet). I was just about to post that solution lol. It could also be the case that the newest release fixes the issue. (AUR package is currently out of date)

acxz commented 5 years ago

Let's keep this issue open until we get a proper fix for it out. Either as a local patch or as an upstream fix.