Skip to content
Closed
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
2 changes: 2 additions & 0 deletions ros2_control/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
<exec_depend>controller_parameter_server</exec_depend>
<exec_depend>hardware_interface</exec_depend>

<exec_depend>ros2_control_core</exec_depend>

<export>
<build_type>ament_cmake</build_type>
</export>
Expand Down
96 changes: 96 additions & 0 deletions ros2_control_components/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
cmake_minimum_required(VERSION 3.5)
project(ros2_control_components)

# Default to C99
if(NOT CMAKE_C_STANDARD)
set(CMAKE_C_STANDARD 99)
endif()

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()

# find dependencies
find_package(ament_cmake REQUIRED)

find_package(pluginlib REQUIRED)
find_package(rclcpp REQUIRED)
find_package(ros2_control_core REQUIRED)
# # find_package(ros2_control_hardware REQUIRED)


## COMPILE
#Actuators
add_library(${PROJECT_NAME}_actuators SHARED
src/actuators/position_actuator.cpp
src/actuators/velocity_actuator.cpp
)

target_include_directories(${PROJECT_NAME}_actuators
PRIVATE include
)

ament_target_dependencies(${PROJECT_NAME}_actuators
pluginlib
rclcpp
ros2_control_core
)

#Sensors
add_library(${PROJECT_NAME}_sensors SHARED
src/sensors/position_sensor.cpp
src/sensors/velocity_sensor.cpp
)

target_include_directories(${PROJECT_NAME}_sensors
PRIVATE include
)

ament_target_dependencies(${PROJECT_NAME}_sensors
pluginlib
rclcpp
ros2_control_core
)


pluginlib_export_plugin_description_file(ros2_control_components ros2_control_components.xml)

## INSTALL
install(TARGETS ${PROJECT_NAME}_actuators ${PROJECT_NAME}_sensors
DESTINATION lib
)

install(DIRECTORY include/
DESTINATION include
)

## TESTS
if(BUILD_TESTING)
find_package(ament_cmake_gtest REQUIRED)

ament_add_gtest(test_dummy test/test_dummy.cpp)
target_include_directories(test_dummy PRIVATE include)
# ament_target_dependencies(test_dummy rcpputils)


# Uncomment this before creating a new PR to check code quality
# find_package(ament_lint_auto REQUIRED)
# ament_lint_auto_find_test_dependencies()
endif()

## EXPORTS
ament_export_dependencies(
pluginlib
rclcpp
ros2_control_core
)
ament_export_libraries(
${PROJECT_NAME}_actuators
${PROJECT_NAME}_sensors
)
ament_export_include_directories(
include
)
ament_package()

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Copyright 2020 ROS2-Control Development Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.


#ifndef ROS2_CONTROL_COMPONENTS__ACTUATORS_POSITION_ACTUATOR_HPP_
#define ROS2_CONTROL_COMPONENTS__ACTUATORS_POSITION_ACTUATOR_HPP_

#include "rclcpp/macros.hpp"

#include "ros2_control_components/visibility_control.h"
#include "ros2_control_core/components/actuator.hpp"

namespace ros2_control_components_actuators
{

class PositionActuator : public ros2_control_core_components::Actuator
{
public:
RCLCPP_SHARED_PTR_DEFINITIONS(PositionActuator);

ROS2_CONTROL_COMPONENTS_PUBLIC PositionActuator() = default;

ROS2_CONTROL_COMPONENTS_PUBLIC ~PositionActuator() = default;

ROS2_CONTROL_COMPONENTS_PUBLIC ros2_control_types::return_type configure(const std::string parameters_path, const rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr logging_interface, const rclcpp::node_interfaces::NodeParametersInterface::SharedPtr parameters_interface, const rclcpp::node_interfaces::NodeServicesInterface::SharedPtr services_interface);

};

} // namespace ros2_control_components_actuators

#endif // ROS2_CONTROL_COMPONENTS__ACTUATORS_POSITION_ACTUATOR_HPP_
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Copyright 2020 ROS2-Control Development Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.


