ROS1云课→19仿真turtlebot(stage)

发布于:2022-12-28 ⋅ 阅读:(579) ⋅ 点赞:(0)

ROS1云课→18一键配置


ROS1云课→17化繁为简stdr和f1tenth

依据一键配置将turtlebot仿真案例全部配置好。

TurtleBot 是带有开源软件的低成本个人机器人套件。 TurtleBot 是 Melonee Wise 和 Tully Foote 于 2010 年 11 月在 Willow Garage 创建的。使用 TurtleBot,将能够构建一个可以在房子周围行驶、以 3D 形式查看的机器人,并拥有足够的马力来创建令人兴奋的应用程序。

TurtleBot 套件包括移动底座、2D/3D 距离传感器、笔记本电脑或 SBC(单板计算机)和 TurtleBot 安装硬件套件。 除了 TurtleBot 套件,用户还可以从 ROS wiki 下载 TurtleBot SDK。 TurtleBot 的设计易于购买、构建和组装,使用现成的消费品和可轻松由标准材料制成的零件。 作为一个入门级的移动机器人平台,TurtleBot 具有该公司更大的机器人平台(如 PR2)的许多相同功能。

echo "Turtlebot mission begins."
 
echo "-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1
 
mQINBFzvJpYBEADY8l1YvO7iYW5gUESyzsTGnMvVUmlV3XarBaJz9bGRmgPXh7jc
VFrQhE0L/HV7LOfoLI9H2GWYyHBqN5ERBlcA8XxG3ZvX7t9nAZPQT2Xxe3GT3tro
u5oCR+SyHN9xPnUwDuqUSvJ2eqMYb9B/Hph3OmtjG30jSNq9kOF5bBTk1hOTGPH4
K/AY0jzT6OpHfXU6ytlFsI47ZKsnTUhipGsKucQ1CXlyirndZ3V3k70YaooZ55rG
aIoAWlx2H0J7sAHmqS29N9jV9mo135d+d+TdLBXI0PXtiHzE9IPaX+ctdSUrPnp+
TwR99lxglpIG6hLuvOMAaxiqFBB/Jf3XJ8OBakfS6nHrWH2WqQxRbiITl0irkQoz
pwNEF2Bv0+Jvs1UFEdVGz5a8xexQHst/RmKrtHLct3iOCvBNqoAQRbvWvBhPjO/p
V5cYeUljZ5wpHyFkaEViClaVWqa6PIsyLqmyjsruPCWlURLsQoQxABcL8bwxX7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PUBLIC KEY BLOCK-----" >> ~/ros.asc
 
sudo apt-key add ros.asc
 
sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/ `lsb_release -cs` main" > /etc/apt/sources.list.d/ros-latest.list'
 
sudo apt update
 
wget https://labfile.oss.aliyuncs.com/courses/854/rosdemos_ws.zip
 
git clone https://gitcode.net/ZhangRelay/ros_book.git
 
sudo apt install xpdf -y

sudo apt install ros-kinetic-turtlebot-simulator -y
 
sudo apt upgrade -y

export TURTLEBOT_STAGE_MAP_FILE=/opt/ros/kinetic/share/turtlebot_stage/maps/maze.yaml 
 
export TURTLEBOT_STAGE_WORLD_FILE=/opt/ros/kinetic/share/turtlebot_stage/maps/stage/maze.world 
 
roslaunch turtlebot_stage turtlebot_in_stage.launch

echo "Turtlebot mission completed."

上面过程完成后,会直接打开如下界面:

1. 如何开始turtlebot的stage模拟

在stage模拟中启动 TurtleBot。 Stage 是一个二维多机器人模拟器。 它模拟 .world 文件中定义的世界。 这个文件告诉舞台世界的一切,从障碍物(通常通过位图表示,用作一种背景),机器人和其他对象。

2. 解释如何将自定义地图与turtlebot 的stage模拟器一起使用,并根据需要调整配置。

两种方式:

按照相同的说明进行turtlebot debian 安装或源代码安装。

源码(indigo/kinetic/melodic/noetic基本通用的):

使用turtlebot 和rviz 启动stage模拟器。 单击 2D 导航目标并命令机器人导航地图中的任何位置。 

 

导航案例类似机器人走迷宫。 

遇到报错信息:

如何修改?这个通过源码调试。

<!-- 
  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">
  </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>

如何修改地图?实现下面功能?

export TURTLEBOT_STAGE_MAP_FILE=/opt/ros/kinetic/share/turtlebot_stage/maps/robopark_plan.yaml 
 
export TURTLEBOT_STAGE_WORLD_FILE=/opt/ros/kinetic/share/turtlebot_stage/maps/stage/robopark_plan.world 

 


 

 

-^_^-


本文含有隐藏内容,请 开通VIP 后查看