Turtlbot仿真之Stage
目錄
1、stage介紹
2、啟動turtlebot stage仿真程序
3、turtlebot_in_stage.launch 文件內(nèi)容
4、設定目標位置,觀看機器人自主導航過程
源碼位于:turtlebot_simulator/turtlebot_stage
1、stage介紹
Stage是Player/Stage項目的一個軟件,是一種用于移動機器人和智能傳感系統(tǒng)研究的仿真工具。
Stage在一個二維的位圖環(huán)境下模擬移動機器人、傳感器和障礙物等對象。
Stage在設計中就考慮到了多智能體系統(tǒng)的問題,可以提供對多機器人系統(tǒng)的測試仿真。需要了解的是Stage只提供了真正簡單,可計算的廉價的設備模式,而無法非常精密地仿真任何具體的設備終端。
Stage 還允許你利用目前還沒有的虛擬機器人設備進行實驗。
Stage提供了多種傳感器和執(zhí)行器,包括聲納,激光掃描測距儀,色斑顯示器,里程計,抓斗,防撞器/觸須器以及移動機器人基坐等。
2、啟動turtlebot stage仿真程序
(indigo版本支持,kinetic版本沒有跑通)
打開命令終端,輸入一下命令:
roslaunch turtlebot_stage turtlebot_in_stage.launch
turtlebot_stage 導航仿真分別啟動了以下ros包:
- stage???????????????????????????? 仿真世界環(huán)境發(fā)布各種TF坐標關系,odom、base_scan等仿真數(shù)據(jù)
? - map_server???????????????? 地圖服務,加載其提供的仿真世界的地圖
? - move_base????????????????? 導航功能包,接收其他包的數(shù)據(jù)實現(xiàn)導航功能,調(diào)用A*、DWA實現(xiàn)路徑規(guī)劃
? - static map??????????????????? 靜態(tài)地圖
? - amcl?????????????????????????????? 激光定位程序,通過粒子濾波算法實現(xiàn)機器人的實時定位
? - rviz view?????????????????????? Rviz可視化顯示機器人狀態(tài)、傳感器數(shù)據(jù)、導航路線、costmap、設定導航目標點
?
啟動的窗口包括:
I、Stage的仿真世界:(相當于真實世界)
II、Rviz環(huán)境:(地圖、turtlebot模型、算法運行的數(shù)據(jù)可視化)
III、左右輪TF連接狀態(tài):
?
3、turtlebot_in_stage.launch 文件內(nèi)容
?
<!--
? Turtlebot navigation simulation:
? - stage
? - map_server
? - move_base
? - static map
? - amcl
? - rviz view
?-->
<launch>
? <arg name="base"?????? default="$(optenv TURTLEBOT_BASE kobuki)"/>? <!-- create, rhoomba -->
? <arg name="stacks"???? default="$(optenv TURTLEBOT_STACKS hexagons)"/>? <!-- circles, hexagons -->
? <arg name="3d_sensor"? default="$(optenv TURTLEBOT_3D_SENSOR kinect)"/>? <!-- kinect, asus_xtion_pro -->
?
? <!-- Name of the map to use (without path nor extension) and initial position -->
? <arg name="map_file"?????? default=" $(env TURTLEBOT_STAGE_MAP_FILE)"/> <!-- robopark_plan -->
? <arg name="world_file"?? ??default=" $(env TURTLEBOT_STAGE_WORLD_FILE)"/>
? <arg name="initial_pose_x" default="2.0"/>
? <arg name="initial_pose_y" default="2.0"/>
? <arg name="initial_pose_a" default="0.0"/>
?
? <param name="/use_sim_time" value="true"/>
? <!--? ******************** Stage ********************? -->
? <!--
??????? Publishes transforms:
????????? /base_link -> /base_laser
????????? /base_footprint -> /base_link (identity)
????????? /odom -> base_footprint
??????? Publishes topics:
????????? /odom : odometry data from the simulated odometry
????????? /base_scan : laser data from the simulated laser
????????? /base_pose_ground_truth : the ground truth pose
??????? Parameters:
????????? base_watchdog_timeout : time (s) after receiving the last command on cmd_vel before stopping the robot
??????? Args:
????????? -g : run in headless mode.
? -->
? <node pkg="stage_ros" type="stageros" name="stageros" args="$(arg world_file)">
?? ?<param name="base_watchdog_timeout" value="0.5"/>
??? <remap from="odom" to="odom"/>
??? <remap from="base_pose_ground_truth" to="base_pose_ground_truth"/>
??? <remap from="cmd_vel" to="mobile_base/commands/velocity"/>
??? <remap from="base_scan" to="scan"/>
? </node>
?
? <!--? ***************** Robot Model *****************? -->
? <include file="$(find turtlebot_bringup)/launch/includes/robot.launch.xml">
??? <arg name="base" value="$(arg base)" />
??? <arg name="stacks" value="$(arg stacks)" />
??? <arg name="3d_sensor" value="$(arg 3d_sensor)" />
? </include>
? <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher">
??? <param name="use_gui" value="true"/>
? </node>
?
? <!-- Command Velocity multiplexer -->
? <node pkg="nodelet" type="nodelet" name="mobile_base_nodelet_manager" args="manager"/>
? <node pkg="nodelet" type="nodelet" name="cmd_vel_mux" args="load yocs_cmd_vel_mux/CmdVelMuxNodelet mobile_base_nodelet_manager">
??? <param name="yaml_cfg_file" value="$(find turtlebot_bringup)/param/mux.yaml"/>
??? <remap from="cmd_vel_mux/output" to="mobile_base/commands/velocity"/>
? </node>
?
? <!--? ************** Navigation? ***************? -->
? <include file="$(find turtlebot_navigation)/launch/includes/move_base.launch.xml"/>
?
? <!--? ****** Maps *****? -->
? <node name="map_server" pkg="map_server" type="map_server" args="$(arg map_file)">
??? <param name="frame_id" value="/map"/>
? </node>
?
? <include file="$(find turtlebot_navigation)/launch/includes/amcl/amcl.launch.xml">
??? <arg name="scan_topic" value="scan"/>
??? <arg name="use_map_topic" value="true"/>
??? <arg name="initial_pose_x" value="$(arg initial_pose_x)"/>
??? <arg name="initial_pose_y" value="$(arg initial_pose_y)"/>
??? <arg name="initial_pose_a" value="$(arg initial_pose_a)"/>
? </include>
?
? <!--? **************** Visualisation ****************? -->
? <node name="rviz" pkg="rviz" type="rviz" args="-d $(find turtlebot_stage)/rviz/robot_navigation.rviz"/>
</launch>
?
4、設定目標位置,觀看機器人自主導航過程
在rviz界面,點擊菜單欄的【2D Nav Goal】 然后在圖書中選擇一個位置點擊鼠標左鍵并拖到鼠標設定方向終點機器人的方向。
會發(fā)現(xiàn)機器人自動設定了全局路徑,并啟用DWA算法自動導航到設定的目標位置。
?
?
?
總結
以上是生活随笔為你收集整理的Turtlbot仿真之Stage的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: bitbucket配置_Bitbucke
- 下一篇: 大周人工智能资源