Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 21 additions & 18 deletions opencat/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,36 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()


# find dependencies
# Find dependencies
find_package(ament_cmake REQUIRED)
# uncomment the following section in order to fill in
# further dependencies manually.
# find_package(<dependency> REQUIRED)
# service files
find_package(rosidl_default_generators REQUIRED)
find_package(type_description_interfaces REQUIRED)
find_package(opencat_msgs REQUIRED)
find_package(rclcpp REQUIRED)

# Create a library or executable
add_library(${PROJECT_NAME} src/opencat/opencat.cpp)

rosidl_generate_interfaces(${PROJECT_NAME}_srv
"srv/BaseTask.srv"
ament_target_dependencies(${PROJECT_NAME}
type_description_interfaces
)

# Link libraries
target_link_libraries(${PROJECT_NAME}
rclcpp
# type_description_interfaces
)

# Include directories
include_directories(include)
add_library(${PROJECT_NAME} src/opencat/opencat.cpp)
rosidl_target_interfaces(${PROJECT_NAME}
${PROJECT_NAME}_srv "rosidl_typesupport_cpp")
include_directories(${rclcpp_INCLUDE_DIRS})
include_directories(${opencat_msgs_INCLUDE_DIRS})

# Export the targets
ament_export_targets(${PROJECT_NAME} HAS_LIBRARY_TARGET)
ament_export_dependencies(rosidl_default_generators)

# export lib
# Install the library and headers
install(
DIRECTORY include/
DESTINATION include
Expand All @@ -52,14 +60,9 @@ install(
INCLUDES DESTINATION include
)

# Testing configuration
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()

Expand Down
5 changes: 3 additions & 2 deletions opencat/include/opencat/opencat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@
**/
#ifndef OPENCAT_H_
#define OPENCAT_H_
#include "opencat/srv/base_task.hpp"

#include "opencat_msgs/srv/base_task.hpp"
#include "rclcpp/rclcpp.hpp"
#include <cstdint>
#include <vector>
using std::vector;

namespace OpenCat
{
using namespace opencat::srv;
using namespace opencat_msgs::srv;
/**
* @brief list all commands available
**/
Expand Down
3 changes: 3 additions & 0 deletions opencat/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
<maintainer email="cc7@duck.com">C.C</maintainer>
<license>MIT</license>

<depend>rclcpp</depend>
<depend>opencat_msgs</depend>

<buildtool_depend>ament_cmake</buildtool_depend>

<test_depend>ament_lint_auto</test_depend>
Expand Down
19 changes: 16 additions & 3 deletions opencat_examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,30 @@ find_package(ament_cmake REQUIRED)
# uncomment the following section in order to fill in
# further dependencies manually.
# find_package(<dependency> REQUIRED)
find_package(opencat_serial REQUIRED)
find_package(rclcpp REQUIRED)
find_package(opencat REQUIRED)
find_package(opencat_msgs REQUIRED)
find_package(opencat_serial REQUIRED)
find_package(opencat_server REQUIRED)

# Add linker directory explicitly
link_directories("/opt/ros/jazzy/lib")

add_executable(serial_example src/serial_example.cpp)
ament_target_dependencies(serial_example
opencat_serial)
rclcpp
opencat
opencat_msgs
opencat_serial
opencat_server)

add_executable(client_example src/client_example.cpp)
ament_target_dependencies(client_example
rclcpp
opencat
opencat_msgs
opencat_serial
rclcpp)
opencat_server)

install(
TARGETS serial_example client_example
Expand Down
5 changes: 4 additions & 1 deletion opencat_examples/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
<maintainer email="cc7@duck.com">C.C</maintainer>
<license>MIT</license>

<depend>opencat_serial</depend>
<depend>rclcpp</depend>
<depend>opencat</depend>
<depend>opencat_msgs</depend>
<depend>opencat_serial</depend>
<depend>opencat_server</depend>

<buildtool_depend>ament_cmake</buildtool_depend>
<test_depend>ament_lint_auto</test_depend>
Expand Down
4 changes: 2 additions & 2 deletions opencat_examples/src/client_example.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "opencat/opencat.hpp"
#include "opencat/srv/base_task.hpp"
#include "opencat_msgs/srv/base_task.hpp"
#include "rclcpp/rclcpp.hpp"

using namespace opencat::srv;
using namespace opencat_msgs::srv;
const vector<int16_t> pee{
-4, 0, 10, 1, 2, 3, 3, 30, 20, 0, 0, 15, -10, 60, -10,
40, 40, 90, 45, 10, 60, 70, 45, 6, 0, 0, 0, 45, 20, 0,
Expand Down
24 changes: 24 additions & 0 deletions opencat_msgs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
cmake_minimum_required(VERSION 3.5)
project(opencat_msgs)

# Find dependencies for building the package
find_package(ament_cmake REQUIRED)
find_package(rosidl_default_generators REQUIRED)
find_package(std_msgs REQUIRED)

# Generate the messages and services from the .srv files
rosidl_generate_interfaces(${PROJECT_NAME}
"srv/BaseTask.srv" # Define the BaseTask service
DEPENDENCIES std_msgs # List any additional dependencies, like std_msgs
)

# Export dependencies to other packages that depend on this one
ament_export_dependencies(rosidl_default_runtime)

# Install the service definitions
install(DIRECTORY srv
DESTINATION share/${PROJECT_NAME}/srv
)

# Declare this as an ament package
ament_package()
26 changes: 26 additions & 0 deletions opencat_msgs/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?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>opencat_msgs</name>
<version>0.0.1</version>
<description>Messages and services for OpenCat control.</description>
<maintainer email="cc7@duck.com">C.C</maintainer>
<license>MIT</license>

<buildtool_depend>ament_cmake</buildtool_depend>
<buildtool_depend>rosidl_default_generators</buildtool_depend>

<exec_depend>rosidl_default_runtime</exec_depend>

<depend>std_msgs</depend>
<depend>type_description_interfaces</depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>

<member_of_group>rosidl_interface_packages</member_of_group>

<export>
<build_type>ament_cmake</build_type>
</export>
</package>
File renamed without changes.
8 changes: 7 additions & 1 deletion opencat_serial/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,23 @@ endif()
find_package(ament_cmake REQUIRED)
# uncomment the following section in order to fill in
# further dependencies manually.
find_package(type_description_interfaces REQUIRED)
find_package(rclcpp REQUIRED)
find_package(serial REQUIRED)
find_package(opencat REQUIRED)
find_package(opencat_msgs REQUIRED)

include_directories(include)
add_library(
${PROJECT_NAME}
src/${PROJECT_NAME}/${PROJECT_NAME}.cpp)

ament_target_dependencies(${PROJECT_NAME}
rclcpp
opencat
serial)
opencat_msgs
serial
type_description_interfaces)

ament_export_targets(${PROJECT_NAME} HAS_LIBRARY_TARGET)
ament_export_dependencies(opencat serial)
Expand Down
3 changes: 3 additions & 0 deletions opencat_serial/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@

<buildtool_depend>ament_cmake</buildtool_depend>

<depend>rclcpp</depend>
<depend>type_description_interfaces</depend>
<depend>opencat</depend>
<depend>opencat_msgs</depend>
<depend>serial</depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
Expand Down
11 changes: 9 additions & 2 deletions opencat_server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@ find_package(ament_cmake REQUIRED)
# uncomment the following section in order to fill in
# further dependencies manually.
# find_package(<dependency> REQUIRED)
find_package(opencat_serial REQUIRED)
find_package(rclcpp REQUIRED)
find_package(opencat_msgs REQUIRED)
find_package(opencat_serial REQUIRED)

# Add linker directory explicitly
link_directories("/opt/ros/jazzy/lib")

include_directories(include)
add_executable(
Expand All @@ -31,10 +35,13 @@ add_executable(
src/opencat_server/opencat_server.cpp)
ament_target_dependencies(
opencat_service_node
opencat_serial
rclcpp
opencat_msgs
opencat_serial
)

ament_export_dependencies(opencat_msgs)

install(
TARGETS opencat_service_node
DESTINATION lib/${PROJECT_NAME}
Expand Down
6 changes: 3 additions & 3 deletions opencat_server/include/opencat_server/opencat_server.hpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#ifndef OPENCAT_CONTROL_H_
#define OPENCAT_CONTROL_H_
#include "opencat/srv/base_task.hpp"
#include "opencat_msgs/srv/base_task.hpp"
#include "opencat_serial/opencat_serial.hpp"
#include <opencat/srv/detail/base_task__struct.hpp>
#include <opencat_msgs/srv/detail/base_task__struct.hpp>
#include <string>
#include <vector>
using namespace opencat::srv;
using namespace opencat_msgs::srv;
using std::vector;

namespace OpenCat
Expand Down
2 changes: 2 additions & 0 deletions opencat_server/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
<maintainer email="cc7@duck.com">C.C</maintainer>
<license>MIT</license>

<depend>rclcpp</depend>
<depend>opencat_msgs</depend>
<depend>opencat_serial</depend>
<buildtool_depend>ament_cmake</buildtool_depend>

Expand Down