용어 정리
2024. 4. 15.

https://moveit.ros.org/install-moveit2/binary/

미들웨어

미들웨어로 CycloneDDS를 권장합니다. 참고: 이렇게 하면 이 RMW를 사용하여 시작된 모든 노드가 Cyclone DDS를 사용하지 않는 다른 노드와 호환되지 않게 됩니다. sudo apt install ros-$ROS_DISTRO-rmw-cyclonedds-cpp export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp ~/.bashrc에 `export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp`를 추가하여 자동으로 소싱할 수 있습니다.

 

미들웨어>CycloneDDS>RMW

 

https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html

Ubuntu Universe 저장소- 소프트웨어 저장소

Ubuntu는 주로 네 가지 주요 소프트웨어 저장소를 사용합니다: Main, Universe, Restricted, 그리고 Multiverse.

https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html

GPG키- 공개 키 암호화 도구

안전하게 소프트웨어를 다운로드

https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html#id6

매번 실행 안하려면?

nano ~/.bashrc
source /opt/ros/humble/setup.bash

## 스크립트에 추가
source ~/.bashrc

 

$ROS_DISTRO는 특정 버전 ROS를 알아서 넣어준다. 그러므로 작성할 필요가 없다.

CMakecolcon이나 rosdep은 내부 관리, 내부 실행, 외부 실행 도구라고 생각하면 된다.

https://moveit.ros.org/install-moveit2/source/

sudo apt install ros-$ROS_DISTRO-rmw-cyclonedds-cpp
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp

이 명령어를 안 쓰면 느려진다.

 

https://moveit.ros.org/install-moveit2/source/

작업 공간 가서, 내부 프로그램 실행시키고, 최적화한다.

ModuleNotFoundError: No module named 'catkin_pkg'

더보기

(btgenbot) kime@DESKTOP-B35S6CO:~/ws_moveit2/src$ cd $COLCON_WS
colcon build --event-handlers desktop_notification- status- --cmake-args -DCMAKE_BUILD_TYPE=Release
Starting >>> moveit_common
Starting >>> moveit_msgs
Starting >>> moveit_resources_panda_description
Starting >>> moveit_configs_utils
Starting >>> moveit_resources_fanuc_description
Starting >>> moveit_resources_pr2_description
Starting >>> moveit_resources_prbt_support
--- stderr: moveit_common
Traceback (most recent call last):
  File "/opt/ros/humble/share/ament_cmake_core/cmake/core/package_xml_2_cmake.py", line 22, in <module>
    from catkin_pkg.package import parse_package_string
ModuleNotFoundError: No module named 'catkin_pkg'
CMake Error at /opt/ros/humble/share/ament_cmake_core/cmake/core/ament_package_xml.cmake:95 (message):
  execute_process(/home/kime/anaconda3/envs/btgenbot/bin/python3
  /opt/ros/humble/share/ament_cmake_core/cmake/core/package_xml_2_cmake.py
  /home/kime/ws_moveit2/src/moveit2/moveit_common/package.xml
  /home/kime/ws_moveit2/build/moveit_common/ament_cmake_core/package.cmake)
  returned error code 1
Call Stack (most recent call first):
  /opt/ros/humble/share/ament_cmake_core/cmake/core/ament_package_xml.cmake:49 (_ament_package_xml)
  /opt/ros/humble/share/ament_lint_auto/cmake/ament_lint_auto_find_test_dependencies.cmake:31 (ament_package_xml)
  CMakeLists.txt:8 (ament_lint_auto_find_test_dependencies)


---
Failed   <<< moveit_common [0.39s, exited with code 1]
Aborted  <<< moveit_configs_utils [0.56s]
Aborted  <<< moveit_resources_panda_description [0.85s]
Aborted  <<< moveit_resources_fanuc_description [0.91s]
Aborted  <<< moveit_resources_prbt_support [0.92s]
Aborted  <<< moveit_resources_pr2_description [0.94s]
Aborted  <<< moveit_msgs [1.48s]

Summary: 0 packages finished [1.80s]
  1 package failed: moveit_common
  6 packages aborted: moveit_configs_utils moveit_msgs moveit_resources_fanuc_description moveit_resources_panda_description moveit_resources_pr2_description moveit_resources_prbt_support
  6 packages had stderr output: moveit_common moveit_msgs moveit_resources_fanuc_description moveit_resources_panda_description moveit_resources_pr2_description moveit_resources_prbt_support
  38 packages not processed

