ROS进二阶学习笔记(6) -- ROS Bag

ROS进二阶学习笔记(6) – ROS Bag ROS Bag是ROS计算图级的一个概念: Bags: ref : http://wiki.ros.org/Bags 在 计算图里 在线使用 工具:rosbag 创建bags, 收听topic,记录数据。可以回放或者remap到别的topic。 rosbag还能处理具有时间戳的数据,publish一个 simulated clock that corresponds to the time the data was recorded in the file。 bag文件的格式用来记录和回放数据都是非常高效的,消息都是跟在ros里一样的格式记录的。 具体command-line使用方法: rosbag command-line usage 离线使用和数据迁移 有多种离线使用方式。 工具:rqt_bag 可以让你可视化bag数据,plot 或者image。ref rqt_bag: http://wiki.ros.org/rqt_bag 工具:rostopic 快速查看bag文件,list topics 和 echoing data to console. Display messages in a bag file: $ rostopic echo -b log_file.bag /topic_name rostopic list list Display a list of current topics. $ rostopic list list List topics in the specified namespace.

READ MORE

ROS进二阶学习笔记(5)- 命名与命名空间

ROS进二阶学习笔记(5)- 命名与命名空间 ref: http://wiki.ros.org/Names 命名空间(wiki pedia) ref: https://zh.wikipedia.org/wiki/命名空间 命名空间(英语:Namespace),也称名字空间、名称空间等,它表示着一个标识符(identifier)的可见范围。一个标识符可在多个命名空间中定义,它在不同命名空间中的含义是互不相干的。这样,在一个新的命名空间中可定义任何标识符,它们不会与任何已有的标识符发生冲突,因为已有的定义都处于其他命名空间中。 例如,设Bill是X公司的员工,工号为123,而John是Y公司的员工,工号也是123。由于两人在不同的公司工作,可以使用相同的工号来标识而不会造成混乱,这里每个公司就表示一个独立的命名空间。如果两人在同一家公司工作,其工号就不能相同了,否则在支付工资时便会发生混乱。 这一特点是使用命名空间的主要理由。在大型的计算机程序或文档中,往往会出现数百或数千个标识符。命名空间(或类似的方法,见“命名空间的模拟”一节)提供一隐藏区域标识符的机制。通过将逻辑上相关的标识符组织成相应的命名空间,可使整个系统更加模块化。 ROS中,命名的意义 如何使用命名,及规则

READ MORE

ROS进二阶学习笔记(4) - ROS and Multithread

ROS进二阶学习笔记(4) - ROS and Multithread ROS进二阶学习笔记(4) - ROS and Multithread I’ll discuss about the concept of thread, multithread, and the application of multithread coding in ROS env. 1. What’s multithread? - Basics of operating system ref: http://blog.csdn.net/modiziri/article/details/41960179 http://www.runoob.com/[python](https://so.csdn.net/so/search?q=python&spm=1001.2101.3001.7020)/python-multithreading.html http://codingpy.com/article/python-201-a-tutorial-on-threads/ 2. multithread and C++/Python 3. ROS and multithread 4. A suitable tutorial for beginner of multithread

READ MORE

ROS进二阶学习笔记(3) - programmatic way to start-stop a roslaunch

ROS进二阶学习笔记(3) - programmatic way to start-stop a roslaunch ROS进二阶学习笔记(3) - programmatic way to start/stop a roslaunch Sometimes, we need to start/stop a ros .launch file/ ros node in a programmatic way, especially when we bring in the SMACH method to handle our applications. Here are some threads in answers.ros.org web, and I summarised. Just share what I’ve done. to be Generous. Specify this source if you need to repost/quote. thx~ First of first: You have two requirments: Starting a node or a launch file:

READ MORE

Hack the RPLiDAR A1 Laser Scanner

