小强 ROS 机器人教程

首先请您自行依据线标提示将小强接线连接好,完整结构如下两图所示:

小强 ROS 机器人教程

小强是属于Turtlebot机器人。它由底盘、主机、Kinect相机(通过USB连接主机)组成,没有显示屏。如果要通过显示器查看主机的Linux影像,则需要通过HDMI转VGA线另外连接台式电脑显示器。

小强 ROS 机器人教程

本机ip地址:查询本机ip地址

通过ssh远程连接,其中xxx.xxx.xxx.xxx是小强的IP

ssh xiaoqiang@xxx.xxx.xxx.xxx

在小强机器人上按“ctrl+alt+t”调出命令窗口:

xiaoqiang@xiaoqiang-desktop:~$ ifconfig -a
eth12 Link encap:Ethernet HWaddr 00:e0:4c:68:01:87
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

eth13 Link encap:Ethernet HWaddr 00:e0:4c:68:01:88
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:4379835 errors:0 dropped:0 overruns:0 frame:0
TX packets:4379835 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:154070895214 (154.0 GB) TX bytes:154070895214 (154.0 GB)

wlan7 Link encap:Ethernet HWaddr e8:fc:af:9e:05:ed
inet addr:172.29.78.130 Bcast:172.29.255.255 Mask:255.255.0.0
inet6 addr: fe80::eafc:afff:fe9e:5ed/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:31230 errors:0 dropped:0 overruns:0 frame:110951
TX packets:27909 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:10462279 (10.4 MB) TX bytes:5136459 (5.1 MB)
Interrupt:16

远程调用:

niu@niu-ThinkPad-T510:~$ ssh xiaoqiang@172.29.78.130
The authenticity of host '172.29.78.130 (172.29.78.130)' can't be established.
ECDSA key fingerprint is SHA256:1pDxKQ/7sw1WsI+KzJnn3OYQbyHMQAXTSNdC775jAgk.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '172.29.78.130' (ECDSA) to the list of known hosts.
xiaoqiang@172.29.78.130's password:
Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 4.4.0-45-generic x86_64)

* Documentation:  https://help.ubuntu.com/

Your Hardware Enablement Stack (HWE) is supported until April 2019.
Last login: Sat Dec 10 11:48:47 2016 from ubuntu

查询服务:

xiaoqiang@xiaoqiang-desktop:~$ rostopic list
/ORB_SLAM/Camera
/ORB_SLAM/Frame
/camera_node/camera_info
/camera_node/image_raw
/camera_node/image_raw/compressed
/camera_node/image_raw/compressed/parameter_descriptions
/camera_node/image_raw/compressed/parameter_updates
/camera_node/image_raw/compressedDepth
/camera_node/image_raw/compressedDepth/parameter_descriptions
/camera_node/image_raw/compressedDepth/parameter_updates
/camera_node/image_raw/theora
/camera_node/image_raw/theora/parameter_descriptions
/camera_node/image_raw/theora/parameter_updates
/cmd_vel
/globalMoveFlag
/imu_cal
/joint_states
/orb_scale/scaleStatus
/rosout
/rosout_agg
/system_monitor/report
/tf
/tf_static
/usb_cam/brightness
/xqserial_server/Odom
/xqserial_server/Pose2D
/xqserial_server/Power
/xqserial_server/StatusFlag
/xqserial_server/Twist
xiaoqiang@xiaoqiang-desktop:~$

查看系统状态:

xiaoqiang@xiaoqiang-desktop:~$ rostopic echo /system_monitor/report
imageStatus: True
odomStatus: True
orbStartStatus: False
orbInitStatus: False
orbScaleStatus: False
brightness: 0
power: 11.4527730942

其中 imageStatus 表示摄像头是否工作正常。odomStatus 表示底层驱动时候工作正常。Orb相关的三个变量是视觉导航相关的状态,可以不用管(如果对这方面感兴趣可以在论坛里进
行交流)。brightness 是摄像头的亮度,power 是当前电池的电压值,如果无法读取则是 0.

远程遥控:

通过 ssh 进行连接
ssh xiaoqiang@xxx.xxx.xxx.xxx
启动遥控程序
rosrun nav_test control.py

现在就可以通过方向键来控制小强的移动了。空格键是停止。Ctrl + C 退出程序。

视频传输:

修改hosts文件:https://zhidao.baidu.com/question/201310150745872645.html      http://os.51cto.com/art/200803/68170.htm

rosrun image_view image_view image:=/camera_node/image_raw_image_transport:=compressed

niu@niu-ThinkPad-T510:~$ export ROS_MASTER_URI=http://172.29.78.130:11311
niu@niu-ThinkPad-T510:~$ rosrun image_view image_view image:=/camera_node/image_raw image_transport:='compressed'
init done
[ INFO] [1482102718.080234054]: Using transport "raw"

帮助信息:http://blog.csdn.net/crazyquhezheng/article/details/50324583

1.配置小强网络

http://community.bwbot.org/topic/61/%E5%B0%8F%E5%BC%BA%E7%9A%84%E8%BF%9C%E7%A8%8B%E5%8D%8F%E5%8A%A9%E5%8A%9F%E8%83%BD

为什么一定要是Linux呢,因为ROS只有Linux版,所以必须是Linux,而且Linux是开源的系统,免费而且开源,可以改造,轻便,适合于工业制造,而且有很多的开源代码,当然很多开源代码是跨平台的,通过CMake也可以用于Windows、Mac、Android等。

为什么一定要将图像传输到服务器端,在客户端也可以处理啊,的确是这样,但是服务器端可以操纵小车的行走,这个是在客户端所不能完成的,所以这个控制是必须由服务器端完成的。

小强 ROS 机器人教程

小强 ROS 机器人教程

上一篇:测试到2014-2-20命令(ADB、TOP和Monkey……)汇总


下一篇:Sql Server中 select into 的用法