카테고리 없음2022. 7. 14. 21:27

environment : laptop UBUNTU 20.04(focal) + reinstall ROS2(foxy)

 

1. delete old version or ROS1 and ROS2

 

더보기
ros delete & reinstall (ROS 삭제 후 재설치)

 

AAU_Robot 2020. 6. 29. 13:58

1. 기존에 설치된 ros 삭제 

$ sudo apt-get purge ros-* (패키지와 설정파일 함께 삭제)

$ sudo apt-get remove ros-* (패키지만 삭제, 설정파일은 남겨둠)

 

2. 삭제되었는지 확인 

$ rosversion -d 

여기에서 <unknown>이라고 뜨면 삭제가 된 것임. 

만약 기존 ros version이 확인되면, 재부팅 후 다시 확인해 보면, 삭제된 것을 확인할 수 있음. 

 

https://everynewday1029.tistory.com/37

 

printenv ROS_DISTRO

 

sudo apt remove ~nros-foxy-* && sudo apt autoremove

sudo rm /etc/apt/sources.list.d/ros2.list
sudo apt update
sudo apt autoremove
sudo apt upgrade


sudo apt-get purge ros-*

sudo apt-get remove ros-*

sudo apt-get autoremove

sudo rm /etc/ros/rosdep/sources.list.d/20-default.list

sudo apt-get purge --auto-remove ros-<distro_name>-desktop-full

sudo apt-get purge --auto-remove ros-galactic-desktop
sudo apt-get purge --auto-remove ros-foxy-desktop

 

 

apt list --installed | grep ros

 

2. reinstall ROS2 Foxy

 

3. follow the next site instruction

https://www.theconstructsim.com/ros2-qa-223-how-to-get-robot-position-using-transforms-in-ros2/

 

[ROS2 Q&A] 223 - How to get robot position using transforms in ROS2 - The Construct

What we are going to learn How to set up the TurtleBot3 packages in ROS How to use transforms to obtain robot position List of resources used in this post The Construct: https://app.theconstructsim.com/ Repositories: https://github.com/ROBOTIS-GIT/turtlebo

www.theconstructsim.com

 

4. you might need to trouble shooting like me

 

더보기

 

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

     gazeboConfig.cmake
     gazebo-config.cmake

   Add the installation prefix of "gazebo" to CMAKE_PREFIX_PATH or set
   "gazebo_DIR" to a directory containing one of the above files.  If "gazebo"
   provides a separate development package or SDK, be sure it has been
   installed.
   
   
#SOLUTION : INSTALL GAZEBO PACKAGE for Foxy
https://answers.ros.org/question/335833/how-to-solve-the-error-of-could-not-find-a-package-gazebo/


sudo apt install ros-foxy-gazebo*

#ERROR
--- stderr: turtlebot3_node                                                                                                                                 
CMake Error at CMakeLists.txt:19 (find_package):
  By not providing "Finddynamixel_sdk.cmake" in CMAKE_MODULE_PATH this
  project has asked CMake to find a package configuration file provided by
  "dynamixel_sdk", but CMake did not find one.

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

    dynamixel_sdkConfig.cmake
    dynamixel_sdk-config.cmake

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


#SOLUTION
#STEP 1 : looking for "CMakeLists.txt"
Error message said turtlebot3_node node's CMakeLists.txt has an error
--- stderr: turtlebot3_node                                                                                                                                 
CMake Error at CMakeLists.txt:19 (find_package):

#or you can search all folders.
find ~/ros2_ws/ -name "CMakeLists.txt" 2>/dev/null
/home/orasman/ros2_ws/src/turtlebot3/turtlebot3_node/CMakeLists.txt


#NOT WORKING
find_package(dynamixel_sdk REQUIRED) @ /home/orasman/ros2_ws/src/turtlebot3/turtlebot3_node/CMakeLists.txt


#find dynamixel_sdk : https://github.com/robotis-ros2-release/dynamixel_sdk-release/tree/debian/foxy/dynamixel_sdk

git clone https://github.com/robotis-ros2-release/dynamixel_sdk-release.git

colcon build --packages-select dynamixel_sdk-release
[0.324s] WARNING:colcon.colcon_core.package_selection:ignoring unknown package 'dynamixel_sdk-release' in --packages-select
                     
Summary: 0 packages finished [0.34s]


download foxy version from github

change the folder name as dynamixel_sdk
then it can built

colcon build --packages-select dynamixel_sdk





#TRY BUILD : ros1_bridge
colcon build --packages-select ros1_bridge

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

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

    xmlrpcppConfig.cmake
    xmlrpcpp-config.cmake
    
===> you need to install ROS1 such as noetic

 

 

https://github.com/bpwilcox/xmlrpcpp

 

GitHub - bpwilcox/xmlrpcpp: ROS2 port of xmlrpcpp package

ROS2 port of xmlrpcpp package. Contribute to bpwilcox/xmlrpcpp development by creating an account on GitHub.

github.com

 

 

colcon build --packages-select xmlrpcpp

 

#NOW YOU CAN BUILD ALL PACKAGES

colcon build
Starting >>> turtlebot3_msgs
Starting >>> turtlebot3_description
Starting >>> dynamixel_sdk
Starting >>> turtlebot3_cartographer
Finished <<< turtlebot3_description [0.58s]                                                                                                                                
Starting >>> turtlebot3_navigation2
Finished <<< turtlebot3_cartographer [0.62s]                                                                                                        
Starting >>> turtlebot3_teleop
Finished <<< dynamixel_sdk [1.35s]                                                                                                                                      
Starting >>> turtlebot3_gazebo
Finished <<< turtlebot3_navigation2 [0.99s]                                                                                                                               
Starting >>> xmlrpcpp
Finished <<< turtlebot3_gazebo [0.79s]                                                                                                                           
Finished <<< xmlrpcpp [0.73s]                                                                                           
Finished <<< turtlebot3_msgs [2.40s]                                                          
Starting >>> turtlebot3_node
Starting >>> turtlebot3_example
Starting >>> turtlebot3_fake_node                                                                                 
Finished <<< turtlebot3_teleop [3.13s]                                                                                                                          
Finished <<< turtlebot3_fake_node [2.57s]                                                                                                 
Starting >>> turtlebot3_simulations
Finished <<< turtlebot3_simulations [0.92s]                                                                                              
Finished <<< turtlebot3_example [4.81s]                                                           
Finished <<< turtlebot3_node [27.9s]                         
Starting >>> turtlebot3_bringup
Finished <<< turtlebot3_bringup [1.71s]                     
Starting >>> turtlebot3
Finished <<< turtlebot3 [1.71s]

 

ros2 launch turtlebot3_cartographer cartographer.launch.py

 

when you try to run cartographer, there is an error like below

 

PackageNotFoundError("package 'cartographer_ros' not found

 

https://answers.ros.org/question/327518/cant-find-package-cartographer_ros/

 

You need to install the package ros-melodic-cartographer-ros

sudo apt install ros-foxy-cartographer-ros

 

5. YOU CAN RUN GAZEBO & CARTOGRAPHER & KEYOP

 

ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py ros2 run turtlebot3_teleop teleop_keyboard
ros2 launch turtlebot3_cartographer cartographer.launch.py  

 

 

 

 

 

ROS2 topic list shows /scan, /tf, /imu etc.

Posted by orasman