ROS Melodic Python3 source installation guide (rpm)

This article switched    https://blog.csdn.net/id9502/article/details/80410989 

Ros simply read the source code sequence table

 

1. First, the basic installation dependencies:

Installation ros dependence:

sudo apt install python3-rosdep2 python3-rosinstall-generator python3-rosinstall build-essential python3-defusedxml python3-netifaces

Install build dependencies:

sudo apt install libeigen3-dev libboost-thread-dev libgtest-dev libconsole-bridge-dev libpoco-dev python3-sip-dev libboost-filesystem-dev libboost-program-options-dev libtinyxml2-dev libtinyxml-dev pyqt5-dev libcurl4-openssl-dev libboost-regex-dev liblz4-dev libbz2-dev libboost-singals-dev liburdfdom-headers-dev liburdfdom-dev uuid-dev libassimp-dev libogre-1.9-dev libyaml-cpp-dev

2. Configure rosdep

mkdir setups
cd setups
touch rosdep
chmod +x ./rosdep

 

Add the contents of the script:

#!/usr/bin/env python3

from rosdep2.main import rosdep_main
rosdep_main()

 

carried out

sudo ./rosdep init
./rosdep update

 

3. Get the source basic ros environment

First, download the executable file

wget https://raw.githubusercontent.com/ros-infrastructure/rosinstall_generator/master/bin/rosinstall_generator
wget https://raw.githubusercontent.com/vcstools/wstool/master/scripts/wstool
wget https://raw.githubusercontent.com/ros-infrastructure/rospkg/master/scripts/rosversion
wget https://raw.githubusercontent.com/ros-infrastructure/catkin_pkg/master/bin/catkin_find_pkg
wget https://raw.githubusercontent.com/ros-infrastructure/catkin_pkg/master/bin/catkin_create_pkg
wget https://raw.githubusercontent.com/ros-infrastructure/catkin_pkg/master/bin/catkin_generate_changelog
wget https://raw.githubusercontent.com/ros-infrastructure/catkin_pkg/master/bin/catkin_tag_changelog
wget https://raw.githubusercontent.com/ros-infrastructure/catkin_pkg/master/bin/catkin_test_changelog
chmod +x ./rosinstall_generator
chmod +x ./wstool
chmod +x ./rosversion
chmod +x ./catkin_find_pkg
chmod +x ./catkin_create_pkg
chmod +x ./catkin_generate_changelog
chmod +x ./catkin_tag_changelog
chmod +x ./catkin_test_changelog

 

I remember the first line to modify python quoted as python3, and the following from  _future_  delete import row

New total project directory and execute ros source code download

mkdir ../workspace
cd ../workspace
../setups/rosinstall_generator desktop_full --rosdistro melodic --deps --tar > melodic-desktop-full.rosinstall
../setups/wstool init -j8 src melodic-desktop-full.rosinstall

 

If the installation fails, you can try to continue the installation:

../setups/wstool update -j 8 -t src

 

Then resolve dependencies

../setups/rosdep install --from-paths src --ignore-src --rosdistro melodic -y

 

4. Installation Catkin

From Github Catkin download the source code, cmake and select python version 3, installation address their chosen environment folder env

export ROS_PYTHON_VERSION=3
mkdir build
cd build
cmake ..
make DESTDIR=xxxxxxx
make install

Then back to the workspace directory 
modifications in ./src/orocos_kinematics_dynamics/python_orocos_kdl/CMakeLists.txt

SET(PYTHON_VERSION 2 CACHE STRING "Python Version")  

Changed

SET(PYTHON_VERSION 3 CACHE STRING "Python Version") 

 

Modify src / dynamic_reconfigure / cfg / Test.cfg and src / nodelet_core / nodelet_topic_tools / cfg / NodeletThrottle.cfg first acts

#! /usr/bin/env python3

 

After addition depend regex to src / ros_comm / rosconsole / CMakeLists.txt 72 rows (to maintain unchanged the other added boost_regex)

target_link_libraries(rosconsole ${rosconsole_backend_LIBRARIES} ${catkin_LIBRARIES} ${Boost_LIBRARIES} boost_regex)

 

Modify src / vision_opencv / cv_bridge / CMakeLists.txt 11 acts

find_package(Boost REQUIRED python-py36)

 

../env/setup.sh last line add

export ROS_PYTHON_VERSION=3

 

5. Start compilation

source ../env/setup.zsh
catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release
mv ../setups/* ../env/bin/

 

If you want to change the installation site, you can add -install-space xxxxxxx after the last catkin

 

6. Start using ROS

After any new Term be loaded before executing the command ROS Configuration Environment (may also be added ~ / .bashrc or ~ / .zshrc performed automatically inside)

source ../env/setup.zsh

Start scheduling core ros

roscore

Open a new window to test the start rviz

rosrun rviz rviz

 

If successful start, everything will be fine!

Note: rqt series of ros program does not seem to automatically modify the behavior of the first python3, you need to manually modify.

 

1 'lazy welfare

Simple compiler packaged deb files (installation not responsible for the results, because too much reliance countless, so if you have not run the add add log in accordance with it, another welcome free to fix the deb), if you're like me use debian testing system, please feel free to copy my compiled binary packages: https: //pan.baidu.com/s/1WmZAA7J-2uvSz8S9-XmdWQ

Guess you like

Origin www.cnblogs.com/shepherd2015/p/11257356.html