#ifndef ROS2_CONTROL_COMPONENTS__ACTUATORS_VELOCITY_ACTUATOR_HPP_
#define ROS2_CONTROL_COMPONENTS__ACTUATORS_VELOCITY_ACTUATOR_HPP_

#include "rclcpp/macros.hpp"

#include "ros2_control_components/visibility_control.h"
#include "ros2_control_core/components/actuator.hpp"

namespace ros2_control_components_actuators
{

class VelocityActuator : public ros2_control_core_components::Actuator
{
public:
RCLCPP_SHARED_PTR_DEFINITIONS(VelocityActuator);

ROS2_CONTROL_COMPONENTS_PUBLIC VelocityActuator() = default;

ROS2_CONTROL_COMPONENTS_PUBLIC ~VelocityActuator() = default;

ROS2_CONTROL_COMPONENTS_PUBLIC ros2_control_types::return_type configure(const std::string parameters_path, const rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr logging_interface, const rclcpp::node_interfaces::NodeParametersInterface::SharedPtr parameters_interface, const rclcpp::node_interfaces::NodeServicesInterface::SharedPtr services_interface);

};

} // namespace ros2_control_components_actuators

#endif // ROS2_CONTROL_COMPONENTS__ACTUATORS_VELOCITY_ACTUATOR_HPP_
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Copyright 2020 ROS2-Control Development Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.


#ifndef ROS2_CONTROL_COMPONENTS__SENSORS_POSITION_SENSOR_HPP_
#define ROS2_CONTROL_COMPONENTS__SENSORS_POSITION_SENSOR_HPP_

#include "rclcpp/macros.hpp"

#include "ros2_control_components/visibility_control.h"
#include "ros2_control_core/components/sensor.hpp"

namespace ros2_control_components_sensors
{

class PositionSensor : public ros2_control_core_components::Sensor
{
public:
RCLCPP_SHARED_PTR_DEFINITIONS(PositionSensor);

ROS2_CONTROL_COMPONENTS_PUBLIC PositionSensor() = default;

ROS2_CONTROL_COMPONENTS_PUBLIC ~PositionSensor() = default;

ROS2_CONTROL_COMPONENTS_PUBLIC ros2_control_types::return_type configure(const std::string parameters_path, const rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr logging_interface, const rclcpp::node_interfaces::NodeParametersInterface::SharedPtr parameters_interface, const rclcpp::node_interfaces::NodeServicesInterface::SharedPtr services_interface);

};

} // namespace ros2_control_components_sensors

#endif // ROS2_CONTROL_COMPONENTS__SENSORS_POSITION_SENSOR_HPP_
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Copyright 2020 ROS2-Control Development Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.


#ifndef ROS2_CONTROL_COMPONENTS__SENSORS_VELOCITY_SENSOR_HPP_
#define ROS2_CONTROL_COMPONENTS__SENSORS_VELOCITY_SENSOR_HPP_

#include "rclcpp/macros.hpp"

#include "ros2_control_components/visibility_control.h"
#include "ros2_control_core/components/sensor.hpp"

namespace ros2_control_components_sensors
{

class VelocitySensor : public ros2_control_core_components::Sensor
{
public:
RCLCPP_SHARED_PTR_DEFINITIONS(VelocitySensor);

ROS2_CONTROL_COMPONENTS_PUBLIC VelocitySensor() = default;

ROS2_CONTROL_COMPONENTS_PUBLIC ~VelocitySensor() = default;

ROS2_CONTROL_COMPONENTS_PUBLIC ros2_control_types::return_type configure(const std::string parameters_path, const rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr logging_interface, const rclcpp::node_interfaces::NodeParametersInterface::SharedPtr parameters_interface, const rclcpp::node_interfaces::NodeServicesInterface::SharedPtr services_interface);

};

} // namespace ros2_control_components_sensors

#endif // ROS2_CONTROL_COMPONENTS__SENSORS_VELOCITY_SENSOR_HPP_
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Copyright 2020 ROS2-Control Development Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/* This header must be included by all rclcpp headers which declare symbols
* which are defined in the rclcpp library. When not building the rclcpp
* library, i.e. when using the headers in other package's code, the contents
* of this header change the visibility of certain symbols which the rclcpp
* library cannot have, but the consuming code must have inorder to link.
*/

