移动机器人gazebo仿真(2)—导入kinetic和hokuyo激光雷达

roslaunch turtlebot_gazebo turtlebot_world.launch
roslaunch turtlebot_teleop keyboard_teleop.launch
roslaunch turtlebot_gazebo gmapping_demo.launch
roslaunch turtlebot_rviz_launchers view_navigation.launch

补充:首先先试试看能否运行以上命令,不能的话就安装相应的包吧。


参考文章:

http://blog.csdn.net/qq_36355662/article/details/61413860

http://blog.csdn.net/qq_36355662/article/details/61616513

http://blog.csdn.net/changer_sun/article/details/79264388

上一篇博客建图时打开rviz会造成gazeon进程中断,因此干脆另外使用激光传感器hokuyo与kinect共存

为方便日后使用,将所有/opt/ros/kinetic/share下有修改的代码都另建一份,放在工作空间的pkg下。

文末尾上传了代码,实现gazeon下的建图仿真

有修改的软件包如下:

移动机器人gazebo仿真(2)—导入kinetic和hokuyo激光雷达_第1张图片

即上图显示的程序都需要修改;下面贴出代码:

file: my_world_hk.launch


  

   
     
  
     
     

  


  
    
    
    
    
  
  
  
 
   
    
    
  
  
  
    
  
  
  
  
  
    
    
    
    
    
  

file:kobuki.launch.xml


  
  
  
  
  
  
  
 


  
  
  
  
  
  
    
    
  

  
  

file:hokuyo.dae (此文件实际需要下载model,下载方式如下)
以下是要放到robot文件夹下的代码
cd ~/.gazebo/models
wget -q -R *index.html*,*.tar.gz --no-parent -r -x -nH http://models.gazebosim.org/hokuyo/

file:turtlebot_library.urdf.xacro




  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
      

file:turtlebot_gazebo.urdf.xacro
  
  
  
    
    
        
        
        true  
        20.0  
          
          ${60.0*M_PI/180.0}  
            
            B8G8R8  
            640  
            480  
            
            
            0.05  
            8.0  
            
          
          
          camera  
          true  
          10  
          rgb/image_raw  
          depth/image_raw  
          depth/points  
          rgb/camera_info  
          depth/camera_info  
          camera_depth_optical_frame  
          0.1  
          0.0  
          0.0  
          0.0  
          0.0  
          0.0  
          0.4  
          
        
      
    
  

   
   
          
          0 0 0 0 0 0  
          false  
          40  
            
              
                
                720  
                1  
                -1.570796  
                1.570796  
                
              
              
              0.10  
              30.0  
              0.01  
              
              
              gaussian  
                
               0.0  
              0.01  
              
            
            
            /turtlebot/laser/scan
            hokuyo_link  
            
          
        
    
   
file:kobuki_hexagons_KinectHokuyo.urdf.xacro

    


  

  
  
  

  
  
  
  
  

  

file:hokuyo.urdf.xacro

下面这条代码需要根据实际路径做具体修改!!!!!!!

  
      
      
        
        
      
        
        
          
            
            
            
          

        
       
         
           
           
         
           
         

       
           
         
       
         
       

       
           
         
        
        
       

          
        
        
  

以下文件和gmapping有关

file:gmapping_demo.launch  (用于建立地图   )


    
  
  

gmapping文件夹下file:  KinectHokuyo_gmapping.launch.xml


  
  
  
  

  
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
  
    
    
    
    

    
    
    
    
    
    
  

注意在~/.bashrc中添加以下内容:

source /home/jk/ros_sim/devel/setup.bash
export  TURTLEBOT_BASE=kobuki  
export  TURTLEBOT_STACKS=hexagons
export  TURTLEBOT_3D_SENSOR=KinectHokuyo

分别在终端运行:

roslaunch robot_hokuyo_kinect my_world_hk.launch 
roslaunch robot_hokuyo_kinect gmapping_demo.launch 
roslaunch turtlebot_rviz_launchers view_navigation.launch  
roslaunch turtlebot_teleop keyboard_teleop.launch

运行 rqt_graph看到

移动机器人gazebo仿真(2)—导入kinetic和hokuyo激光雷达_第2张图片

gazon和rviz效果图:

移动机器人gazebo仿真(2)—导入kinetic和hokuyo激光雷达_第3张图片


移动机器人gazebo仿真(2)—导入kinetic和hokuyo激光雷达_第4张图片


代码压缩包上传至博客 : ros_sim

你可能感兴趣的:(移动机器人/ROS)