ROS进阶学习手记 7 -- RViz仿真实例1

本文介绍了使用ROS下的RViz工具进行仿真的过程,通过ExBotXI机器人实验室的包实现移动机器人的建模与控制。文章详细记录了如何启动仿真环境、加载机器人模型并利用键盘控制机器人移动。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


【任务2】:
    用simulator: RViz 工具,完成对小车的建模,名字drive RViz = dvrv, 用 dvrv_node 发布topic和数据格式,向它发送位置指令,使它能接受键盘输入,并完成前进,后退,转弯90°功能。

    Topic, 还是拟用/turtle1/cmd_vel

    Message Type: geometry_msgs/Twist

    -----------

    1. RViz介绍

         参考:RViz Package Link: http://wiki.ros.org/rviz
                   内含:RViz User Guide:    http://wiki.ros.org/rviz/UserGuide
                              RViz Tutorials:        http://wiki.ros.org/rviz/Tutorials

         rviz是一个显示机器人实体的工具,本身不具有模拟的功能,需要安装一个模拟器arbotix。但官网有关arbotix的资料很缺,跟另一个“10分钟上手玩ROS仿真”http://blog.exbot.net/archives/899, 对比一个不work的教程:ros_by_example_1_hydro.pdf  (6.2 Testing the Simulator),有兴趣可以研究5. Installing the ros-by-example Code以后,再玩6.2, 估计就work了。本次就不深入那个。

    2. 用ExBot机器人实验室的包来仿真

         打开terminal,输入命令:

      roslaunch exbotxi_rviz view_model.launch
         将会打开rviz,并加载查看ExBot XI移动机器人平台模型的配置。

         ExBot XI移动机器人平台兼容turtlebot了,这里就用turtlebot包的键盘控制node来控制机器人移动。

Ctrl + C 结束掉前面的程序,关闭terminal,然后再打开3个terminal,分别输入下面的3个命令:

         roslaunch exbotxi_bringup fake_exbotxi.launch
         roslaunch exbotxi_rviz view_mobile.launch
         roslaunch turtlebot_teleop keyboard_teleop.launch
         跟这个“ 10分钟上手玩ROS仿真” 走完整个流程就好。

第1条命令用于启动ExBot XI仿真机器人,启动成功后显示信息如下:

view robot

第2条命令用于打开ROS可视化工具rviz,并加载移动机器人视图配置。
       第3条命令用于启动键盘控制node。
       

现在将光标focus在第3条命令的terminal窗口,便可以通过键盘控制仿真机器人了:

view control


    3. 拆解ExBot机器人实验室的包

        首先打开fake_exbotxi.launch文件。(  ~/catkin_ws/src/exbot_xi/exbotxi_bringup/launch  )

  文件可以大概分为四个部分:

          (1) 从指定的包中加载urdf文件

          (2) 启动arbotix模拟器

          (3) 启动状态发布节点

          (4) tf 坐标系配置--本次可能没有

<launch>
  <arg name="urdf_file" default="$(find xacro)/xacro.py '$(find exbotxi_description)/urdf/exbotxi.urdf.xacro'" />
  <param name="robot_description" command="$(arg urdf_file)" />
  
  <node name="arbotix" pkg="arbotix_python" type="arbotix_driver" output="screen">
    <rosparam command="delete" param="/arbotix" />
    <rosparam file="$(find exbotxi_bringup)/config/fake_irobot_create_arbotix.yaml" command="load" />
    <param name="sim" value="true"/>
    <remap from="cmd_vel" to="mobile_base/commands/velocity"/>
  </node>
  
  <node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher">
    <param name="publish_frequency" type="double" value="8.0" />
  </node>
  
  <node pkg="topic_tools" type="mux" name="exbotxi_mux1" args="mobile_base/commands/velocity cmd_vel_mux/input/teleop" />
  <node pkg="topic_tools" type="mux" name="exbotxi_mux2" args="mobile_base/commands/velocity cmd_vel" />
</launch>


         接下来的几个教程都要follow这个古月居的博客了,古月居的专栏:http://blog.youkuaiyun.com/column/details/ros-explore.html

        

        

        

        



    附录:安装arbotix

         安装 arbotix :  (如果联网有问题,还原网络设定,hosts文件有关的设定,http://blog.youkuaiyun.com/sonictl/article/details/46986565)

         $ sudo apt-get install ros-hydro-arbotix

         然后加入ros package路径:

         $ rospack profile

         参考:http://blog.youkuaiyun.com/scliu12345/article/details/44521327
         测试仿真器:

         $ roslaunch rbx1_bringup fake_turtlebot.launch

         遇到错误,[fake_turtlebot.launch] is neither a launch file in package [rbx1_bringup] nor is [rbx1_bringup] a launch file name
         找了半天估计是跟错教程了,果断换






posted on 2015-07-24 15:46 sonictl 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/sonictl/p/6735530.html

### ROS Humble Husky RViz Configuration and Usage Tutorial In the context of working with a Husky robot under ROS 2 Humble, configuring RViz involves several key steps to ensure proper visualization and interaction capabilities. The process starts by obtaining an appropriate Docker image that includes ROS 2 Humble as described previously[^1]. Once this environment is set up, specific configurations tailored for Husky can be applied. #### Setting Up the Environment To begin using RViz specifically configured for Husky within ROS 2 Humble: - Ensure installation of the correct Docker container which contains all necessary dependencies including ROS 2 Humble. ```bash docker pull osrf/ros:humble-desktop-full-jammy ``` After pulling down the required Docker image, start it while mounting any needed directories from your host machine into the container so you have access to custom packages or files outside the default setup provided by OSRF's official images. #### Launching RViz Configured for Husky For launching RViz pre-configured for use with Husky robots, one typically uses launch files included in the `husky_viz` package available through standard ROS repositories when setting up environments based on ROS distributions like Humble. These launch files often come equipped with preset displays such as laser scans, camera feeds, point clouds among others relevant sensors commonly found aboard these platforms. If not already installed inside the running Docker instance, ```bash apt-get update && apt-get install -y ros-humble-husky-viz ``` Then execute the following command to bring up RViz along with its initial settings optimized for interacting visually with a Husky unit over ROS topics/services: ```bash ros2 launch husky_viz view_robot.launch.py ``` This will open RViz displaying various sensor outputs associated with the Husky platform automatically without manual adjustments being immediately necessary unless customization beyond defaults is desired. #### Customizing Displays Using Plugins As mentioned earlier about extending functionality via plugins[^3], users may wish to add more specialized visualizations pertinent to their applications involving Husky units. This could involve integrating third-party libraries supporting additional types of data representation or even developing proprietary extensions depending upon project requirements. #### Utilizing Rviz Effectively With Husky Beyond basic viewing functionalities offered out-of-the-box, leveraging tools integrated alongside RViz—such as dynamic reconfiguration interfaces accessible through commands similar to those used for color detection tasks outlined before[^4]—can enhance operational efficiency during development phases where real-time parameter tuning proves beneficial.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值