“// XTDRONE // GAZEBO // ROS“ :~/catkin_ws$ catkin build报错

配置gazebo环境

编译Gazebo的插件gazebo_ros_pkgs出现如下报错

xtdrone@xtdrone-virtual-machine:~/catkin_ws$ catkin build
------------------------------------------------------------
Profile:                     default
Extending:             [env] /opt/ros/noetic
Workspace:                   /home/xtdrone/catkin_ws
------------------------------------------------------------
Build Space:        [exists] /home/xtdrone/catkin_ws/build
Devel Space:        [exists] /home/xtdrone/catkin_ws/devel
Install Space:      [unused] /home/xtdrone/catkin_ws/install
Log Space:          [exists] /home/xtdrone/catkin_ws/logs
Source Space:       [exists] /home/xtdrone/catkin_ws/src
DESTDIR:            [unused] None
------------------------------------------------------------
Devel Space Layout:          linked
Install Space Layout:        None
------------------------------------------------------------
Additional CMake Args:       None
Additional Make Args:        None
Additional catkin Make Args: None
Internal Make Job Server:    True
Cache Job Environments:      False
------------------------------------------------------------
Buildlisted Packages:        None
Skiplisted Packages:         None
------------------------------------------------------------
Workspace configuration appears valid.
------------------------------------------------------------
[build] Found 6 packages in 0.0 seconds.                                       
[build] Updating package table.                                                
Starting  >>> gazebo_dev                                                       
Starting  >>> gazebo_msgs                                                      
Finished  <<< gazebo_dev                        [ 4.8 seconds ]                
_______________________________________________________________________________
Errors     << gazebo_msgs:make /home/xtdrone/catkin_ws/logs/gazebo_msgs/build.make.000.log
Traceback (most recent call last):
  File "/opt/ros/noetic/share/gencpp/cmake/../../../lib/gencpp/gen_cpp.py", line 49, in <module>
    genmsg.template_tools.generate_from_command_line_options(
  File "/opt/ros/noetic/lib/python3/dist-packages/genmsg/template_tools.py", line 213, in generate_from_command_line_options
    generate_from_file(argv[1], options.package, options.outdir, options.emdir, options.includepath, msg_template_dict, srv_template_dict)
  File "/opt/ros/noetic/lib/python3/dist-packages/genmsg/template_tools.py", line 154, in generate_from_file
    _generate_msg_from_file(input_file, output_dir, template_dir, search_path, package_name, msg_template_dict)
  File "/opt/ros/noetic/lib/python3/dist-packages/genmsg/template_tools.py", line 93, in _generate_msg_from_file
    _generate_from_spec(input_file,
  File "/opt/ros/noetic/lib/python3/dist-packages/genmsg/template_tools.py", line 77, in _generate_from_spec
    interpreter = em.Interpreter(output=ofile, globals=g, options={em.RAW_OPT:True,em.BUFFERED_OPT:True})
AttributeError: module 'em' has no attribute 'RAW_OPT'
Traceback (most recent call last):
  File "/opt/ros/noetic/share/gencpp/cmake/../../../lib/gencpp/gen_cpp.py", line 49, in <module>
    genmsg.template_tools.generate_from_command_line_options(
  File "/opt/ros/noetic/lib/python3/dist-packages/genmsg/template_tools.py", line 213, in generate_from_command_line_options
    generate_from_file(argv[1], options.package, options.outdir, options.emdir, options.includepath, msg_template_dict, srv_template_dict)
  File "/opt/ros/noetic/lib/python3/dist-packages/genmsg/template_tools.py", line 154, in generate_from_file
    _generate_msg_from_file(input_file, output_dir, template_dir, search_path, package_name, msg_template_dict)
  File "/opt/ros/noetic/lib/python3/dist-packages/genmsg/template_tools.py", line 93, in _generate_msg_from_file
    _generate_from_spec(input_file,
  File "/opt/ros/noetic/lib/python3/dist-packages/genmsg/template_tools.py", line 77, in _generate_from_spec
    interpreter = em.Interpreter(output=ofile, globals=g, options={em.RAW_OPT:True,em.BUFFERED_OPT:True})
AttributeError: module 'em' has no attribute 'RAW_OPT'
make[2]: *** [CMakeFiles/gazebo_msgs_generate_messages_cpp.dir/build.make:108: /home/xtdrone/catkin_ws/devel/.private/gazebo_msgs/include/gazebo_msgs/ContactState.h] Error 1
make[2]: *** Deleting file '/home/xtdrone/catkin_ws/devel/.private/gazebo_msgs/include/gazebo_msgs/ContactState.h'
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [CMakeFiles/gazebo_msgs_generate_messages_cpp.dir/build.make:100: /home/xtdrone/catkin_ws/devel/.private/gazebo_msgs/include/gazebo_msgs/ContactsState.h] Error 1
make[2]: *** Deleting file '/home/xtdrone/catkin_ws/devel/.private/gazebo_msgs/include/gazebo_msgs/ContactsState.h'
Traceback (most recent call last):
  File "/opt/ros/noetic/share/gencpp/cmake/../../../lib/gencpp/gen_cpp.py", line 49, in <module>
    genmsg.template_tools.generate_from_command_line_options(
  File "/opt/ros/noetic/lib/python3/dist-packages/genmsg/template_tools.py", line 213, in generate_from_command_line_options
    generate_from_file(argv[1], options.package, options.outdir, options.emdir, options.includepath, msg_template_dict, srv_template_dict)
  File "/opt/ros/noetic/lib/python3/dist-packages/genmsg/template_tools.py", line 154, in generate_from_file
    _generate_msg_from_file(input_file, output_dir, template_dir, search_path, package_name, msg_template_dict)
  File "/opt/ros/noetic/lib/python3/dist-packages/genmsg/template_tools.py", line 93, in _generate_msg_from_file
    _generate_from_spec(input_file,
  File "/opt/ros/noetic/lib/python3/dist-packages/genmsg/template_tools.py", line 77, in _generate_from_spec
    interpreter = em.Interpreter(output=ofile, globals=g, options={em.RAW_OPT:True,em.BUFFERED_OPT:True})
AttributeError: module 'em' has no attribute 'RAW_OPT'
make[2]: *** [CMakeFiles/gazebo_msgs_generate_messages_cpp.dir/build.make:119: /home/xtdrone/catkin_ws/devel/.private/gazebo_msgs/include/gazebo_msgs/LinkState.h] Error 1
make[2]: *** Deleting file '/home/xtdrone/catkin_ws/devel/.private/gazebo_msgs/include/gazebo_msgs/LinkState.h'
make[1]: *** [CMakeFiles/Makefile2:870: CMakeFiles/gazebo_msgs_generate_messages_cpp.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:141: all] Error 2

问题原因:empy版本不匹配

解决办法:1、卸载当前empy

2、安装低empy版本

pip3 uninatall empy
pip3 install empy==3.3.2
catkin build

编译成功

xtdrone@xtdrone-virtual-machine:~/catkin_ws$ catkin build
------------------------------------------------------------
Profile:                     default
Extending:          [cached] /opt/ros/noetic
Workspace:                   /home/xtdrone/catkin_ws
------------------------------------------------------------
Build Space:        [exists] /home/xtdrone/catkin_ws/build
Devel Space:        [exists] /home/xtdrone/catkin_ws/devel
Install Space:      [unused] /home/xtdrone/catkin_ws/install
Log Space:          [exists] /home/xtdrone/catkin_ws/logs
Source Space:       [exists] /home/xtdrone/catkin_ws/src
DESTDIR:            [unused] None
------------------------------------------------------------
Devel Space Layout:          linked
Install Space Layout:        None
------------------------------------------------------------
Additional CMake Args:       None
Additional Make Args:        None
Additional catkin Make Args: None
Internal Make Job Server:    True
Cache Job Environments:      False
------------------------------------------------------------
Buildlisted Packages:        None
Skiplisted Packages:         None
------------------------------------------------------------
Workspace configuration appears valid.
------------------------------------------------------------
[build] Found 6 packages in 0.0 seconds.                                                    
[build] Package table is up to date.                                                        
Starting  >>> gazebo_dev                                                                    
Starting  >>> gazebo_msgs                                                                   
Finished  <<< gazebo_dev                        [ 0.2 seconds ]                             
Finished  <<< gazebo_msgs                       [ 2.1 seconds ]                             
Starting  >>> gazebo_ros                                                                    
Finished  <<< gazebo_ros                        [ 41.1 seconds ]                            
Starting  >>> gazebo_plugins                                                                
Starting  >>> gazebo_ros_control                                                            
Finished  <<< gazebo_ros_control                [ 2 minutes and 40.3 seconds ]              
Finished  <<< gazebo_plugins                    [ 6 minutes and 13.3 seconds ]              
Starting  >>> gazebo_ros_pkgs                                                               
Finished  <<< gazebo_ros_pkgs                   [ 5.5 seconds ]                             
[build] Summary: All 6 packages succeeded!                                                  
[build]   Ignored:   None.                                                                  
[build]   Warnings:  None.                                                                  
[build]   Abandoned: None.                                                                  
[build]   Failed:    None.                                                                  
[build] Runtime: 7 minutes and 3.6 seconds total.                                           
[build] Note: Workspace packages have changed, please re-source setup files to use them

问题二:执行rosrun gazebo_ros gazebo报错

报错内容:uav@ubuntu:~$ rosrun gazebo_ros gazebo
VMware: vmw_ioctl_command error 无效的参数.
Aborted (core dumped)

解决方法:

echo "export SVGA_VGPU10=0" >> ~/.profile
source ~/.profile

  • 10
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值