pip install catkin_pkg
cd $COLCON_WS
colcon build --event-handlers desktop_notification- status- --cmake-args -DCMAKE_BUILD_TYPE=Release
더보기

CMake Error at /opt/ros/humble/share/rosidl_adapter/cmake/rosidl_adapt_interfaces.cmake:59 (message):
  execute_process(/home/kime/anaconda3/envs/btgenbot/bin/python3 -m
  rosidl_adapter --package-name moveit_msgs --arguments-file
  /home/kime/ws_moveit2/build/moveit_msgs/rosidl_adapter__arguments__moveit_msgs.json
  --output-dir
  /home/kime/ws_moveit2/build/moveit_msgs/rosidl_adapter/moveit_msgs
  --output-file
  /home/kime/ws_moveit2/build/moveit_msgs/rosidl_adapter/moveit_msgs.idls)
  returned error code 1:

  Traceback (most recent call last):

    File "/home/kime/anaconda3/envs/btgenbot/lib/python3.10/runpy.py", line 196, in _run_module_as_main
      return _run_code(code, main_globals, None,
    File "/home/kime/anaconda3/envs/btgenbot/lib/python3.10/runpy.py", line 86, in _run_code
      exec(code, run_globals)
    File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/__main__.py", line 19, in <module>
      sys.exit(main())
    File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/main.py", line 53, in main
      abs_idl_file = convert_to_idl(
    File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/__init__.py", line 18, in convert_to_idl
      from rosidl_adapter.msg import convert_msg_to_idl
    File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/msg/__init__.py", line 16, in <module>
      from rosidl_adapter.resource import expand_template
    File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/resource/__init__.py", line 19, in <module>
      import em

  ModuleNotFoundError: No module named 'em'

Call Stack (most recent call first):
  /opt/ros/humble/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:130 (rosidl_adapt_interfaces)
  CMakeLists.txt:115 (rosidl_generate_interfaces)

pip install empy
pip install empy==3.3.4

 

source /opt/ros/humble/setup.bash- 환경 변수, 경로 등이 설정

source $COLCON_WS/install/setup.bash- 이는 작업 공간 내에서 개발된 패키지들을 실행하거나 사용할 때 필요한 구체적인 환경 설정

 

ModuleNotFoundError: No module named 'lark'

더보기

Traceback (most recent call last):
  File "/opt/ros/humble/share/rosidl_generator_c/cmake/../../../lib/rosidl_generator_c/rosidl_generator_c", line 8, in <module>
    from rosidl_generator_c import generate_c
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_generator_c/__init__.py", line 15, in <module>
    from rosidl_cmake import convert_camel_case_to_lower_case_underscore
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_cmake/__init__.py", line 24, in <module>
    from rosidl_parser.parser import parse_idl_file
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_parser/parser.py", line 20, in <module>
    from lark import Lark
ModuleNotFoundError: No module named 'lark'
gmake[2]: *** [CMakeFiles/moveit_msgs__rosidl_generator_c.dir/build.make:277: rosidl_generator_c/moveit_msgs/msg/allowed_collision_entry.h] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:212: CMakeFiles/moveit_msgs__rosidl_generator_c.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
Traceback (most recent call last):
  File "/opt/ros/humble/share/rosidl_generator_cpp/cmake/../../../lib/rosidl_generator_cpp/rosidl_generator_cpp", line 8, in <module>
    from rosidl_generator_cpp import generate_cpp
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_generator_cpp/__init__.py", line 17, in <module>
    from rosidl_cmake import generate_files
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_cmake/__init__.py", line 24, in <module>
    from rosidl_parser.parser import parse_idl_file
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_parser/parser.py", line 20, in <module>
    from lark import Lark
ModuleNotFoundError: No module named 'lark'
gmake[2]: *** [CMakeFiles/moveit_msgs__cpp.dir/build.make:585: rosidl_generator_cpp/moveit_msgs/msg/allowed_collision_entry.hpp] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:317: CMakeFiles/moveit_msgs__cpp.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
---
Failed   <<< moveit_msgs [3.56s, exited with code 2]

Summary: 9 packages finished [3.86s]
  1 package failed: moveit_msgs
  1 package had stderr output: moveit_msgs
  35 packages not processed

pip install lark-parser
sudo rosdep init
rosdep update
rosdep install --from-paths src --ignore-src -r -y

 

위의 내용은 나중에 수정해라

여기부터 다시 설치하면 해결됨

echo "source $COLCON_WS/install/setup.bash"

 

 

behavior tree cpp 설치하는 법

dpkg -l | grep libzmq      # ZeroMQ 패키지 검색
dpkg -l | grep sqlite      # SQLite 패키지 검색

 

mkdir: cannot create directory ‘build’: File exists

더보기

(btgenbot) kime@DESKTOP-B35S6CO:~/ws_moveit2$ mkdir build; cd build
cmake ../BehaviorTree.CPP
cmake --build . --parallel
mkdir: cannot create directory ‘build’: File exists
CMake Error: The source directory "/home/kime/ws_moveit2/BehaviorTree.CPP" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.
Error: could not load cache

이미 build 파일이 있기 때문에 발생한 오류이다. 간단하게 mkdir build를 생략해라

 

CMake Error: The source directory "/home/kime/ws_moveit2/BehaviorTree.CPP" does not exist.

더보기

(btgenbot) kime@DESKTOP-B35S6CO:~/ws_moveit2/build$ cmake ../BehaviorTree.CPP
cmake --build . --parallel
CMake Error: The source directory "/home/kime/ws_moveit2/BehaviorTree.CPP" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.
Error: could not load cache

ls -la /home/kime/ws_moveit2/

소스 디렉터리 확인

깃 클론해서 폴더 만듬(buildx 그 전 파일)

git clone https://github.com/BehaviorTree/BehaviorTree.CPP.git
cmake ../BehaviorTree.CPP
cmake --build . --parallel

CMake Error: The source directory "/home/kime/ws_moveit2/BehaviorTree.CPP" does not exist.

더보기

(btgenbot) kime@DESKTOP-B35S6CO:~/ws_moveit2/build$ cmake ../BehaviorTree.CPP
cmake --build . --parallel
CMake Error: The source directory "/home/kime/ws_moveit2/BehaviorTree.CPP" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.
Error: could not load cache

 

mv: cannot move 'BehaviorTree.CPP' to '/home/ws_moveit2': Permission denied

더보기

(btgenbot) kime@DESKTOP-B35S6CO:~/ws_moveit2/build$ mv BehaviorTree.CPP /home/ws_moveit2 mv: cannot move 'BehaviorTree.CPP' to '/home/ws_moveit2': Permission denied (btgenbot) kime@DESKTOP-B35S6CO:~/ws_moveit2/build$

 

다시 build로 가서 

cmake ../BehaviorTree.CPP
cmake --build . --parallel

 

 

CMake Error at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find ZeroMQ (missing: ZeroMQ_LIBRARIES ZeroMQ_INCLUDE_DIRS)

BehaviorTree.CPP  build  install  log  moveit2  moveit_msgs  moveit_resources  src
(btgenbot) kime@DESKTOP-B35S6CO:~/ws_moveit2$ cmake ../BehaviorTree.CPP
cmake --build . --parallel
CMake Error: The source directory "/home/kime/BehaviorTree.CPP" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.
Error: could not load cache
(btgenbot) kime@DESKTOP-B35S6CO:~/ws_moveit2$ cd build
(btgenbot) kime@DESKTOP-B35S6CO:~/ws_moveit2/build$ cmake ../BehaviorTree.CPP
cmake --build . --parallel
-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Setting build type to 'Release' as none was specified.
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Found Python3: /home/kime/anaconda3/envs/btgenbot/bin/python3 (found version "3.10.0") found components: Interpreter
-- ------------------------------------------
-- BehaviourTree is being built using AMENT.
-- ------------------------------------------
CMake Error at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find ZeroMQ (missing: ZeroMQ_LIBRARIES ZeroMQ_INCLUDE_DIRS)
Call Stack (most recent call first):
  /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  cmake/FindZeroMQ.cmake:63 (find_package_handle_standard_args)
  cmake/ament_build.cmake:6 (find_package)
  CMakeLists.txt:60 (include)


-- Configuring incomplete, errors occurred!
See also "/home/kime/ws_moveit2/build/CMakeFiles/CMakeOutput.log".
gmake: Makefile: No such file or directory
gmake: *** No rule to make target 'Makefile'.  Stop.
(btgenbot) kime@DESKTOP-B35S6CO:~/ws_moveit2/build$

 

 sudo apt-get install libzmq3-dev libboost-coroutine-dev libncurses5-dev libncursesw5-dev

이거 쳐보고

다시 치면 성공

cmake ../BehaviorTree.CPP
cmake --build . --parallel

 

 

BehaviorTree.ROS2

git clone https://github.com/AIRLab-POLIMI/BTGenBot.git

 

CMake Error: The current CMakeCache.txt directory /home/kime/ws_moveit2/src/BTGenBot/bt_client/build/bt_client/CMakeCache.txt is different than the directory /home/kime/BTGenBot/bt_client/build/bt_client where CMakeCache.txt was created.

더보기

(btgenbot) kime@DESKTOP-B35S6CO:~/ws_moveit2/src/BTGenBot/bt_client$ colcon build Starting >>> bt_client --- stderr: bt_client CMake Error: The current CMakeCache.txt directory /home/kime/ws_moveit2/src/BTGenBot/bt_client/build/bt_client/CMakeCache.txt is different than the directory /home/kime/BTGenBot/bt_client/build/bt_client where CMakeCache.txt was created. This may result in binaries being created in the wrong place. If you are not sure, reedit the CMakeCache.txt CMake Error: The source "/home/kime/ws_moveit2/src/BTGenBot/bt_client/CMakeLists.txt" does not match the source "/home/kime/BTGenBot/bt_client/CMakeLists.txt" used to generate cache. Re-run cmake with a different source directory. --- Failed <<< bt_client [0.02s, exited with code 1] Summary: 0 packages finished [0.21s] 1 package failed: bt_client 1 package had stderr output: bt_client (btgenbot) kime@DESKTOP-B35S6CO:~/ws_moveit2/src/BTGenBot/bt_client$

캐시 지우기

rm -rf /home/kime/ws_moveit2/src/BTGenBot/bt_client/build/*

다시 빌드

colcon build

 Could not find a package configuration file provided by "behaviortree_ros2"

Starting >>> bt_client
--- stderr: bt_client
CMake Error at CMakeLists.txt:10 (find_package):
  By not providing "Findbehaviortree_ros2.cmake" in CMAKE_MODULE_PATH this
  project has asked CMake to find a package configuration file provided by
  "behaviortree_ros2", but CMake did not find one.

  Could not find a package configuration file provided by "behaviortree_ros2"
  with any of the following names:

    behaviortree_ros2Config.cmake
    behaviortree_ros2-config.cmake

  Add the installation prefix of "behaviortree_ros2" to CMAKE_PREFIX_PATH or
  set "behaviortree_ros2_DIR" to a directory containing one of the above
  files.  If "behaviortree_ros2" provides a separate development package or
  SDK, be sure it has been installed.


---
Failed   <<< bt_client [1.14s, exited with code 1]

Summary: 0 packages finished [1.33s]
  1 package failed: bt_client
  1 package had stderr output: bt_client

behaviortree_ros2가 설치된 정확한 경로

export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH:/usr/local

pwd

export behaviortree_ros2_DIR=/usr/local/share/behaviortree_ros2/cmake

/home/kime/ws_moveit2/src/BehaviorTree.ROS2

/home/kime/ws_moveit2/src/BehaviorTree.ROS2/behaviortree_ros2

export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH:/home/kime/ws_moveit2/src
export behaviortree_ros2_DIR=/home/kime/ws_moveit2/src/BehaviorTree.ROS2
cd /home/kime/ws_moveit2/src
colcon build
export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH:/home/kime/ws_moveit2/src/BehaviorTree.ROS2

 

ls/home/kime/ws_moveit2/BehaviorTree.CPP

export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH:/home/kime/ws_moveit2/BehaviorTree.CPP
export behaviortree_cpp_DIR=/home/kime/ws_moveit2/BehaviorTree.CPP/lib/cmake/behaviortree_cpp

CMAKE_PREFIX_PATH 설정:

export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH:/home/kime/ws_moveit2/BehaviorTree.CPP:/home/kime/ws_moveit2/src/BehaviorTree.ROS2/behaviortree_ros2

behaviortree_cpp_DIR 설정:

export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH:/home/kime/ws_moveit2/BehaviorTree.CPP:/home/kime/ws_moveit2/src/BehaviorTree.ROS2/behaviortree_ros2

behaviortree_ros2_DIR 설정:

export behaviortree_ros2_DIR=/home/kime/ws_moveit2/src/BehaviorTree.ROS2/behaviortree_ros2/share/behaviortree_ros2/cmake

 

 

export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH:/home/kime/ws_moveit2/BehaviorTree.CPP:/home/kime/ws_moveit2/src/BehaviorTree.ROS2/behaviortree_ros2

export behaviortree_cpp_DIR=/home/kime/ws_moveit2/BehaviorTree.CPP/lib/cmake/behaviortree_cpp