This page will serve to briefly summarize the goals and instructions for the SWE and ROS2 project.
Objective: Create a ROS2 node that subscribes to the topic “talker” and prints out the message received
Goals:
- Get introduced to ROS2, the industry-standard modular communication framework in robotics.
- Understand how to create and communicate between nodes in our codebase
- General node structure
- CMakeLists
- package.xml
- Understand best practices in software engineering
Instructions:
- Log onto the development server and
cd
intoonboarding_files/ros2/listener
. - You have *three files you need to complete. Don’t worry, two are literally just filling in a couple words. Go ahead and follow the instructions in the three files to complete onboarding:
CMakeLists.txt
,package.xml
, andlistener_starter.cpp
. - To build your project:
cd
into theonboarding_files/ros2/
folder and runsource /opt/ros/foxy/setup.sh
andcolcon build
. Runsource install/setup.sh
to update changes. - To test your project: you will need to run the talker node first. Login to the server in a second window and
cd
into the talker folder and runsource ../install/setup.sh
. Start the talker node usingros2 run talker_example talker
. - Back in the original window,
cd
into the your listener project folder, and runros2 run <pkg_name> <executable_name>
. Ensure the listener receives the correct message: “You have completed the ROS2 onboarding project!”.
Resources and helpful info: If you don’t understand a step, look it up! No shame in consulting documentation. Let’s just say writing a listener node is a very common task.
Common bugs
- Q: Error while building, relating to comments in the file
- A: Remove the comments in the file. I belive triple tick comments
"""
causes bugs which is my mistake.
- A: Remove the comments in the file. I belive triple tick comments