77A Package built using ``` colcon ``` build as a part of ROS2 Tutorials. It contains the implementation of a Talker and a Listener node.
88
99## Contents
10- .
11- ├── include
10+
11+
12+ <pre >├── include
1213│ └── beginner_tutorials
1314| ├── publisher_function.hpp
1415│ └── subscriber_function.hpp
@@ -17,7 +18,7 @@ A Package built using ```colcon``` build as a part of ROS2 Tutorials. It contain
1718├── README.md
1819└── src
1920 ├── publisher_member_function.cpp
20- └── subscriber_member_function.cpp
21+ └── subscriber_member_function.cpp</ pre >
2122
2223## Instructions to Build the Package
2324```
@@ -28,7 +29,7 @@ rosdep install -i --from-path src --rosdistro humble -y
2829colcon build --packages-select beginner_tutorials
2930```
3031
31- ## Run Instructions
32+ ## Instructions to Run the Package
3233
3334### Run the Publisher
3435In a new terminal, navigate to your ROS2 workspace (``` ros2_ws ``` ) and source the setup files,
@@ -49,15 +50,42 @@ ros2 run beginner_tutorials listener
4950Enter ``` Ctrl+c ``` in each terminal to stop the nodes from spinning.
5051
5152## Results
53+ ### Outputs
54+ #### Talker Node
55+ ```
56+ bharadwaj@Alpha-Phoenix ~/tests for ros2/beginner_tutorials (ros_pub_sub) $ ros2 run beginner_tutorials talker
57+ [INFO] [1668062183.614769978] [minimal_publisher]: Publishing: 'Hey, This is Bharadwaj, ID: 0'
58+ [INFO] [1668062184.114694591] [minimal_publisher]: Publishing: 'Hey, This is Bharadwaj, ID: 1'
59+ [INFO] [1668062184.614729694] [minimal_publisher]: Publishing: 'Hey, This is Bharadwaj, ID: 2'
60+ [INFO] [1668062185.114778975] [minimal_publisher]: Publishing: 'Hey, This is Bharadwaj, ID: 3'
61+ [INFO] [1668062185.614698424] [minimal_publisher]: Publishing: 'Hey, This is Bharadwaj, ID: 4'
62+ [INFO] [1668062186.114692743] [minimal_publisher]: Publishing: 'Hey, This is Bharadwaj, ID: 5'
63+ [INFO] [1668062186.614639782] [minimal_publisher]: Publishing: 'Hey, This is Bharadwaj, ID: 6'
64+ [INFO] [1668062187.114668045] [minimal_publisher]: Publishing: 'Hey, This is Bharadwaj, ID: 7'
65+ [INFO] [1668062187.614657899] [minimal_publisher]: Publishing: 'Hey, This is Bharadwaj, ID: 8'
66+ [INFO] [1668062188.114706558] [minimal_publisher]: Publishing: 'Hey, This is Bharadwaj, ID: 9'
67+ [INFO] [1668062188.614695506] [minimal_publisher]: Publishing: 'Hey, This is Bharadwaj, ID: 10'
68+ ```
69+
70+ #### Listener Node
71+ ```
72+ bharadwaj@Alpha-Phoenix ~/tests for ros2/beginner_tutorials (ros_pub_sub) $ ros2 run beginner_tutorials listener
73+ [INFO] [1668062186.614874934] [minimal_subscriber]: I heard: 'Hey, This is Bharadwaj, ID: 6'
74+ [INFO] [1668062187.115330341] [minimal_subscriber]: I heard: 'Hey, This is Bharadwaj, ID: 7'
75+ [INFO] [1668062187.615026935] [minimal_subscriber]: I heard: 'Hey, This is Bharadwaj, ID: 8'
76+ [INFO] [1668062188.115233154] [minimal_subscriber]: I heard: 'Hey, This is Bharadwaj, ID: 9'
77+ [INFO] [1668062188.615349421] [minimal_subscriber]: I heard: 'Hey, This is Bharadwaj, ID: 10'
78+ ```
5279
53- ### cpplint
80+ ### Static Code Analysis
81+ #### cpplint
5482Change to the root directory of the package, ``` /beginner_tutorials ``` , and run:
5583```
5684cpplint --filter=-build/c++11,+build/c++17,-build/namespaces,-build/include_order ./src/*.cpp ./include/beginner_tutorials/*.hpp > ./results/cpplint.txt
5785```
5886The results of running ``` cpplint ``` can be found in ``` /results/cpplint.txt ``` .
5987
60- ### cppcheck
88+ #### cppcheck
6189Change to the root directory of the package, ``` /beginner_tutorials ``` , and run:
6290```
6391cppcheck --enable=all --std=c++17 ./src/*.cpp ./include/beginner_tutorials/*.hpp --suppress=missingIncludeSystem --suppress=unmatchedSuppression --suppress=unusedFunction --suppress=missingInclude --suppress=useInitializationList > results/cppcheck.txt
0 commit comments