Restructure codebase

This commit is contained in:
2022-12-12 13:48:43 +02:00
parent 697312ed8c
commit ee4e82f3b6
14 changed files with 360 additions and 4 deletions

View File

@@ -0,0 +1,37 @@
cmake_minimum_required(VERSION 3.8)
project(robot_controller)
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)
# uncomment the following section in order to fill in
# further dependencies manually.
# find_package(<dependency> REQUIRED)
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
# the following line skips the linter which checks for copyrights
# uncomment the line when a copyright and license is not present in all source files
#set(ament_cmake_copyright_FOUND TRUE)
# the following line skips cpplint (only works in a git repo)
# uncomment the line when this package is not in a git repo
#set(ament_cmake_cpplint_FOUND TRUE)
ament_lint_auto_find_test_dependencies()
endif()
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(robot_interfaces REQUIRED)
#add_executable(robotcontroller src/robotcontroller.cpp)
#ament_target_dependencies(robotcontroller rclcpp robot_interfaces)
install(TARGETS
talker
listener
DESTINATION lib/${PROJECT_NAME})
ament_package()

View File

@@ -0,0 +1,18 @@
<?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>robot_controller</name>
<version>0.0.0</version>
<description>TODO: Package description</description>
<maintainer email="root@todo.todo">root</maintainer>
<license>TODO: License declaration</license>
<buildtool_depend>ament_cmake</buildtool_depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
<export>
<build_type>ament_cmake</build_type>
</export>
</package>

View File

@@ -0,0 +1,41 @@
#include <cstdio>
#include <rclcpp/rclcpp.hpp>
class RobotController : public rclcpp::Node
{
public:
/// Constructor
RobotController();
private:
/// Callback that executes path on robot
virtual void add(const std::shared_ptr<robot_interfaces::srv::AddThreeInts::Request> request,
std::shared_ptr<robot_interfaces::srv::AddThreeInts::Response> response);
};
RobotController::RobotController(string name) : Node(name)
{
// Subscribe to target pose
target_pose_sub_ = this->create_subscription<geometry_msgs::msg::PoseStamped>("/target_pose", rclcpp::QoS(1), std::bind(&MoveItFollowTarget::target_pose_callback, this, std::placeholders::_1));
RCLCPP_INFO(this->get_logger(), "Initialization successful.");
}
int main(int argc, char ** argv)
{
//rclcpp::init(argc, argv);
//auto target_follower = std::make_shared<MoveItFollowTarget>();
//rclcpp::executors::SingleThreadedExecutor executor;
//executor.add_node(target_follower);
//executor.spin();
//rclcpp::shutdown();
//return EXIT_SUCCESS;
(void) argc;
(void) argv;
printf("hello world\n");
return 0;
}