728x90
반응형

1. Download Linux Ubuntu 20.04 LTS(Focal Fossa)

https://releases.ubuntu.com/focal/

 

 

2. Set locale

: Make sure you have a locale which supports UTF-8.

$ locale  # check for UTF-8

$ sudo apt update && sudo apt install locales
$ sudo locale-gen en_US en_US.UTF-8
$ sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
$ export LANG=en_US.UTF-8

$ locale  # verify settings

 

3. Setup Sources

$ sudo apt update && sudo apt install curl
$ sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
$ echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null

 

4. Install ROS 2 Packsges(Foxy)

$ sudo apt update
$ sudo apt install ros-foxy-desktop ros-foxy-rmw-fastrtps* ros-foxy-rmw-cyclonedds*

 

5. Environment Setup(Check to installation)

 

# Replace ".bash" with your shell if you're not using bash
# Possible values are: setup.bash, setup.sh, setup.zsh
$ source /opt/ros/foxy/setup.bash

* try some examples..

$ source /opt/ros/foxy/setup.bash
$ ros2 run demo_nodes_cpp talker
$ source /opt/ros/foxy/setup.bash
$ ros2 run demo_nodes_py listener

 

6. Install development tools and ROS tools

sudo apt update && sudo apt install -y \
  build-essential \
  cmake \
  git \
  libbullet-dev \
  python3-colcon-common-extensions \
  python3-flake8 \
  python3-pip \
  python3-pytest-cov \
  python3-rosdep \
  python3-setuptools \
  python3-vcstool \
  wget
# install some pip packages needed for testing
python3 -m pip install -U \
  argcomplete \
  flake8-blind-except \
  flake8-builtins \
  flake8-class-newline \
  flake8-comprehensions \
  flake8-deprecated \
  flake8-docstrings \
  flake8-import-order \
  flake8-quotes \
  pytest-repeat \
  pytest-rerunfailures \
  pytest
# install Fast-RTPS dependencies
sudo apt install --no-install-recommends -y \
  libasio-dev \
  libtinyxml2-dev

7. ROS2 Build Test

$ source /opt/ros/foxy/setup.bash
$ mkdir -p ~/robot_ws/src
$ cd ~/robot_ws/
$ colcon build --symlink-install

 

8. Set a Run Command

$ sudo apt install vim
$ vim ~/.bashrc
source /opt/ros/foxy/setup.bash
source ~/ros2_ws/install/local_setup.bash

source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash
source /usr/share/vcstool-completion/vcs.bash
source /usr/share/colcon_cd/function/colcon_cd.sh
export _colcon_cd_root=~/ros2_ws

export ROS_DOMAIN_ID=7
export ROS_NAMESPACE=robot1

export RMW_IMPLEMENTATION=rmw_fastrtps_cpp
# export RMW_IMPLEMENTATION=rmw_connext_cpp
# export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
# export RMW_IMPLEMENTATION=rmw_gurumdds_cpp

# export RCUTILS_CONSOLE_OUTPUT_FORMAT='[{severity} {time}] [{name}]: {message} ({function_name}() at {file_name}:{line_number})'
export RCUTILS_CONSOLE_OUTPUT_FORMAT='[{severity}]: {message}'
export RCUTILS_COLORIZED_OUTPUT=1
export RCUTILS_LOGGING_USE_STDOUT=0
export RCUTILS_LOGGING_BUFFERED_STREAM=1

alias cw='cd ~/ros2_ws'
alias cs='cd ~/ros2_ws/src'
alias ccd='colcon_cd'

alias cb='cd ~/ros2_ws && colcon build --symlink-install'
alias cbs='colcon build --symlink-install'
alias cbp='colcon build --symlink-install --packages-select'
alias cbu='colcon build --symlink-install --packages-up-to'
alias ct='colcon test'
alias ctp='colcon test --packages-select'
alias ctr='colcon test-result'

alias rt='ros2 topic list'
alias re='ros2 topic echo'
alias rn='ros2 node list'

alias killgazebo='killall -9 gazebo & killall -9 gzserver  & killall -9 gzclient'

alias af='ament_flake8'
alias ac='ament_cpplint'

alias testpub='ros2 run demo_nodes_cpp talker'
alias testsub='ros2 run demo_nodes_cpp listener'
alias testpubimg='ros2 run image_tools cam2image'
alias testsubimg='ros2 run image_tools showimage'

 


 

9. Install IDE (Visual Studio Code)

 

Download here: https://code.visualstudio.com/download

$ sudo dpkg -i code_1.74.1-1671015296_amd64.deb

 

10. Execution IDE

$ code

 

11. Install Extensions

 

Extensions(Ctrl + Shift + x)

 

C/C++/Python Extensions

: C / C++ , CMake, CMake Tools, Python

 

ROS Extensions

: ROS, URDF, Colcon Tasks

 

File Format Extensions

: XML Tools, YAML, Markdown All in One

728x90
반응형

'Manual' 카테고리의 다른 글

[Linux] Vim 설치 및 설정  (0) 2023.01.01
[VSC]How to Use Compiler in VisualStudioCode  (0) 2022.12.19
[OpenCV]Initial Settings  (0) 2022.11.03
[venv] Python 가상환경 설치 방법  (0) 2022.10.26
[ROS]How to install ROS Melodic ver 1.0  (0) 2022.10.12

+ Recent posts