feat(les1): Initial Tilmann boilerplate

This commit is contained in:
2025-09-04 11:30:29 +02:00
commit bcd456c0de
4 changed files with 214 additions and 0 deletions

37
.gitignore vendored Normal file
View File

@@ -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

View File

@@ -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()

20
src/les_pkg/package.xml Normal file
View File

@@ -0,0 +1,20 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>les_pkg</name>
<version>0.0.0</version>
<description>TODO: Package description</description>
<maintainer email="wessel@todo.todo">wessel</maintainer>
<license>TODO: License declaration</license>
<buildtool_depend>ament_cmake</buildtool_depend>
<depend>rclcpp</depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
<export>
<build_type>ament_cmake</build_type>
</export>
</package>

116
src/les_pkg/src/les1.cpp Normal file
View File

@@ -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<LesNode>();
// 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 <cstdlib>
#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<Template_General>();
rclcpp::spin(node);
rclcpp::shutdown();
return 0;
}