ubuntu18.04 ros-melodic视觉、机械臂抓取

原代码在ubuntu16.04可以运行。引用https://github.com/Suyixiu/robot_sim给出的方案。
在ubuntu18.04上有很多版本不兼容的问题存在。

cd ~/catkin_ws/src
git clone -b kinetic-devel https://github.com/pal-robotics/aruco_ros                #aruco_ros
git clone https://github.com/atenpas/gpd_ros/                                       #gpd_ros
git clone https://github.com/IFL-CAMP/easy_handeye                                  #easy_handeye
git clone -b kinetic-devel https://github.com/ros-industrial/universal_robot.git    #universal_robot
git clone https://github.com/Suyixiu/robot_sim                                      #本功能包
sudo apt-get install libeigen3-dev                                                  #安装eigin3
rosdep install --from-paths src --ignore-src --rosdistro=melodic                    #安装依赖

安装moveit

Ubuntu18.04+Ros Melodic安装Moveit框架+Moveit搭建机械臂模型(一)(持续更新)_Robot_Tiger_的博客-CSDN博客_melodic 安装moveit

sudo apt-get install python-catkin-tools  #最后使用catkin build编译
rosdep update
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install python-wstool python-catkin-tools clang-format-3.9 
cd ~/catkin_ws/src
wstool init src
wstool merge -t src https://raw.githubusercontent.com/ros-planning/moveit/master/moveit.rosinstall
wstool update -t src
rosdep install -y --from-paths src --ignore-src --rosdistro ${ROS_DISTRO}
catkin config --extend /opt/ros/${ROS_DISTRO} --cmake-args -DCMAKE_BUILD_TYPE=Release 

个人安装的是PCL-1.9.1,opencv3.4.4,protobuf-3.0.2,VTK8.2.0,metslib-0.53

安装opencv

参考【CV实战】Ubuntu18.04源码编译安装opencv-3.4.X+测试demo - 知乎

Ubuntu18.04安装OpenCV3.4.4_甜度超标°的博客-CSDN博客_opencv3.4.4

sudo apt-get install build-essential libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg.dev libtiff4.dev libswscale-dev libjasper-dev                #jasper可能出问题,csdn搜索一下有解决方案
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
make
sudo make install

 

sudo gedit /etc/ld.so.conf.d/opencv.conf                     #打开这个文件
/usr/local/lib                                                  #文件末尾添加
sudo ldconfig  
sudo gedit /etc/bash.bashrc                      #打开这个文件

在末尾添加
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig     
export PKG_CONFIG_PATH      

添加后             

source /etc/bash.bashrc  

sudo updatedb  

安装VTK8.20

参考:

ubuntu18.04安装vtk8.2.0_榴莲小怪兽的博客-CSDN博客_ubuntu18.04 vtk

sudo apt-get install cmake-curses-gui
sudo apt-get install freeglut3-dev
cd VTK8.20
mkdir build
cd build
make
sudo make install

安装PCL

参考:

关于gpd_ros的安装问题_皮宝皮的博客-CSDN博客

从ROS kinetic 升级 PCL1.9.0 以安装gpd库和gpd_ros_合工大机器人实验室的博客-CSDN博客_ros升级pcl

 sudo apt-get update
 sudo apt-get install git build-essential linux-libc-dev
 sudo apt-get install cmake cmake-gui 
 sudo apt-get install libusb-1.0-0-dev libusb-dev libudev-dev
 sudo apt-get install mpi-default-dev openmpi-bin openmpi-common  
 sudo apt-get install libflann1.8 libflann-dev
 sudo apt-get install libeigen3-dev
 sudo apt-get install libboost-all-dev
 sudo apt-get install libvtk5.10-qt4 libvtk5.10 libvtk5-dev
 sudo apt-get install libqhull* libgtest-dev
 sudo apt-get install freeglut3-dev pkg-config
 sudo apt-get install libxmu-dev libxi-dev 
 sudo apt-get install mono-complete
 sudo apt-get install qt-sdk openjdk-8-jdk openjdk-8-jre
 cd pcl_1.9.1
 mkdir build
 cd build
 cmake -DCMAKE_BUILD_TYPE=None -DCMAKE_INSTALL_PREFIX=/usr \ -DBUILD_GPU=ON-DBUILD_apps=ON -DBUILD_examples=ON \ -DCMAKE_INSTALL_PREFIX=/usr ..
 make -j
 sudo make install
sudo apt-get install ros-melodic-pcl-conversions
sudo apt-get install libvtk6-jni
sudo apt-get install libvtk6-java
sudo apt-get install libvtk6-jni
sudo apt-get install libvtk6-dev
sudo apt-get install libvtk6-qt-dev
sudo apt-get install libpcl-dev
sudo apt-get install ros-melodic-pcl-conversions

安装上述代码块依赖,以免后期报错

cd /usr/share/pcl-1.12/
sudo chmod 666 PCLConfig.cmake

安装GDP

cd gpd
mkdir build && cd build
cmake ..
make -j
sudo make install

安装protobuf

参考:

Ubuntu18.04安装protobuf教程_愿梦长的博客-CSDN博客_protobuf ubuntu18.04

解压好文件后

sudo apt-get install autoconf automake libtool curl make g++ unzip libffidev -y
cd protobuf/
./autogen.sh
./configure
make
sudo make install
sudo ldconfig
go get -v -u github.com/golang/protobuf/proto                         #如果连接超时,可以直接去github下载zip包然后解压,网址github.com/golang/protobuf
go get -v -u github.com/golang/protobuf/protoc-gen-go                 # 安装protoc-gen-go插件
cd $GOPATH/src/github.com/golang/protobuf/protoc-gen-go/
go build
sudo cp protoc-gen-go /bin/

将各种需要的依赖装好后进行catkin build,但是会出现bug。原工程中使用的gazebo版本是gazebo7,而ubuntu18.04使用的是gazebo9。所以需要替换一些文件

打开/catkin_ws/src/robot_sim/package/dh_robotics_gripper/dh_robotics_ag95_gripper/dh_robotics_ag95_simulation/roboticsgroup_gazebo_plugins

将里面的文件替换为roboticsgroup_gazebo_plugins/mimic_joint_plugin.cpp at master · LCAS/roboticsgroup_gazebo_plugins · GitHub

然后catkin build进行编译

然后打开/catkin_ws/src/robot_sim/experiment/camera_calibration/scripts

打开camera_calibration.py

替换kinetic为melodic

目前就改到这了,后续继续更新

你可能感兴趣的:(自动驾驶,人工智能,机器学习)