Turtlebot3-ARM入门教程-抓取挑战之前提准备
说明
本教程介绍进行抓取挑战前需要进行的前提准备
本系列抓取挑战教程是基于官方的home_service_challenge来编写的
实际场景布置
- 下图为官方的测试场景
一般情况下,个人测试时,可以搭建一个简易的场景
类似于下图的2.5米x3米的场景
- [TurtleBot3 SBC or Remote PC] 准备抓取挑战用到的4个ar标签,原尺寸打印出来
// 自动生成8.8cm大小的ar标签
$ rosrun ar_track_alvar createMarker -s 8.8 0
$ rosrun ar_track_alvar createMarker -s 8.8 1
$ rosrun ar_track_alvar createMarker -s 8.8 2
$ rosrun ar_track_alvar createMarker -s 8.8 3
- 或者直接使用以下图片
设置远程脚本
- [Remote PC] 创建远程连接到树莓派的脚本
$ vim ~/tb3_ssh_keygen
//复制粘贴下面内容后,保存退出
#!/bin/bash
argc=$#
args=("$@")
if [ 0 -eq $argc ]
then
echo "need to argument that host ip for ssh connection"
echo "Usage: $0 [ip address] ..."
exit 1
fi
for((index = 0; index < $#; index++ ))
do
ssh-keygen -R ${args[$index]}
ssh-keyscan ${args[$index]} >> ~/.ssh/known_hosts
done
- [Remote PC] 添加权限
$ chmod +x ~/tb3_ssh_keygen
- [Remote PC] 测试使用,文件名后输入树莓派的IP地址
$ ~/tb3_ssh_keygen 192.168.0.99
- [Turtlebot3 SBC] 由于需要用到
machine tag
,故在树莓派上创建env.bash
文件
$ vim ~/env.bash
//复制粘贴下面内容后,保存退出
#!/bin/bash
# check if other turtlebot3_core is already running
is_running=`ps ax | grep turtlebot3_core`
IFS=' ' read -ra is_runnings <<< "$is_running"
process_name=${is_runnings[4]}
if [ ${process_name} == "python" ]
then
echo "other turtlebot3_core is already running."
exit 1
fi
#### ROS ####
source /opt/ros/kinetic/setup.bash
source ~/catkin_ws/devel/setup.bash
#### ROS Network ####
ip_address=`hostname -I`
ip_address_trim=${ip_address%% * }
ip_address_no_space="$(echo -e "${ip_address_trim}" | tr -d '[:space:]')"
export ROS_HOSTNAME=${ip_address_no_space}
##### Set TURTLEBOT3 Model ####
export TURTLEBOT3_MODEL=waffle_pi
exec "$@"
- [Remote PC] 添加权限
$ chmod +x ~/env.bash
安装软件包
- [Remote PC] 安装相关软件包
$ cd ~/catkin_ws/src/
$ git clone https://github.com/ROBOTIS-GIT/turtlebot3_home_service_challenge.git
$ sudo apt-get install ros-kinetic-ar-track-alvar ros-kinetic-ar-track-alvar-msgs
$ cd ~/catkin_ws && catkin_make
- [Remote PC] 修改以下lanuch文件,方便进行测试
$ rosed turtlebot3_home_service_challenge_tools turtlebot3_home_service_challenge_demo_remote.launch
$ rosed turtlebot3_home_service_challenge_tools turtlebot3_pi_cam_remote.launch
$ rosed turtlebot3_home_service_challenge_tools turtlebot3_robot_remote.launch
// 修改以下参数的默认值为当前使用的值
// address 为当前树莓派的IP地址; user_name 为树莓派的用户名; password 为登录密码
<arg name="address" default="127.0.0.1"/>
<arg name="user_name" default="pi"/>
<arg name="password" default="turtlebot"/>
获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号