#ifndef ROS2_CONTROL_COMPONENTS__VISIBILITY_CONTROL_H_
#define ROS2_CONTROL_COMPONENTS__VISIBILITY_CONTROL_H_

// This logic was borrowed (then namespaced) from the examples on the gcc wiki:
// https://gcc.gnu.org/wiki/Visibility

#if defined _WIN32 || defined __CYGWIN__
#ifdef __GNUC__
#define ROS2_CONTROL_COMPONENTS_EXPORT \
__attribute__((dllexport))
#define ROS2_CONTROL_COMPONENTS_IMPORT \
__attribute__((dllimport))
#else
#define ROS2_CONTROL_COMPONENTS_EXPORT __declspec(dllexport)
#define ROS2_CONTROL_COMPONENTS_IMPORT __declspec(dllimport)
#endif
#ifdef ROS2_CONTROL_COMPONENTS_BUILDING_DLL
#define ROS2_CONTROL_COMPONENTS_PUBLIC \
ROS2_CONTROL_COMPONENTS_EXPORT
#else
#define ROS2_CONTROL_COMPONENTS_PUBLIC \
ROS2_CONTROL_COMPONENTS_IMPORT
#endif
#define ROS2_CONTROL_COMPONENTS_PUBLIC_TYPE \
ROS2_CONTROL_COMPONENTS_PUBLIC
#define ROS2_CONTROL_COMPONENTS_LOCAL
#else
#define ROS2_CONTROL_COMPONENTS_EXPORT \
__attribute__((visibility("default")))
#define ROS2_CONTROL_COMPONENTS_IMPORT
#if __GNUC__ >= 4
#define ROS2_CONTROL_COMPONENTS_PUBLIC \
__attribute__((visibility("default")))
#define ROS2_CONTROL_COMPONENTS_LOCAL \
__attribute__((visibility("hidden")))
#else
#define ROS2_CONTROL_COMPONENTS_PUBLIC
#define ROS2_CONTROL_COMPONENTS_LOCAL
#endif
#define ROS2_CONTROL_COMPONENTS_PUBLIC_TYPE
#endif

#endif // ROS2_CONTROL_COMPONENTS__VISIBILITY_CONTROL_H_
21 changes: 21 additions & 0 deletions ros2_control_components/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?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>ros2_control_components</name>
<version>0.0.0</version>
<description>The package with implementation of virtual robotic components for `ros2_control`-concept.</description>
<maintainer email="denis@stogl.de">stogl</maintainer>
<license>TODO: License declaration</license>

<maintainer email="denis@stogl.de">Denis Štogl</maintainer>

<depend>pluginlib</depend>
<depend>rclcpp</depend>
<depend>ros2_control_core</depend>

<test_depend>ament_cmake_gtest</test_depend>

<export>
<build_type>ament_cmake</build_type>
</export>
</package>
25 changes: 25 additions & 0 deletions ros2_control_components/ros2_control_components.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<library path="ros2_control_components_actuators">
<class name="ros2_control_components/VelocityActuator" type="ros2_control_components_actuators::VelocityActuator" base_class_type="ros2_control_core_components::Actuator">
<description>
The velocity actuator provides virtual representation of velocity-only actuators.
</description>
</class>
<class name="ros2_control_components/PositionActuator" type="ros2_control_components_actuators::PositionActuator" base_class_type="ros2_control_core_components::Actuator">
<description>
The velocity actuator provides virtual representation of position-only actuators.
</description>
</class>
</library>

<library path="ros2_control_components_sensors">
<class name="ros2_control_components/VelocitySensor" type="ros2_control_components_sensors::VelocitySensor" base_class_type="ros2_control_core_components::Sensor">
<description>
The velocity sensor provides virtual representation of velocity-only sensors.
</description>
</class>
<class name="ros2_control_components/PositionSensor" type="ros2_control_components_sensors::PositionSensor" base_class_type="ros2_control_core_components::Sensor">
<description>
The velocity sensor provides virtual representation of position-only sensors.
</description>
</class>
</library>
Loading