天天看點

20191014繼續TurtleBot3機器人的Rviz仿真

接着20191013-對TurtleBot機器人仿真的進化的想法繼續

  1. 安裝

    TurtleBot3

    機器人
cd ~/catkin_ws/src
git clone https://github.com/ROBOTIS-GIT/turtlebot3_msgs.git
git clone https://github.com/ROBOTIS-GIT/turtlebot3.git
git clone https://github.com/ROBOTIS-GIT/turtlebot3_simulations.git
cd ~/catkin_ws
# 采用rosdep install依賴安裝的方式,安裝了TB3代碼中依賴的各種ROS軟體包
rosdep install --from-paths src -i -y
# rosdep install --from-paths src --ignore-src -r -y
catkin_make
           

設定環境

echo "source ~/catkin_ws/devel/setup.bash " >> ~/.bashrc
source ~/.bashrc
           

根據所選用的

TurtleBot3

機器人是

Burger

還是

Waffle

,将其作為環境變量加入

~/.bashrc

檔案,以友善後續使用。否則每次運作程式都需要先輸入

export TURTLEBOT3_MODEL=burger

或者

export TURTLEBOT3_MODEL=waffle

echo "export TURTLEBOT3_MODEL=waffle" >> ~/.bashrc
source ~/.bashrc
           

檢查一下環境變量設定是否成功:

env | grep TURTLEBOT3
           

如顯示

TURTLEBOT3_MODEL=waffle

則表示成功。

  1. 簡單仿真測試
roslaunch turtlebot3_fake turtlebot3_fake.launch
           

這是

turtlebot3_simulation

裡給出的一個簡單仿真器,其并沒有實體引擎,隻是根據速度指令和角速度指令進行積分,給出

odom

base_link

坐标系之間的

tf

,無法給出傳感器測量資料仿真。運作顯示結果如下:

20191014繼續TurtleBot3機器人的Rviz仿真

rviz

裡通過

teleop

節點進行控制TurtleBot3機器人運動

roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch
           

螢幕得到以下資訊:

process[turtlebot3_teleop_keyboard-1]: started with pid [2705]

Control Your TurtleBot3!
---------------------------
Moving around:
        w
   a    s    d
        x

w/x : increase/decrease linear velocity (Burger : ~ 0.22, Waffle and Waffle Pi : ~ 0.26)
a/d : increase/decrease angular velocity (Burger : ~ 2.84, Waffle and Waffle Pi : ~ 1.82)

space key, s : force stop

CTRL-C to quit
           

接下來就可以通過鍵盤控制機器人運動了(此圖我用的是

burger

)。

20191014繼續TurtleBot3機器人的Rviz仿真