Yêu cầu Jetson nano cài bản Ubuntu 18.04 theo hướng dẫn bài viết sau : https://laptrinhai.net/jetson-nano-huong-dan-cai-dat-co-ban.html
1.Cài đặt ROS:
Mở terminal gõ các lệnh sau:
1 2 3 4 5 6 |
<span class="nv">$ </span><span class="nb">sudo </span>apt update <span class="nv">$ </span><span class="nb">sudo </span>apt upgrade <span class="nv">$ </span>wget https://raw.githubusercontent.com/ROBOTIS-GIT/robotis_tools/master/install_ros_melodic.sh <span class="nv">$ </span><span class="nb">chmod </span>755 ./install_ros_melodic.sh <span class="nv">$ </span>bash ./install_ros_melodic.sh </code> 2.Caì đặt các gói thư viện ROS |
1 2 3 4 5 6 7 8 9 |
<span class="nv">$ </span><span class="nb">sudo </span>apt-get <span class="nb">install </span>ros-melodic-joy ros-melodic-teleop-twist-joy <span class="se">\</span> ros-melodic-teleop-twist-keyboard ros-melodic-laser-proc <span class="se">\</span> ros-melodic-rgbd-launch ros-melodic-depthimage-to-laserscan <span class="se">\</span> ros-melodic-rosserial-arduino ros-melodic-rosserial-python <span class="se">\</span> ros-melodic-rosserial-server ros-melodic-rosserial-client <span class="se">\</span> ros-melodic-rosserial-msgs ros-melodic-amcl ros-melodic-map-server <span class="se">\</span> ros-melodic-move-base ros-melodic-urdf ros-melodic-xacro <span class="se">\</span> ros-melodic-compressed-image-transport ros-melodic-rqt<span class="k">*</span> <span class="se">\</span> ros-melodic-gmapping ros-melodic-navigation ros-melodic-interactive-markers |
1 |
3.Cài các gói thư viện cho Turtlebot3 |
1 2 3 |
<span class="nv">$ </span><span class="nb">sudo </span>apt-get <span class="nb">install </span>ros-melodic-dynamixel-sdk <span class="nv">$ </span><span class="nb">sudo </span>apt-get <span class="nb">install </span>ros-melodic-turtlebot3-msgs <span class="nv">$ </span><span class="nb">sudo </span>apt-get <span class="nb">install </span>ros-melodic-turtlebot3 |
1 |
Không được hãy tiến hành cài đặt như sau: |
1 2 3 4 5 6 7 8 9 10 |
<span class="nv">$ </span><span class="nb">sudo </span>apt-get remove ros-melodic-dynamixel-sdk <span class="nv">$ </span><span class="nb">sudo </span>apt-get remove ros-melodic-turtlebot3-msgs <span class="nv">$ </span><span class="nb">sudo </span>apt-get remove ros-melodic-turtlebot3 <span class="nv">$ </span><span class="nb">mkdir</span> <span class="nt">-p</span> ~/catkin_ws/src <span class="nv">$ </span><span class="nb">cd</span> ~/catkin_ws/src/ <span class="nv">$ </span>git clone <span class="nt">-b</span> melodic-devel https://github.com/ROBOTIS-GIT/DynamixelSDK.git <span class="nv">$ </span>git clone <span class="nt">-b</span> melodic-devel https://github.com/ROBOTIS-GIT/turtlebot3_msgs.git <span class="nv">$ </span>git clone <span class="nt">-b</span> melodic-devel https://github.com/ROBOTIS-GIT/turtlebot3.git <span class="nv">$ </span><span class="nb">cd</span> ~/catkin_ws <span class="o">&&</span> catkin_make <span class="nv">$ </span><span class="nb">echo</span> <span class="s2">"source ~/catkin_ws/devel/setup.bash"</span> <span class="o">>></span> ~/.bashrc</code>4. Các các gói mô phỏng |
1 2 3 |
<span class="nv">$ </span><span class="nb">cd</span> ~/catkin_ws/src/ <span class="nv">$ </span>git clone <span class="nt">-b</span> melodic-devel https://github.com/ROBOTIS-GIT/turtlebot3_simulations.git <span class="nv">$ </span><span class="nb">cd</span> ~/catkin_ws <span class="o">&&</span> catkin_make |
1 2 3 |
5.Hiện môi trường môi phỏng a,Cài mô phỏng Gabezo -Môi trường trống |
1 2 |
<span class="nv">$ </span><span class="nb">export </span><span class="nv">TURTLEBOT3_MODEL</span><span class="o">=</span>burger <span class="nv">$ </span>roslaunch turtlebot3_gazebo turtlebot3_empty_world.launch |
1 2 |
<img class="aligncenter size-full wp-image-828" src="https://laptrinhai.net/wp-content/uploads/2022/02/gabezo.png" alt="" width="1280" height="800" /> -Môi trường TurtleBot3 |
1 2 |
<span class="nv">$ </span><span class="nb">export </span><span class="nv">TURTLEBOT3_MODEL</span><span class="o">=</span>waffle <span class="nv">$ </span>roslaunch turtlebot3_gazebo turtlebot3_world.launch |
1 2 |
<img class="aligncenter size-full wp-image-829" src="https://laptrinhai.net/wp-content/uploads/2022/02/gazebo_1.png" alt="" width="1280" height="800" /> -Môi trường TurtleBot3 House |
1 2 |
<span class="nv">$ </span><span class="nb">export </span><span class="nv">TURTLEBOT3_MODEL</span><span class="o">=</span>waffle_pi <span class="nv">$ </span>roslaunch turtlebot3_gazebo turtlebot3_house.launch |
1 2 |
<img class="aligncenter size-full wp-image-830" src="https://laptrinhai.net/wp-content/uploads/2022/02/Screenshot-from-2022-02-22-23-29-22.png" alt="" width="1280" height="800" /> -Điều khiển turtlebot3 bằng bàn phím |
1 |
<span class="nv">$ </span>roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch |
1 2 3 |
<img class="aligncenter size-full wp-image-831" src="https://laptrinhai.net/wp-content/uploads/2022/02/Screenshot-from-2022-02-22-23-31-59.png" alt="" width="733" height="492" /> b, Mô phỏng SLAM -Hiện môi trường mô phỏng |
1 2 |
<span class="nv">$ </span><span class="nb">export </span><span class="nv">TURTLEBOT3_MODEL</span><span class="o">=</span>burger <span class="nv">$ </span>roslaunch turtlebot3_gazebo turtlebot3_world.launch</code> -Chạy slam node(Mở tab mới) |
1 2 |
<span class="nv">$ </span><span class="nb">export </span><span class="nv">TURTLEBOT3_MODEL</span><span class="o">=</span>burger <span class="nv">$ </span>roslaunch turtlebot3_slam turtlebot3_slam.launch slam_methods:<span class="o">=</span>gmapping |
1 2 |
-Vận hành node(Mở tab mới) <img class="aligncenter size-full wp-image-833" src="https://laptrinhai.net/wp-content/uploads/2022/02/Screenshot-from-2022-02-22-23-52-53.png" alt="" width="1280" height="800" /> |
1 2 |
<span class="nv">$ </span><span class="nb">export </span><span class="nv">TURTLEBOT3_MODEL</span><span class="o">=</span>burger <span class="nv">$ </span>roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch |
1 |
-Lưu map (Mở tab mới) |
1 2 |
<span class="nv">$ </span><span class="nb">export </span><span class="nv">TURTLEBOT3_MODEL</span><span class="o">=</span>burger <span class="nv">$ </span>roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch |
1 2 3 |
<img class="aligncenter size-full wp-image-834" src="https://laptrinhai.net/wp-content/uploads/2022/02/Screenshot-from-2022-02-22-23-55-31.png" alt="" width="221" height="224" /> c, Mô phỏng Navigation -Mở môi trường mô phỏng |
1 2 |
<span class="nv">$ </span><span class="nb">export </span><span class="nv">TURTLEBOT3_MODEL</span><span class="o">=</span>burger <span class="nv">$ </span>roslaunch turtlebot3_gazebo turtlebot3_world.launch |
1 |
-Chạy Navigation node |
1 2 |
$ <span class="nb">export </span><span class="nv">TURTLEBOT3_MODEL</span><span class="o">=</span>burger <span class="nv">$ </span>roslaunch turtlebot3_navigation turtlebot3_navigation.launch map_</code> -Định hướng ban đầu Click vào map,dùng mũi tên màu xanh chỉ vào hướng robot sao cho vùng của lidar sensor nằm trên bản đồ, sau đó dùng lệnh di chuyển robot để hiển thị bản đồ |
1 |
1 |