Hack the RPLiDAR A1 Laser Scanner Hack the RPLiDAR-A1 Laser Scanner Hacking the RPLiDAR A1 is very similar with the Hacking of Neato XV-11 Laser Scanner: http://wiki.ros.org/xv_11_laser_driver/Tutorials/Connecting%20the%20XV-11%20Laser%20to%20USB They all use UART-TTL as the data transmission protocal. So we need to find out the TX and RX wire for the scanner to communicate with the UART-USB converter. Below is the picture of the RP-LiDAR A1: It consists of a driving motor, a laser scanner, a circuit board and a converting board.

READ MORE

简单的Git 命令:获取仓库文件和切换远程分支

简单的Git 命令:获取仓库文件和切换远程分支 简单的Git 命令:获取仓库文件和切换远程分支 git clone git@gitlab.xxx.com:xxxxx.git //从远程clone 分支下来,一般是默认master。 有时不是,用 git branch 可以看到: * indigo-devel 说明此时是在indigo-devel上。 === 要切换到master: ==== git branch -r //查看远程分支, git branch -a //查看本地和远程分支。 如: remotes/origin/master remotes/origin/indigo-devel *如果本地没有master,要创建master: git checkout -b master remotes/origin/master //本地创建master分支,并与远程remotes/origin/master同步 git branch //检查本地当前分支 === 切换到其他分支: ==== git checkout hydro-devel //从master 切换到 hydro-devel 分支 git checkout indigo-devel //从hydro 切换到 indigo-devel 分支 git checkout master // 从indigo-devel 切换到 master 分支 **有关Git,更多教程参见: http://edu.csdn.net/course/detail/1223 文章知识点与官方知识档案匹配,可进一步学习相关知识Git技能树首页概览7351 人正在系统学习中

READ MORE

ROS进二阶学习笔记(2)- SMACH:用状态机来管理机器人任务

ROS进二阶学习笔记(2)- SMACH:用状态机来管理机器人任务 ROS进二阶学习笔记(2) - SMACH:用状态机来管理机器人任务 http://wiki.ros.org/smach/Tutorials/Getting Started http://wiki.ros.org/smach/Tutorials 好久没有更新关于ROS的笔记,这里进入SMACH的学习和应用,参照rbx2(ros by example volume 2),和ROS官方wiki,进行学习。 ==== 关于概念 SMACH states是Python类,通过重写exe​​cute()方法来返回一个或多个可能的outcomes, 从而扩展smach.State类。 excute() 方法也可以通过可选的参数来来定义一个userdata集合,这个集合可以被用来传递状态之间的信息。本质上讲,状态执行的实际计算基本上可以是任何你想要的。并且,有很多预先定义好的state types ,这可以节省大量的非必须的代码。 A SMACH state machine is another Python class (smach.StateMachine) that can contain a number of states. A state is added to a state machine by defining a set of transitions from the state’s outcomes to other states in the machine. When a state machine is run, these transitions determine the flow of execution from state to state: input → STATE_1 → {outcome, transition} → STATE_2

READ MORE

用scp传输文件

