ROS Gazebo仿真 測試步驟

turtlebot 的gazebo地圖有點定位不對(忘了什麼原因),改用husky,步驟如下:

 

1、下載展開(husky github)、catkin_make編譯、source 路徑

2、啓動仿真

source ~/husky/devel/setup.bash

roslaunch husky_gazebo husky_playpen.launch

如果提示錯誤:

ERROR: cannot launch node of type [interactive_marker_twist_server/marker_server]: interactive_marker_twist_server

安裝:sudo apt-get install ros-kinetic-interactive-marker-twist-server

3、啓動gmapping

roslaunch husky_navigation gmapping_demo.launch

4、啓動rviz

 

roslaunch husky_viz view_robot.launch

 

 

5、啓動鍵盤控制

roslaunch turtlebot_teleop keyboard_teleop.launch

keyboard_teleop.launch 文件位置

 

需要修改速度映射:

<remap from="turtlebot_teleop_keyboard/cmd_vel" to="husky_velocity_controller/cmd_vel"/>

速度不要太快,角速度0.1 線速度0.2左右

<launch>
  <!-- turtlebot_teleop_key already has its own built in velocity smoother -->
  <node pkg="turtlebot_teleop" type="turtlebot_teleop_key" name="turtlebot_teleop_keyboard"  output="screen">
    <param name="scale_linear" value="0.5" type="double"/>
    <param name="scale_angular" value="1.5" type="double"/>
    <!--remap from="turtlebot_teleop_keyboard/cmd_vel" to="cmd_vel_mux/input/teleop"/-->
    <!--remap from="turtlebot_teleop_keyboard/cmd_vel" to="cmd_vel_mux/input/teleop"/-->
    <!--remap from="turtlebot_teleop_keyboard/cmd_vel" to="cmd_vel"/-->
    <!--remap from="turtlebot_teleop_keyboard/cmd_vel" to="/gammabot_velocity_controller/cmd_vel"/-->
    <!--the following is the original code-->
    <remap from="turtlebot_teleop_keyboard/cmd_vel" to="husky_velocity_controller/cmd_vel"/>
    <!--the following control the kobuki mubile_base-->
	
    <!--turtlebot 仿真速度指令話題映射-->
    <!--remap from="turtlebot_teleop_keyboard/cmd_vel" to="/mobile_base/commands/velocity"/-->
    <!--remap from="turtlebot_teleop_keyboard/cmd_vel" to="/four_wheel_steering_controller/cmd_vel"/-->
  </node>
</launch>

 

 

6、Xbox搖桿控制

 

roslaunch turtlebot_teleop xbox360_teleop.launch

(1)<remap from="turtlebot_teleop_joystick/cmd_vel" to="husky_velocity_controller/cmd_vel"/>

(2)操控時注意必須按下LB鍵 jstest-gtk測試 4 號button , 由axis_deadman" value="4" 指定

 

(3)錯誤Couldn't open joystick force feedback! 可以忽略

 

 

 

 

 

 

 

以下爲turtlebot gazebo仿真

 

 

從https://github.com/turtlebot/turtlebot_simulator下載,解壓將 turtlebot_gazebo 目錄複製到catkin_ws/src下,然編譯

 

2、修改playground.world文件

gazebo playground.world

 

 

 

啓動turtlebot仿真,roslaunch turtlebot_gazebo turtlebot_world.launch

 

出現錯誤

 

[ INFO] [1575341572.758603545]: waitForService: Service [/gazebo/set_physics_properties] has not been advertised, waiting...

terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::lock_error> >'

what(): boost: mutex lock failed in pthread_mutex_lock: Invalid argument

Aborted (core dumped)

[gazebo-2] process has died [pid 11321, exit code 134, cmd /opt/ros/kinetic/lib/gazebo_ros/gzserver -e ode ~/catkin_ws/src/turtlebot_gazebo/worlds/playground.world __name:=gazebo __log:=/home/sdia/.ros/log/fe609966-1577-11ea-9534-6014b3c8843b/gazebo-2.log].

log file: /home/sdia/.ros/log/fe609966-1577-11ea-9534-6014b3c8843b/gazebo-2*.log

 

原因

 

<arg name="world_file" default="/home/sdia/catkin_ws/src/turtlebot_gazebo/worlds/playground.world"/>

路徑設置不對

 

 

使用環境文件是playgroud

該文件保存在系統變量$TURTLEBOT_GAZEBO_WORLD_FILE中。

 

  1. 啓動鍵盤控制

roslaunch turtlebot_teleop keyboard_teleop.launch

 

需要修改速度映射:

<remap from="turtlebot_teleop_keyboard/cmd_vel" to="/mobile_base/commands/velocity"/>

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章