Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

Commit e127f2f

Browse files
feat: basic node set up
1 parent 50cf16e commit e127f2f

File tree

5 files changed

+63
-13
lines changed

5 files changed

+63
-13
lines changed

CMakeLists.txt

+16-10
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,25 @@ endif()
77

88
# find dependencies
99
find_package(ament_cmake REQUIRED)
10-
# uncomment the following section in order to fill in
11-
# further dependencies manually.
12-
# find_package(<dependency> REQUIRED)
10+
find_package(rclcpp REQUIRED)
11+
12+
add_executable(thermal_zone_publisher
13+
src/thermal_zone_publisher.cc
14+
src/thermal_zone_publisher_node.cc)
15+
target_include_directories(thermal_zone_publisher PUBLIC
16+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
17+
$<INSTALL_INTERFACE:include>)
18+
target_compile_features(thermal_zone_publisher PUBLIC c_std_99 cxx_std_17) # Require C99 and C++17
19+
20+
ament_target_dependencies(thermal_zone_publisher
21+
rclcpp)
22+
23+
install(TARGETS
24+
thermal_zone_publisher
25+
DESTINATION lib/${PROJECT_NAME})
1326

1427
if(BUILD_TESTING)
1528
find_package(ament_lint_auto REQUIRED)
16-
# the following line skips the linter which checks for copyrights
17-
# comment the line when a copyright and license is added to all source files
18-
set(ament_cmake_copyright_FOUND TRUE)
19-
# the following line skips cpplint (only works in a git repo)
20-
# comment the line when this package is in a git repo and when
21-
# a copyright and license is added to all source files
22-
set(ament_cmake_cpplint_FOUND TRUE)
2329
ament_lint_auto_find_test_dependencies()
2430
endif()
2531

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#pragma once
2+
3+
#include <rclcpp/rclcpp.hpp>
4+
5+
class ThermalZonePublisherNode : public rclcpp::Node
6+
{
7+
public:
8+
ThermalZonePublisherNode(const std::string & node_name);
9+
~ThermalZonePublisherNode();
10+
11+
protected:
12+
private:
13+
};

package.xml

+5-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
<package format="3">
44
<name>thermal_zone_publisher</name>
55
<version>0.0.0</version>
6-
<description>TODO: Package description</description>
7-
<maintainer email="[email protected]">builder</maintainer>
8-
<license>TODO: License declaration</license>
6+
<description>ROS2 node that will create publishers for thermal zones found on linux systems</description>
7+
<maintainer email="[email protected]">Nathanael Gandhi</maintainer>
8+
<license>MIT</license>
9+
10+
<depend>rclcpp</depend>
911

1012
<buildtool_depend>ament_cmake</buildtool_depend>
1113

src/thermal_zone_publisher.cc

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include <memory>
2+
#include <rclcpp/rclcpp.hpp>
3+
4+
#include "thermal_zone_publisher/thermal_zone_publisher_node.h"
5+
6+
int main(int argc, char ** argv)
7+
{
8+
rclcpp::init(argc, argv);
9+
10+
rclcpp::executors::SingleThreadedExecutor exec;
11+
exec.add_node(std::make_shared<ThermalZonePublisherNode>("thermal_zone_publisher"));
12+
exec.spin();
13+
14+
rclcpp::shutdown();
15+
16+
return 0;
17+
}

src/thermal_zone_publisher_node.cc

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include "thermal_zone_publisher/thermal_zone_publisher_node.h"
2+
3+
ThermalZonePublisherNode::ThermalZonePublisherNode(const std::string & node_name)
4+
: rclcpp::Node(node_name)
5+
{
6+
RCLCPP_INFO_STREAM(this->get_logger(), "default constructor executed");
7+
}
8+
9+
ThermalZonePublisherNode::~ThermalZonePublisherNode()
10+
{
11+
RCLCPP_INFO_STREAM(this->get_logger(), "destructor executed");
12+
}

0 commit comments

Comments
 (0)