Publish / Subscribe Framework for Robot Operating System 2
-
You need to make ros2 workspace Link
-
Make ros2 package
- Move to ros2 workspace src folder
cd dev_ws/src
- C++
ros2 pkg create --build-type ament_cmake --node-name [NODE_NAME] [PKG_NAME]
- Python
ros2 pkg create --build-type ament_python --node-name [NODE_NAME] [PKG_NAME]
- Move back to ros2 workspcae
cd ~/dev_ws
- Build package
colcon build --packages-select [PKG_NAME]
- Run package
. install/setup.bash
ros2 run [PKG_NAME] [NODE_NAME]
- Install dependencies
sudo apt-get install ros-dashing-cv-bridge
sudo apt-get install ros-dashing-vision-opencv
sudo apt-get install python3-opencv
-
Waiting for client's message
-
When message arrived, server sends ack to the client
-
Run
ros2 run ros2comm serverRun
-
Sends message to the server
-
Receives ack from the server
-
Run
ros2 run ros2comm clientRun
- Move to your ros2 workspace
cd /root/dev_ws/
. install/setup.bash
source /opt/ros/dashing/setup.bash