-
-
Save smilu97/df9e285b844c64b2dc9c23e787f0a4e3 to your computer and use it in GitHub Desktop.
#!/bin/sh | |
# Install ros-noetic-desktop-full from apt repository | |
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' | |
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 | |
sudo apt update | |
sudo apt install -y ros-noetic-desktop-full | |
sudo apt install -y vim | |
sudo apt install -y libncurses5-dev v4l-utils | |
sudo apt install -y madplay mpg321 | |
sudo apt install -y g++ git | |
source /opt/ros/noetic/setup.bash | |
# Install ROBOTIS-OP3 | |
mkdir ~/catkin_ws | |
cd ~/catkin_ws | |
mkdir src | |
cd src | |
# git clone https://github.com/ROBOTIS-GIT/face_detection.git | |
# git clone https://github.com/bosch-ros-pkg/usb_cam.git | |
# git clone https://github.com/ROBOTIS-GIT/humanoid_navigation.git | |
sudo apt-get install -y ros-noetic-map-server | |
sudo apt-get install -y ros-noetic-humanoid-nav-msgs | |
sudo apt-get install -y ros-noetic-nav-msgs | |
sudo apt-get install -y ros-noetic-octomap | |
sudo apt-get install -y ros-noetic-octomap-msgs | |
sudo apt-get install -y ros-noetic-octomap-ros | |
sudo apt-get install -y ros-noetic-octomap-server | |
sudo apt-get install -y ros-noetic-rosbridge-server | |
sudo apt-get install -y ros-noetic-effort-controllers | |
# Install sbpl (for ROBOTIS-OP3) | |
mkdir ~/libs | |
cd ~/libs | |
git clone https://github.com/sbpl/sbpl | |
cd sbpl | |
mkdir build | |
cd build | |
cmake .. | |
make | |
sudo make install | |
cd ~/catkin_ws/src | |
git clone https://github.com/ROBOTIS-GIT/DynamixelSDK.git | |
git clone https://github.com/ROBOTIS-GIT/ROBOTIS-Framework.git | |
git clone https://github.com/ROBOTIS-GIT/ROBOTIS-Framework-msgs.git | |
git clone https://github.com/ROBOTIS-GIT/ROBOTIS-Math.git | |
git clone https://github.com/ROBOTIS-GIT/ROBOTIS-OP3.git | |
# git clone https://github.com/ROBOTIS-GIT/ROBOTIS-OP3-Demo.git | |
git clone https://github.com/ROBOTIS-GIT/ROBOTIS-OP3-msgs.git | |
# git clone https://github.com/ROBOTIS-GIT/ROBOTIS-OP3-Tools.git | |
git clone https://github.com/ROBOTIS-GIT/ROBOTIS-OP3-Common.git | |
git clone https://github.com/ROBOTIS-GIT/ROBOTIS-Utility.git | |
git clone https://github.com/ahornung/humanoid_msgs | |
# # Install dependencies for building OpenCV-3.4.0 | |
# sudo apt install -y build-essential cmake git pkg-config libgtk-3-dev \ | |
# libavcodec-dev libavformat-dev libswscale-dev libv4l-dev \ | |
# libxvidcore-dev libx264-dev libjpeg-dev libpng-dev libtiff-dev \ | |
# gfortran openexr libatlas-base-dev python3-dev python3-numpy \ | |
# libtbb2 libtbb-dev libdc1394-22-dev libopenexr-dev \ | |
# libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev | |
# sudo apt-get install -y v4l-utils libxine2-dev | |
# sudo apt-get install -y mesa-utils libgl1-mesa-dri libgtkgl2.0-dev libgtkglext1-dev | |
# sudo apt-get install -y libeigen3-dev python2.7-dev python-numpy | |
# # Prepare build environments for OpenCV-3.4.0 and build | |
# cd ~/libs | |
# mkdir opencv3; cd opencv3 | |
# wget -O opencv.zip https://github.com/opencv/opencv/archive/3.4.0.zip | |
# wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/3.4.0.zip | |
# unzip opencv.zip | |
# unzip opencv_contrib.zip | |
# cd opencv-3.4.0 | |
# # Resolve | |
# sed -i "s/char* str = PyString_AsString(obj);/const char* str = PyString_AsString(obj);/g" modules/python/src2/cv2.cpp | |
# mkdir build | |
# cd build | |
# cmake -D CMAKE_BUILD_TYPE=RELEASE \ | |
# -D CMAKE_INSTALL_PREFIX=/usr/local \ | |
# -D INSTALL_C_EXAMPLES=ON \ | |
# -D INSTALL_PYTHON_EXAMPLES=ON \ | |
# -D OPENCV_GENERATE_PKGCONFIG=ON \ | |
# -D OPENCV_EXTRA_MODULES_PATH=~/libs/opencv3/opencv_contrib-3.4.0/modules \ | |
# -D BUILD_EXAMPLES=ON .. | |
# make -j8 | |
# sudo make install | |
# sudo sh -c echo '/usr/local/lib/' > sudo /etc/ld.so.conf.d/opencv.conf | |
# sudo ldconfig | |
# Fix wrong .launch scripts (xacro.py deprecated) | |
cd ~/catkin_ws/src/ROBOTIS-OP3-Common/op3_description | |
sed -i "s/xacro.py/xacro/g" launch/op3_display.launch | |
sed -i "s/xacro.py/xacro/g" launch/op3_rviz.launch | |
sed -i "s/xacro.py/xacro/g" launch/op3_walking.launch | |
cd ../op3_gazebo | |
sed -i "s/xacro.py/xacro/g" launch/robotis_world.launch | |
# Build sources with `catkin_make` | |
cd ~/catkin_ws | |
catkin_make | |
source ~/catkin_ws/devel/setup.bash | |
# Register .bash scripts into ~/.bashrc | |
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc | |
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc | |
# Install dependencies from apt repository (for gym-gazebo) | |
sudo apt-get install -y \ | |
python3-pip python3-vcstool python3-pyqt5 \ | |
pyqt5-dev-tools \ | |
libbluetooth-dev libspnav-dev \ | |
libcwiid-dev \ | |
cmake gcc g++ qt5-qmake qtbase5-dev \ | |
libusb-dev libftdi-dev \ | |
libsdl-dev \ | |
libsdl-image1.2-dev \ | |
python3-defusedxml python3-vcstool \ | |
ros-noetic-octomap-msgs \ | |
ros-noetic-joy \ | |
ros-noetic-geodesy \ | |
ros-noetic-octomap-ros \ | |
ros-noetic-control-toolbox \ | |
ros-noetic-pluginlib \ | |
ros-noetic-trajectory-msgs \ | |
ros-noetic-control-msgs \ | |
ros-noetic-std-srvs \ | |
ros-noetic-nodelet \ | |
ros-noetic-urdf \ | |
ros-noetic-rviz \ | |
ros-noetic-kdl-conversions \ | |
ros-noetic-eigen-conversions \ | |
ros-noetic-tf2-sensor-msgs \ | |
ros-noetic-pcl-ros \ | |
ros-noetic-navigation \ | |
ros-noetic-sophus | |
# Install CUDA | |
mkdir ~/libs/cuda; cd ~/libs/cuda | |
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin | |
sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600 | |
wget https://developer.download.nvidia.com/compute/cuda/11.2.0/local_installers/cuda-repo-ubuntu2004-11-2-local_11.2.0-460.27.04-1_amd64.deb | |
sudo dpkg -i cuda-repo-ubuntu2004-11-2-local_11.2.0-460.27.04-1_amd64.deb | |
sudo apt-key add /var/cuda-repo-ubuntu2004-11-2-local/7fa2af80.pub | |
sudo apt-get update | |
sudo apt-get -y install cuda | |
# Install cudNN | |
# wget -O cudnn.tgz https://developer.nvidia.com/compute/machine-learning/cudnn/secure/8.1.0.77/11.2_20210127/cudnn-11.2-linux-x64-v8.1.0.77.tgz | |
# Above line doesn't work (Forbidden) | |
# Manually download cudnn library from https://developer.nvidia.com/rdp/cudnn-download , and locate .tgz file here | |
tar -xvf cudnn.tgz | |
bash -c 'echo "export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:`pwd`/cuda/lib64 >> ~/.bashrc' | |
source ~/.bashrc | |
# Install boost library (for gym-gazebo) | |
mkdir ~/libs/boost; cd ~/libs/boost | |
wget -O boost.tar.gz https://dl.bintray.com/boostorg/release/1.75.0/source/boost_1_75_0.tar.gz | |
tar -xvf boost.tar.gz | |
cd boost_1_75_0 | |
./bootstrap.sh --with-python=/usr/bin/python3 | |
sudo ./b2 install | |
# Install vtk | |
sudo apt install -y cmake-curses-gui | |
cd ~/libs | |
git clone https://github.com/Kitware/VTK.git | |
mkdir VTK/build | |
cd VTK/build | |
cmake .. | |
make -j16 | |
sudo make install | |
# Install pip dependencies (for gym-gazebo) | |
pip3 install gym | |
sudo apt-get install -y python3-skimage | |
pip3 install h5py | |
pip3 install tensorflow-gpu | |
pip3 install keras | |
# Fetch gym-gazebo from github.com and install | |
cd ~ | |
git clone https://github.com/erlerobot/gym-gazebo | |
cd gym-gazebo | |
pip3 install -e . | |
cd gym_gazebo/envs/installation | |
src="catkin_ws/src" | |
mkdir -p $src | |
cd $src | |
catkin_init_workspace | |
# Import and build dependencies | |
cd ../../catkin_ws/src/ | |
vcs import < ../../gazebo_ros_melodic.repos | |
cd .. | |
touch catkin_ws/src/ecl_navigation/ecl_mobile_robot/CATKIN_IGNORE | |
sed -i "s/python3/python/g" src/image_common/camera_calibration_parsers/CMakeLists.txt | |
catkin_make | |
bash -c 'echo source `pwd`/devel/setup.bash >> ~/.bashrc' | |
echo "## ROS workspace compiled ##" | |
# add own models path to gazebo models path | |
if [ -z "$GAZEBO_MODEL_PATH" ]; then | |
bash -c 'echo "export GAZEBO_MODEL_PATH="`pwd`/../../assets/models >> ~/.bashrc' | |
exec bash #reload bashrc | |
fi |
Hello! I remember that some of packages from OP3 are using OpenCV3, but Ubuntu20.04 had OpenCV4, so there was some package that could not be built on (Ubuntu20.04 + noetic).
So I got rid of some packages that were using OpenCV in this gist.
In my case, I just had to spawn OP3 model in gazebo, and control joints of it, so there was no problem.
means do I have to install ubuntu 18.04 with ROS melodic?
I strongly recommend to use ubuntu 16.04 + kinetic.
In my case, I wanted to use python3 for some reinforcement learning libraries with ros-python.
yes thanks sir, but I also sometimes encounter problems and difficulties when using OpenCV with ROS kinetic because it always clashes with Python2.
yes thanks sir, but I also sometimes encounter problems and difficulties when using OpenCV with ROS kinetic because it always clashes with Python2.
Are you also using gym-gazebo?
Sorry, so do I have to use ros-noetic or ros-kinetic? because your code install ros-noetic(?)
can i use neotic version of ROS to my OP3 Framework instead using ROS kinetic?