자이카 풀 업그레이드

OpenJR·2022년 7월 29일
0

1. Python 2

1.1. ROS Melodic Install

http://wiki.ros.org/melodic/Installation/Ubuntu

1.2. Make WorkSpace

: cd
: mkdir -p xycar_ws/src && cd xycar_ws
: catkin_make

1.3. Edit .bashrc

alias cm='cd ~/xycar_ws && catkin_make'
alias cs='cd ~/xycar_ws/src'
alias cb='code ~/.bashrc'
alias sb='source ~/.bashrc'

export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0
export motor_version=0

source /root/xycar_ws/devel/setup.bash

if TX2 board:
export OPENBLAS_CORETYPE=ARMV8 python3

1.4. Move the legacy files

1.5. Install packages

realsense
: cd
: wget https://github.com/IntelRealSense/librealsense/archive/refs/tags/v2.15.0.tar.gz
: tar -xvf v2.15.0.tar.gz
: cd librealsense-2.15.0/
: mkdir build && cd build
: cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLES=false ../
: make -j10
: sudo make install
: cd && rm -rf librealsense-2.15.0/ v2.15.0.tar.gz

ackerman msgs && serial
: sudo apt install ros-melodic-ackermann-msgs ros-melodic-serial

1.6. Edit CMakeLists.txt

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

1.7. Python 2 Test

2. Python 3

2.1. Install python3 pkg

: sudo apt install python3-pip python3-yaml
: python3 -m pip install -U pip
: python3 -m pip install rospkg catkin_pkg
: sudo apt install python-catkin-tools python3-dev python3-numpy
: python3 -m pip install opencv-python

2.2. Build cv_bridge

: cd
: mkdir -p cvbridge_ws/src && cd cvbridge_ws
: catkin init
DESKTOP
	: catkin config -DPYTHON_EXECUTABLE=/usr/bin/python3 -DPYTHON_INCLUDE_DIR=/usr/include/python3.6m -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.6m.so
TX2 Board
	: catkin config -DPYTHON_EXECUTABLE=/usr/bin/python3 -DPYTHON_INCLUDE_DIR=/usr/include/python3.6m -DPYTHON_LIBRARY=/usr/lib/aarch64-linux-gnu/libpython3.6m.so
: catkin config --install
: cd src
: git clone -b melodic https://github.com/ros-perception/vision_opencv.git

Check Version
: apt-cache show ros-melodic-cv-bridge | grep Version
: cd vision_opencv/
: git checkout (version)1.13.0
: cd ../../
: catkin build cv_bridge

Edit .bashrc
: source /root/cvbridge_ws/install/setup.bash --extend

3. Build OpenCV 4.5.5

: wget https://github.com/opencv/opencv/archive/refs/tags/4.5.5.tar.gz
: tar -xvf 4.5.5.tar.gz && rm 4.5.5.tar.gz
: wget https://github.com/opencv/opencv_contrib/archive/refs/tags/4.5.5.tar.gz
: tar -xvf 4.5.5.tar.gz && rm 4.5.5.tar.gz
: cd build
: cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../install/ -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib-4.5.5/modules/ -DOPENCV_FORCE_3RDPARTY_BUILD="ON"  ../opencv-4.5.5/
: make -j13

예상되는 xycar moter 에러 원인
export PYTHONPATH=/usr/lib/python3/dist-packages

https://medium.com/@beta_b0t/how-to-setup-ros-with-python-3-44a69ca36674

profile
Jacob

0개의 댓글