用scp传输文件 === scp in linux : 用ssh传输文件 == ref: https://www.vpser.net/manage/scp.html === 获取远程服务器上的文件 === scp root@www.vpser.net:/root/lnmp0.4.tar.gz /home/lnmp0.4.tar.gz scp -P 2222 root@www.vpser.net:/root/lnmp0.4.tar.gz /home/lnmp0.4.tar.gz 上端口大写P 为参数,2222 表示更改SSH端口后的端口,如果没有更改SSH端口可以不用添加该参数。 root@www.vpser.net 表示使用root用户登录远程服务器www.vpser.net,:/root/lnmp0.4.tar.gz 表示远程服务器上的文件,最后面的/home/lnmp0.4.tar.gz表示保存在本地上的路径和文件名。还可能会用到p参数保持目录文件的权限访问时间等。 === 获取远程服务器上的目录 === scp -P 2222 -r root@www.vpser.net:/root/lnmp0.4/ /home/lnmp0.4/ 上端口大写P 为参数,2222 表示更改SSH端口后的端口,如果没有更改SSH端口可以不用添加该参数。-r 参数表示递归复制(即复制该目录下面的文件和目录);root@www.vpser.net 表示使用root用户登录远程服务器www.vpser.net,:/root/lnmp0.4/ 表示远程服务器上的目录,最后面的/home/lnmp0.4/表示保存在本地上的路径。 === 3、将本地文件上传到服务器上 === scp -P 2222 /home/lnmp0.4.tar.gz root@www.vpser.net:/root/lnmp0.4.tar.gz 上端口大写P 为参数,2222 表示更改SSH端口后的端口,如果没有更改SSH端口可以不用添加该参数。 /home/lnmp0.4.tar.gz表示本地上准备上传文件的路径和文件名。root@www.vpser.net 表示使用root用户登录远程服务器www.vpser.net,:/root/lnmp0.4.tar.gz 表示保存在远程服务器上目录和文件名。 === 4、将本地目录上传到服务器上 === scp -P 2222 -r /home/lnmp0.4/ root@www.vpser.net:/root/lnmp0.4/ 上 端口大写P 为参数,2222 表示更改SSH端口后的端口,如果没有更改SSH端口可以不用添加该参数。-r 参数表示递归复制(即复制该目录下面的文件和目录);/home/lnmp0.4/表示准备要上传的目录,root@www.vpser.net 表示使用root用户登录远程服务器www.vpser.net,:/root/lnmp0.4/ 表示保存在远程服务器上的目录位置。 5、可能有用的几个参数 : -v 和大多数 linux 命令中的 -v 意思一样 , 用来显示进度 .

READ MORE

Ubuntu - usb转串口设备的访问权限设置

Ubuntu - usb转串口设备的访问权限设置 可以用如下命令查看串口信息: ls -l /dev/ttyUSB* 但是普通用户没有usb操作权限,下面介绍如何设置usb串口操作权限: 用命令增加访问权限: sudo chmod 666 /dev/ttyUSB0 通过增加udev规则来实现 步骤如下: 创建文件: sudo gedit /etc/udev/rules.d/70-ttyusb.rules 在文件内增加一行 KERNEL=="ttyUSB[0-9]*", MODE="0666" 重新插入USB转串口设备,普通用户就有权限访问了。 另一种写法: 70-ttyusb.rules文件还有另一种写法,先用lsusb查看USB转串口芯片的idVendor和idProduct #lsusb 显示结果中有这么一行 Bus 005 Device 007: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC 其中 ID 0403:6001表示idVendor=0403,idProduct=6001 70-ttyusb.rules的内容如下: SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001",MODE="0666", 重新插入USB转串口设备,普通用户同样可以访问了。除此之外,还可以: 重新指派usb转串口模块在linux系统中的设备调用名称(English Version: remap your usb-serial devices’ names in Linux )

READ MORE

ROS:使用ROS_arduino_bridge Stack

ROS:使用ROS_arduino_bridge Stack 使用ROS_arduino_bridge Stack 使ROS得到odom信息 和 使move base(移动底盘)获得 cmd_vel信息,需要个桥梁。 而修改 ROS_arduino_bridge Stack 后可以完成此任务。 目的就是 发布 odom 和 使movebase(移动底盘)得到cmd_vel 信息,从而控制底盘运动。 斟酌后,Finally,使用stack(后来叫做 Metapackage): ROS Arduino Bridge 来完成此项工作: ref: http://wiki.ros.org/ros_arduino_bridge https://github.com/hbrobotics/ros_arduino_bridge/blob/indigo-devel/README.md 使用ROS_arduino_bridge Stack 参照 ref 中github中 readme.md 进行配置。 最后一个Section : Note中说明了如果在硬件与它们不匹配的情况下依然使用这个 stack 帮助快速建立 ROS and arduino连接的方法。 check out 代码命令: $ cd ~/catkin_ws/src $ git clone https://github.com/hbrobotics/ros_arduino_bridge.git $ cd rbx1 $ git checkout hydro-devel $ cd ~/catkin_ws $ catkin_make $ source ~/catkin_ws/devel/setup.bash install the ROSArduinoBridge library for Arduino ref : https://www.arduino.cc/en/Guide/Libraries#toc5 来手动滴add Library: Restart the Arduino application.

READ MORE