利用下面文章建立RPLidar的ROS環境
Getting Started with the Low-Cost RPLIDAR Using Jetson Nano
安裝過程遇到下列錯誤訊息,解決方法如下
> sudo apt-get install python-pip
> sudo pip install -U rosdep
> sudo rosdep init
> rosdep update
安裝成功,每次重開機需做下列步驟:
先接上rplidar硬體,然後確認是否有讀寫權限
> ls -al /dev | grep ttyUSB
crw-rw---- 1 root dialout 188, 0 3月 12 19:27 ttyUSB0
修改讀寫權限
> sudo chmod 666 /dev/ttyUSB0
crw-rw-rw- 1 root dialout 188, 0 3月 12 19:27 ttyUSB0
> roscore
-------------------------------------------------------------------------------
開啟另一個terminal視窗
> cd catkin_ws
> source devel/setup.bash
> roslaunch rplidar_ros view_rplidar.launch
進階應用Simutaneous Localization and Mapping
利用下面兩支影片建立SLAM範例
RPLidar and Hector SLAM for Beginners | ROS Tutorial #8
ROS SLAM #2 Hector SLAM (2D地圖建置)
[下載Hector SLAM]
> git clone https://github.com/tu-darmstadt-ros-pkg/hector_slam
$ cd ~/catkin_ws/src
$ git clone https://github.com/tu-darmstadt-ros-pkg/hector_slam
$ cd ~/catkin_ws
$ catkin_make
安裝過程遇到錯誤,原因是預設OpenCV路徑不正確所導致
cv_bridge‘ specifies ‘/usr/include/opencv‘ as an include dir, which is not found
開啟並編輯
> sudo gedit /opt/ros/melodic/share/cv_bridge/cmake/cv_bridgeConfig.cmake
搜尋下面關鍵字
/usr/include/opencv/
並替換成電腦opencv安裝路徑
/usr/include/opencv4/opencv2
繼續
> catkin_make
---------------------------------------------------------------------------------
hector_slam安裝成功,每次重開機需做下列步驟:
先接上rplidar硬體,然後確認是否有讀寫權限
> ls -al /dev | grep ttyUSB
crw-rw---- 1 root dialout 188, 0 3月 12 19:27 ttyUSB0
修改讀寫權限
> sudo chmod 666 /dev/ttyUSB0
terminal window #1
> cd ~/catkin_ws
> source devel/setup.bash
> roslaunch rplidar_ros rplidar.launch
terminal window #2
> cd ~/catkin_ws
> source devel/setup.bash
> roslaunch hector_slam_launch tutorial.launch
Open another terminal
> cd ~/catkin_ws
> rostopic list
/clicked_point
/initialpose
/map
/map_metadata
/map_updates
/move_base_simple/goal
/poseupdate
/rosout
/rosout_agg
/scan
/slam_cloud
/slam_out_pose
/syscommand
/tf
/tf_static
/trajectory
> rostopic echo /tf
transforms:
-
header:
seq: 0
stamp:
secs: 1678740940
nsecs: 988864325
frame_id: "map"
child_frame_id: "scanmatcher_frame"
transform:
translation:
x: -0.00157928466797
y: 0.00636672973633
z: 0.0
rotation:
x: 0.0
y: 0.0
z: -0.0231230224836
w: 0.999732627171
---
Making a Mobile Robot #8 - Adding a Lidar
Ubuntu install of ROS Noetic
ROS Lesson 01 - Install ROS Noetic on Ubuntu 20.04
留言列表