From bcd456c0de362a94c13345998e89507b8c99124c Mon Sep 17 00:00:00 2001 From: Wessel Tip Date: Thu, 4 Sep 2025 11:30:29 +0200 Subject: [PATCH] feat(les1): Initial Tilmann boilerplate --- .gitignore | 37 ++++++++++++ src/les_pkg/CMakeLists.txt | 41 +++++++++++++ src/les_pkg/package.xml | 20 +++++++ src/les_pkg/src/les1.cpp | 116 +++++++++++++++++++++++++++++++++++++ 4 files changed, 214 insertions(+) create mode 100644 .gitignore create mode 100644 src/les_pkg/CMakeLists.txt create mode 100644 src/les_pkg/package.xml create mode 100644 src/les_pkg/src/les1.cpp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c32553f --- /dev/null +++ b/.gitignore @@ -0,0 +1,37 @@ + +# Created by https://www.toptal.com/developers/gitignore/api/ros2 +# Edit at https://www.toptal.com/developers/gitignore?templates=ros2 + +### ROS2 ### +install/ +log/ +build/ + +# Ignore generated docs +*.dox +*.wikidoc + +# eclipse stuff +.project +.cproject + +# qcreator stuff +CMakeLists.txt.user + +srv/_*.py +*.pcd +*.pyc +qtcreator-* +*.user + +*~ + +# Emacs +.#* + +# Colcon custom files +COLCON_IGNORE +AMENT_IGNORE + +# End of https://www.toptal.com/developers/gitignore/api/ros2 + diff --git a/src/les_pkg/CMakeLists.txt b/src/les_pkg/CMakeLists.txt new file mode 100644 index 0000000..9df323c --- /dev/null +++ b/src/les_pkg/CMakeLists.txt @@ -0,0 +1,41 @@ +cmake_minimum_required(VERSION 3.8) +project(les_pkg) + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +# find dependencies +find_package(ament_cmake REQUIRED) +find_package(rclcpp REQUIRED) +find_package(rclcpp_action REQUIRED) # nodig als er een actionserver node wordt gemaakt +find_package(std_msgs REQUIRED) # gebruik maken von standaard messages +#find_package(templates_interfaces REQUIRED) # gebruik maken van project messages + + +add_executable(les1 src/les1.cpp) + +ament_target_dependencies(les1 rclcpp) +#ament_target_dependencies(template_subscriber rclcpp std_msgs) + +install ( + TARGETS + les1 + DESTINATION lib/${PROJECT_NAME} +) + + + +if(BUILD_TESTING) + find_package(ament_lint_auto REQUIRED) + # the following line skips the linter which checks for copyrights + # comment the line when a copyright and license is added to all source files + set(ament_cmake_copyright_FOUND TRUE) + # the following line skips cpplint (only works in a git repo) + # comment the line when this package is in a git repo and when + # a copyright and license is added to all source files + set(ament_cmake_cpplint_FOUND TRUE) + ament_lint_auto_find_test_dependencies() +endif() + +ament_package() diff --git a/src/les_pkg/package.xml b/src/les_pkg/package.xml new file mode 100644 index 0000000..5c890eb --- /dev/null +++ b/src/les_pkg/package.xml @@ -0,0 +1,20 @@ + + + + les_pkg + 0.0.0 + TODO: Package description + wessel + TODO: License declaration + + ament_cmake + + rclcpp + + ament_lint_auto + ament_lint_common + + + ament_cmake + + diff --git a/src/les_pkg/src/les1.cpp b/src/les_pkg/src/les1.cpp new file mode 100644 index 0000000..af2f3d3 --- /dev/null +++ b/src/les_pkg/src/les1.cpp @@ -0,0 +1,116 @@ +// #include "rclcpp/rclcpp.hpp" +// +// namespace les_ws; +// +// class LesNode : public rclcpp::Node { +// public: +// LesNode() +// : Node("node_les1") +// { +// timer_ = this->create_wall_timer(std::chrono::seconds(1), std::bind) +// } +// +// private: +// int counter_ = 0; +// +// rclcpp::TimerBase::SharedPtr timer_; +// }; +// +// int main(int argc, char **argv) { +// rclcpp::init(argc, argv); +// auto node = std::make_shared(); +// rclcpp::spin(node); +// rclcpp::shutdown(); +// +// return 0; +// } +// +/* +--Node description: +...what the node is doing (functionally)... +When node is created the node prints "Hello you are new to ROS2" on terminal, +further it does nothing more than being alive +*/ + +/* +--Software changes: +one line per change +(1) created 31.3.2025: developer-Tilmann Koster reviewer(s)-Niek Ottens +(2) changed 01.4.2025: xxx functionality added ... : developer-Tilmann Koster reviewer(s)-Niek Ottens +... +*/ + + +//-- tester: Sander Gieling + + + +//--general includes +#include +#include "rclcpp/rclcpp.hpp" + +//--custom includes +//... + +//--using +//... + + +//--Node class + +class Template_General : public rclcpp::Node +{ + public: + //-- constuctor: + Template_General() : Node("template_general_node") + { + //--communication and timer objects: + //see templates for subcribers, action server ... + //... + + //--customs functions: + custom_example(); + //... + + } + + //-- communication and timer functions + //... + + //--customs functions: + void custom_example() + { + + /*your custom example code */ + RCLCPP_INFO(this->get_logger() ,"Hello you are new to ROS2"); //code example + /*your custom example code */ + + } + + //--custom variables: + + private: + + //--rclcpp variables: + // ... + + //--custom variables: + //... + +}; + + +int main(int argc,char *argv[]) +{ +rclcpp::init(argc,argv) ; + +auto node = std::make_shared(); + + +rclcpp::spin(node); + +rclcpp::shutdown(); + +return 0; + +}