ROS探索总结(四)——简单的机器人仿真
前边我们已经介绍了ROS的基本情况,以及新手入门ROS的初级教程,现在就要真正的使用ROS进入机器人世界了。接下来我们涉及到的很多例程都是《ROS by Example》这本书的内容,我是和群里的几个人一起从国外的亚马逊上买到的,还是很有参考价值的,不过前提是你已经熟悉之前的新手教程了。
一、ROS by Example
- svn checkout http://ros-by-example.googlecode.com/svn/trunk/rbx_vol_1
- rosmake rbx_vol_1
- rospack profile //加入ROS package路径
二、rviz简单机器人模拟
1、安装机器人模拟器
- svn checkout http://vanadium-ros-pkg.googlecode.com/svn/trunk/arbotix
- rosmake arbotix
2、TurtleBot机器人的模拟
机器人模拟运行:
- roscore
- roslaunch rbx1_bringup fake_pi_robot.launch
- rosrun rviz rviz -d `rospack find rbx1_nav`/sim_fuerte.vcg
此时的机器人是静止的,需要发布一个消息才能让它动起来。
- rostopic pub -r 10 /cmd_vel geometry_msgs/Twist '{linear: {x: 0.2, y: 0, z: 0}, angular: {x: 0, y: 0, z: 0.5}}'
- rostopic pub -1 /cmd_vel geometry_msgs/Twist '{}'
三、实现分析
1、TurtleBot机器人运行
- <launch>
- <param name="/use_sim_time" value="false" />
- <!-- Load the URDF/Xacro model of our robot -->
- <arg name="urdf_file" default="$(find xacro)/xacro.py '$(find turtlebot_description)/urdf/turtlebot.urdf.xacro'" />
- <param name="robot_description" command="$(arg urdf_file)" />
- <node name="arbotix" pkg="arbotix_python" type="driver.py" output="screen">
- <rosparam file="$(find rbx1_bringup)/config/fake_turtlebot_arbotix.yaml" command="load" />
- <param name="sim" value="true"/>
- </node>
- <node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher">
- <param name="publish_frequency" type="double" value="20.0" />
- </node>
- <!-- We need a static transforms for the wheels -->
- <node pkg="tf" type="static_transform_publisher" name="odom_left_wheel_broadcaster" args="0 0 0 0 0 0 /base_link /left_wheel_link 100" />
- <node pkg="tf" type="static_transform_publisher" name="odom_right_wheel_broadcaster" args="0 0 0 0 0 0 /base_link /right_wheel_link 100" />
- </launch>
(1) 从指定的包中加载urdf文件
(2) 启动arbotix模拟器
(3) 启动状态发布节点
(4) tf坐标系配置
2、rviz配置文件
- Background\ ColorB=0.12549
- Background\ ColorG=0.12549
- Background\ ColorR=0.12549
- Camera\ Config=158.108 0.814789 0.619682 -1.57034
- Camera\ Type=rviz::FixedOrientationOrthoViewController
- Fixed\ Frame=/odom
- Grid.Alpha=0.5
- Grid.Cell\ Size=0.5
- Grid.ColorB=0.941176
- Grid.ColorG=0.941176
- Grid.ColorR=0.941176
- Grid.Enabled=1
- Grid.Line\ Style=0
- Grid.Line\ Width=0.03
- Grid.Normal\ Cell\ Count=0
- Grid.OffsetX=0
- Grid.OffsetY=0
- Grid.OffsetZ=0
- Grid.Plane=0
上面的代码是配置背景颜色和网格属性的,对应rviz中的选项如下图所示。
其中比较重要的一个选项是Camera的type,这个选项是控制开发者的观察角度的,书中用的是FixedOrientationOrthoViewController的方式,就是上面图中的俯视角度,无法看到机器人的三维全景,所以可以改为OrbitViewController方式,如下图所示:
3、发布topic
这里的topic就是速度命令,针对这个topic,我们需要发布速度的信息,在ROS中已经为我们写好了一些可用的数据结构,这里用的是Twist信息的数据结构。在终端中可以看到Twist的结构如下:
- Background\ ColorB=0.12549
- Background\ ColorG=0.12549
- Background\ ColorR=0.12549
- Camera\ Config=158.108 0.814789 0.619682 -1.57034
- Camera\ Type=rviz::FixedOrientationOrthoViewController
- Fixed\ Frame=/odom
- Grid.Alpha=0.5
- Grid.Cell\ Size=0.5
- Grid.ColorB=0.941176
- Grid.ColorG=0.941176
- Grid.ColorR=0.941176
- Grid.Enabled=1
- Grid.Line\ Style=0
- Grid.Line\ Width=0.03
- Grid.Normal\ Cell\ Count=0
- Grid.OffsetX=0
- Grid.OffsetY=0
- Grid.OffsetZ=0
- Grid.Plane=0
4、节点关系图
----------------------------------------------------------------
欢迎大家转载我的文章。
转载请注明:转自古-月
欢迎继续关注我的博客
ROS探索总结(四)——简单的机器人仿真的更多相关文章
- Robot Operating System (ROS)学习笔记---创建简单的机器人模型smartcar
搭建环境:XMWare Ubuntu14.04 ROS(indigo) 转载自古月居 转载连接:http://www.guyuehome.com/243 一.创建硬件描述包 已创建catkin_ ...
- ROS探索总结(五)——创建简单的机器人模型smartcar
前面我们使用的是已有的机器人模型进行仿真,这一节我们将建立一个简单的智能车机器人smartcar,为后面建立复杂机器人打下基础. 一.创建硬件描述包 roscreat-pkg smartcar_de ...
- ROS和Gazebo进行机器人仿真(一)
Gazebo是一种多机器人仿真器,可用于室内外机器人仿真.Gazebo在ROS中有良好的接口,包含ROS和Gazebo的所有控制. 若要实现ROS到Gazebo的通信,我们必须安装ROS-Gazebo ...
- 【kinetic】操作系统探索总结(五)创建简单的机器人模型smartcar
p { margin-bottom: 0.1in; direction: ltr; line-height: 120%; text-align: justify } a:link { color: r ...
- ROS探索总结(十七)——构建完整的机器人应用系统
上一篇博客介绍了HRMRP机器人平台的设计,基于该平台,可以完成丰富的机器人应用,以较为典型的机器人导航为例,如何使用HRMRP来完成相应的功能?本篇博客将详细介绍如何将HRMRP应用到 ...
- ROS探索总结(一)——ROS简介
转自古-月 ROS探索总结(一)——ROS简介 一.历史 随着机器人领域的快速发展和复杂化,代码的复用性和模块化的需求原来越强烈,而已有的开源机器人系统又不能很好的适应需求.2010年Willow G ...
- 机器人与机器人仿真技术(zz)
http://www.viblue.com/archives/5587.htm 一.机器人简介: 机器人(Robot)是自动执行工作的机器装置.它既可以接受人类指挥,又可以运行预先编排的程序,也可以根 ...
- ROS系统MoveIt玩转双臂机器人系列(一)
一.ROS系统的MoveIt模块简介 机器人操作系统ROS目前最受关注的两个模块是导航(Navigation)和机械臂控制(MoveIt!),其中,机械臂控制模块(后面简称MoveIt)可以让用户快速 ...
- 基于 Mathematica 的机器人仿真环境(机械臂篇)[转]
完美的教程,没有之一,收藏学习. 目的 本文手把手教你在 Mathematica 软件中搭建机器人的仿真环境,具体包括以下内容(所使用的版本是 Mathematica 11.1,更早的版本可能缺少某些 ...
随机推荐
- TODO 正则表达式
TODO: break it. \btodo\b.* FIXME: break it. \bfixme\b.* TODO: [Bob] break it. \btodo\s*:\s*\[bob\].*
- Install nginx on ubuntu
1. Install libpcre3, libpcre3-dev2. Install zlib1g-dev3. Download nginx and unzip it4. ./configure5. ...
- Asp.net 异步调用WebService
//服务代码 [WebMethod] public string Test(int sleepTimes, int val) { Thread.Sleep(sleepTimes); var log = ...
- Ubuntu下使用tmux实现分屏,以及tmux快捷键
最近用到了终端的复用,使用了tmux,写一下自己的使用和一些快捷键. tmux是指通过一个终端登录远程主机并运行后,在其中可以开启多个控制台的终端复用软件. 来个效果图: 截图我使用的命令是 gno ...
- (转)根据ImageView的大小来压缩Bitmap,避免OOM
本文转载于:http://www.cnblogs.com/tianzhijiexian/p/4254110.html Bitmap是引起OOM的罪魁祸首之一,当我们从网络上下载图片的时候无法知道网络图 ...
- (转)libcurl库使用方法,好长,好详细。
一.ibcurl作为是一个多协议的便于客户端使用的URL传输库,基于C语言,提供C语言的API接口,支持DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP ...
- linux中使用opdir_readdir读取目录中的信息
#include <dirent.h>#include <stdio.h>#include <stdlib.h> int main(int argc, char * ...
- volatile关键字及内存可见性
先看一段代码: package com.java.juc; public class TestVolatile { public static void main(String[] args) { T ...
- COGS1516. 棋盘上的车
[题目描述] 在n*n(n≤20)的方格棋盘上放置n 个车,求使它们不能互相攻击的方案总数. [输入格式] 一行一个正整数n. [输出格式] 一行一个正整数,即方案总数. [样例输入] 3 [样例输出 ...
- 洛谷 P3052 [USACO12MAR]摩天大楼里的奶牛Cows in a Skyscraper
题目描述 A little known fact about Bessie and friends is that they love stair climbing races. A better k ...