Home » Turbot3-Multi多机协同 » Turbot3-Multi多机协同教程-设备测试

Turbot3-Multi多机协同教程-设备测试

Turbot3-Multi多机协同教程-设备测试

说明:

  • 介绍如何执行单机和多机测试
  • 目前测试平台是一台服务器server0主机,三台burger为从机,分别是client0,client1,client2
  • 假设server0的ip为192.168.168.98
  • client0的ip为192.168.168.110,client1的ip为192.168.168.111,client2的ip为192.168.168.112

配置服务器server0:

  • 配置server0的wifi,设置为固定IP:192.168.168.98
  • 测试是否ip正确
ssh ubuntu@192.168.168.98 
  • 输入密码为:ubuntu,如果能正常登陆服务器即可
  • 修改主从配置
vim ~/tools/remote/inventory/bashrc.server.sh
  • 配置如下:
export ROS_MASTER_URI=http://192.168.168.98:11311 #localhost:11311
export ROS_HOSTNAME=192.168.168.98   

单机测试步骤:

  • 配置client0的wifi,设置为固定ip:192.168.168.110
  • 测试是否ip正确
ssh ubuntu@192.168.168.110
  • 输入密码为:ubuntu,如果能正常登陆即可
  • 修改主从配置
vim ~/tools/remote/inventory/bashrc.client.sh
  • 配置
export ROS_MASTER_URI=http://192.168.168.98:11311 #localhost:11311
export ROS_HOSTNAME=192.168.168.110 #localhost
  • 在server0上,启动单机
./multi_scripts/single_robot.sh
  • 启动过程:
ubuntu@T3MULTIC-V100:~$ ./multi_scripts/single_robot.sh 

PLAY ***************************************************************************

TASK [setup] *******************************************************************
ok: [localhost]

TASK [server_roscore : roscore(server)] ****************************************
changed: [localhost]

PLAY ***************************************************************************

TASK [setup] *******************************************************************
ok: [client0]

TASK [client0_minimal : roslauch turbot3_multi robot_name:=tb3_0 (client)] *****
changed: [client0]

PLAY ***************************************************************************

TASK [setup] *******************************************************************
ok: [localhost]

TASK [server0_remote : roslaunch turbot3_multi model.launch robot_name:=tb3_0 (server)] ***
changed: [localhost]

PLAY RECAP *********************************************************************
client0                    : ok=2    changed=1    unreachable=0    failed=0   
localhost                  : ok=4    changed=2    unreachable=0    failed=0 
  • 查看tf
rosrun rqt_tf_tree rqt_tf_tree
  • 测试键盘控制
./multi_scripts/multi_key.sh 0
  • 关闭程序
./multi_scripts/multi_kill.sh
  • 关闭服务器的ros和client的ros

多机测试步骤:

  • 配置client0的wifi,设置为固定ip:192.168.168.110

  • 修改主从配置

vim ~/tools/remote/inventory/bashrc.client.sh
  • 配置
export ROS_MASTER_URI=http://192.168.168.98:11311 #localhost:11311
export ROS_HOSTNAME=192.168.168.110 #localhost
  • 配置client1的wifi,设置为固定ip:192.168.168.111,方法如上
  • 配置client2的wifi,设置为固定ip:192.168.168.112,方法如上
  • 配置client3-9的wifi,方法如上
  • 在server0上执行,进行多机联通测试
./multi_scripts/multi_ping.sh
  • 在server0上执行,启动多机测试
./multi_scripts/multi_robot.sh
  • 效果如下:
ubuntu@T3MULTIC-V100:~$ ./multi_scripts/multi_robot.sh 

PLAY ***************************************************************************

TASK [setup] *******************************************************************
ok: [localhost]

TASK [server_roscore : roscore(server)] ****************************************
changed: [localhost]

PLAY ***************************************************************************

TASK [setup] *******************************************************************
ok: [client0]

TASK [client0_minimal : roslauch turbot3_multi robot_name:=tb3_0 (client)] *****
changed: [client0]

PLAY ***************************************************************************

TASK [setup] *******************************************************************
ok: [client1]

TASK [client1_minimal : roslauch turbot3_multi robot_name:=tb3_1 (client)] *****
changed: [client1]

PLAY ***************************************************************************

TASK [setup] *******************************************************************
ok: [client2]

TASK [client2_minimal : roslauch turbot3_multi robot_name:=tb3_2 (client)] *****
changed: [client2]

PLAY ***************************************************************************

TASK [setup] *******************************************************************
ok: [localhost]

TASK [server0_remote : roslaunch turbot3_multi model.launch robot_name:=tb3_0 (server)] ***
changed: [localhost]

TASK [server1_remote : roslaunch turbot3_multi model.launch robot_name:=tb3_1 (server)] ***
changed: [localhost]

TASK [server2_remote : roslaunch turbot3_multi model.launch robot_name:=tb3_2 (server)] ***
changed: [localhost]

PLAY RECAP *********************************************************************
client0                    : ok=2    changed=1    unreachable=0    failed=0   
client1                    : ok=2    changed=1    unreachable=0    failed=0   
client2                    : ok=2    changed=1    unreachable=0    failed=0   
localhost                  : ok=6    changed=4    unreachable=0    failed=0
  • 查看tf
rosrun rqt_tf_tree rqt_tf_tree
  • 启动之后的TF图如下:
    请输入图片描述

  • 分别打开三个终端,测试键盘控制

./multi_scripts/multi_key.sh 0
./multi_scripts/multi_key.sh 1
./multi_scripts/multi_key.sh 2
  • 关闭程序
./multi_scripts/multi_kill.sh
  • 关闭服务器的ros和client的ros

演示视频

纠错,疑问,交流: 请进入讨论区点击加入Q群

获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号


标签: turbot3多机建图教程, turbot3多机交互教程