아래 명령으로 static_bridge 노드를 실행하면 라즈베리파이가 보낸 ROS1 scan_2D 토픽을 받아서 ROS2로 바꿔준다
ros2 run ros1_bridge static_bridge
[INFO] [1657369620.191703541] [ros_bridge]: create bidirectional bridge for topic scan_2D [INFO] [1657369620.881221371] [ros_bridge]: Passing message from ROS 1 sensor_msgs/PointCloud2 to ROS 2 sensor_msgs/msg/PointCloud2 (showing msg only once per type)
아래 명령으로 ROS2로 수신된 토픽을 확인 할 수 있다
ros2 topic list
6. ROS2용 cartogrpher 를 설치
이 소스가 ROS2 galctic 버전에 설치하면 에러가 난다. 그래서 ROS2 foxy 버전을 깔아야 함.
#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:
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
#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
1) 노트북 환경 : Ubuntu 20.04(Focal) + ROS1 noetic + ROS2 galctic
2) 라즈베리파이 환경 : Ubuntu 16.04(Xenial) + ROS1 kinetic + cyglidar USB 연결
: Ubiquity robotics에서 배포한 우분투+ROS 설치된 이미지 파일 사용
3) CREATE3 : ROS2 (로봇 센서 토픽, 로봇 제어 액션)
< ros1_bridge 설치, 빌드, 수정, 실행 과정>
# SHELL : download ROS1_BRIDGE code at '~/ros2_galactic' (you can change the folder name)
git clone https://github.com/ros2/ros1_bridge.git
# set ROS1 core address (raspberrypi connected with cyglidar)
export ROS_HOSTNAME=192.168.0.39#
export ROS_MASTER_URI=http://192.168.0.39:11311
# run ROS1 and check topic list and message type
/opt/ros/noetic/setup.bash
rostopic list -v
# you can see
>> Published topics:
>> * /scan_2D [sensor_msgs/PointCloud2] 1 publisher
// modify static_bridge.cpp
// bridge one example topic
std::string topic_name = "scan_2D";
std::string ros1_type_name = "sensor_msgs/PointCloud2";
std::string ros2_type_name = "sensor_msgs/msg/PointCloud2";
# SHELL : build code (doing this at ~/ros2_galactic)
export ROS1_INSTALL_PATH=/opt/ros/noetic
export ROS2_INSTALL_PATH=~/ros2_rolling/install
colcon build --symlink-install --packages-skip ros1_bridge
source ${ROS1_INSTALL_PATH}/setup.bash
source ${ROS2_INSTALL_PATH}/setup.bash
colcon build --symlink-install --packages-select ros1_bridge --cmake-force-configure
### build took 30 minutes.. I don't know why!!
# SHELL : run 'static_bridge' node
ros2 run ros1_bridge static_bridge
[INFO] [1657369620.191703541] [ros_bridge]: create bidirectional bridge for topic scan_2D
[INFO] [1657369620.881221371] [ros_bridge]: Passing message from ROS 1 sensor_msgs/PointCloud2 to ROS 2 sensor_msgs/msg/PointCloud2 (showing msg only once per type)
# SHELL B : check topic published into ROS2
ros2 topic list