Skip to content

Commit 3586843

Browse files
authored
twist_controller -> picknik_twist_controller (#3)
* twist_controller -> picknik_twist_controller 1. prefix twist_controller with picknik_twist_controller When we merge twist_controller into ros2_controllers we can depricate this one and not have naming conflicts as users migrate * cmake: 3.8 -> 3.16 bump to oldest version used on Ubuntu Focal + ROS 2 Humble https://www.ros.org/reps/rep-2000.html#humble-hawksbill-may-2022-may-2027 --------- Signed-off-by: Alex Moriarty <[email protected]>
1 parent af740ca commit 3586843

File tree

10 files changed

+99
-94
lines changed

10 files changed

+99
-94
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ We plan to land this upstream in ros2_controllers: https://github.com/ros-contro
1414
### Usage
1515
Example of instance within `ros2_control` can be found in the [configuration file](https://github.com/PickNikRobotics/ros2_kortex/blob/main/kortex_description/arms/gen3/7dof/config/ros2_controllers.yaml).
1616
Defined interfaces have to exist within the `hardware_interface::SystemInterface` implemented for the robot (e.g. driver).
17-
Stop any commanding controller and then start `TwistController`to use kinova's builtin cartesian twist controller.
17+
Stop any commanding controller and then start `PicknikTwistController`to forward twist msgs to the hardware's built-in cartesian twist controller.
1818

1919
#### Note on controllers
2020
Exclusiveness logic is within the driver, and running joint-based and twist controller at the same time is not possible.

picknik_reset_fault_controller/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.8)
1+
cmake_minimum_required(VERSION 3.16)
22
project(picknik_reset_fault_controller)
33

44
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
cmake_minimum_required(VERSION 3.8)
2-
project(twist_controller)
1+
cmake_minimum_required(VERSION 3.16)
2+
project(picknik_twist_controller)
33

44
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
55
add_compile_options(-Wall -Wextra -Wpedantic)
@@ -23,7 +23,7 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS
2323

2424
include_directories(include)
2525

26-
add_library(${PROJECT_NAME} SHARED src/twist_controller.cpp)
26+
add_library(${PROJECT_NAME} SHARED src/picknik_twist_controller.cpp)
2727
target_include_directories(${PROJECT_NAME} PRIVATE
2828
include
2929
)
@@ -34,7 +34,7 @@ ament_target_dependencies(${PROJECT_NAME}
3434

3535
# Causes the visibility macros to use dllexport rather than dllimport,
3636
# which is appropriate when building the dll but not consuming it.
37-
target_compile_definitions(${PROJECT_NAME} PRIVATE "KORTEX2_CONTROLLERS_BUILDING_LIBRARY")
37+
target_compile_definitions(${PROJECT_NAME} PRIVATE "PICKNIK_TWIST_CONTROLLER_BUILDING_LIBRARY")
3838
pluginlib_export_plugin_description_file(controller_interface controller_plugins.xml)
3939

4040
install(TARGETS ${PROJECT_NAME}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<library path="picknik_twist_controler">
2+
<class name="picknik_twist_controler/PicknikTwistControler" type="picknik_twist_controler::PicknikTwistControler" base_class_type="controller_interface::ControllerInterface">
3+
<description>
4+
Subscribes to twist msg and forwards to hardware
5+
</description>
6+
</class>
7+
</library>

twist_controller/include/twist_controller/twist_controller.hpp renamed to picknik_twist_controller/include/picknik_twist_controller/picknik_twist_controller.hpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,48 +21,48 @@
2121
*/
2222
//----------------------------------------------------------------------
2323

24-
#ifndef TWIST_CONTROLLER__TWIST_CONTROLLER_HPP_
25-
#define TWIST_CONTROLLER__TWIST_CONTROLLER_HPP_
24+
#ifndef PICKNIK_TWIST_CONTROLLER__PICKNIK_TWIST_CONTROLLER_HPP_
25+
#define PICKNIK_TWIST_CONTROLLER__PICKNIK_TWIST_CONTROLLER_HPP_
2626

2727
#include <memory>
2828
#include <string>
2929
#include <vector>
3030

3131
#include "controller_interface/controller_interface.hpp"
3232
#include "geometry_msgs/msg/twist_stamped.hpp"
33+
#include "picknik_twist_controller/visibility_control.h"
3334
#include "realtime_tools/realtime_buffer.h"
34-
#include "twist_controller/visibility_control.h"
3535

36-
namespace twist_controller
36+
namespace picknik_twist_controller
3737
{
3838
using CmdType = geometry_msgs::msg::TwistStamped;
3939
using CallbackReturn = rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn;
4040

41-
class TwistController : public controller_interface::ControllerInterface
41+
class PicknikTwistControler : public controller_interface::ControllerInterface
4242
{
4343
public:
44-
TWIST_CONTROLLER_PUBLIC
45-
TwistController();
44+
PICKNIK_TWIST_CONTROLLER_PUBLIC
45+
PicknikTwistControler();
4646

47-
TWIST_CONTROLLER_PUBLIC
47+
PICKNIK_TWIST_CONTROLLER_PUBLIC
4848
controller_interface::InterfaceConfiguration command_interface_configuration() const override;
4949

50-
TWIST_CONTROLLER_PUBLIC
50+
PICKNIK_TWIST_CONTROLLER_PUBLIC
5151
controller_interface::InterfaceConfiguration state_interface_configuration() const override;
5252

53-
TWIST_CONTROLLER_PUBLIC
53+
PICKNIK_TWIST_CONTROLLER_PUBLIC
5454
CallbackReturn on_init() override;
5555

56-
TWIST_CONTROLLER_PUBLIC
56+
PICKNIK_TWIST_CONTROLLER_PUBLIC
5757
CallbackReturn on_configure(const rclcpp_lifecycle::State & previous_state) override;
5858

59-
TWIST_CONTROLLER_PUBLIC
59+
PICKNIK_TWIST_CONTROLLER_PUBLIC
6060
CallbackReturn on_activate(const rclcpp_lifecycle::State & previous_state) override;
6161

62-
TWIST_CONTROLLER_PUBLIC
62+
PICKNIK_TWIST_CONTROLLER_PUBLIC
6363
CallbackReturn on_deactivate(const rclcpp_lifecycle::State & previous_state) override;
6464

65-
TWIST_CONTROLLER_PUBLIC
65+
PICKNIK_TWIST_CONTROLLER_PUBLIC
6666
controller_interface::return_type update(
6767
const rclcpp::Time & time, const rclcpp::Duration & period) override;
6868

@@ -76,6 +76,6 @@ class TwistController : public controller_interface::ControllerInterface
7676
std::string logger_name_;
7777
};
7878

79-
} // namespace twist_controller
79+
} // namespace picknik_twist_controller
8080

81-
#endif // TWIST_CONTROLLER__TWIST_CONTROLLER_HPP_
81+
#endif // PICKNIK_TWIST_CONTROLLER__PICKNIK_TWIST_CONTROLLER_HPP_
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// Copyright 2021, PickNik Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#ifndef PICKNIK_TWIST_CONTROLLER__VISIBILITY_CONTROL_H_
16+
#define PICKNIK_TWIST_CONTROLLER__VISIBILITY_CONTROL_H_
17+
18+
// This logic was borrowed (then namespaced) from the examples on the gcc wiki:
19+
// https://gcc.gnu.org/wiki/Visibility
20+
21+
#if defined _WIN32 || defined __CYGWIN__
22+
#ifdef __GNUC__
23+
#define PICKNIK_TWIST_CONTROLLER_EXPORT __attribute__((dllexport))
24+
#define PICKNIK_TWIST_CONTROLLER_IMPORT __attribute__((dllimport))
25+
#else
26+
#define PICKNIK_TWIST_CONTROLLER_EXPORT __declspec(dllexport)
27+
#define PICKNIK_TWIST_CONTROLLER_IMPORT __declspec(dllimport)
28+
#endif
29+
#ifdef PICKNIK_TWIST_CONTROLLER_BUILDING_LIBRARY
30+
#define PICKNIK_TWIST_CONTROLLER_PUBLIC PICKNIK_TWIST_CONTROLLER_EXPORT
31+
#else
32+
#define PICKNIK_TWIST_CONTROLLER_PUBLIC PICKNIK_TWIST_CONTROLLER_IMPORT
33+
#endif
34+
#define PICKNIK_TWIST_CONTROLLER_PUBLIC_TYPE PICKNIK_TWIST_CONTROLLER_PUBLIC
35+
#define PICKNIK_TWIST_CONTROLLER_LOCAL
36+
#else
37+
#define PICKNIK_TWIST_CONTROLLER_EXPORT __attribute__((visibility("default")))
38+
#define PICKNIK_TWIST_CONTROLLER_IMPORT
39+
#if __GNUC__ >= 4
40+
#define PICKNIK_TWIST_CONTROLLER_PUBLIC __attribute__((visibility("default")))
41+
#define PICKNIK_TWIST_CONTROLLER_LOCAL __attribute__((visibility("hidden")))
42+
#else
43+
#define PICKNIK_TWIST_CONTROLLER_PUBLIC
44+
#define PICKNIK_TWIST_CONTROLLER_LOCAL
45+
#endif
46+
#define PICKNIK_TWIST_CONTROLLER_PUBLIC_TYPE
47+
#endif
48+
49+
#endif // PICKNIK_TWIST_CONTROLLER__VISIBILITY_CONTROL_H_
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?xml version="1.0"?>
22
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
33
<package format="3">
4-
<name>twist_controller</name>
4+
<name>picknik_twist_controller</name>
55
<version>0.0.0</version>
6-
<description>TODO: Package description</description>
6+
<description>Subscribes to twist msg and forwards to hardware</description>
77
<maintainer email="[email protected]">lovro</maintainer>
8-
<license>TODO: License declaration</license>
8+
<license>Apache-2.0</license>
99

1010
<buildtool_depend>ament_cmake_ros</buildtool_depend>
1111

twist_controller/src/twist_controller.cpp renamed to picknik_twist_controller/src/picknik_twist_controller.cpp

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*/
2222
//----------------------------------------------------------------------
2323

24-
#include "twist_controller/twist_controller.hpp"
24+
#include "picknik_twist_controller/picknik_twist_controller.hpp"
2525

2626
#include <memory>
2727
#include <string>
@@ -30,19 +30,19 @@
3030
#include "controller_interface/helpers.hpp"
3131
#include "hardware_interface/loaned_command_interface.hpp"
3232

33-
namespace twist_controller
33+
namespace picknik_twist_controller
3434
{
3535
using hardware_interface::LoanedCommandInterface;
3636

37-
TwistController::TwistController()
37+
PicknikTwistControler::PicknikTwistControler()
3838
: controller_interface::ControllerInterface(),
3939
rt_command_ptr_(nullptr),
4040
twist_command_subscriber_(nullptr)
4141
{
4242
}
4343

44-
controller_interface::InterfaceConfiguration TwistController::command_interface_configuration()
45-
const
44+
controller_interface::InterfaceConfiguration
45+
PicknikTwistControler::command_interface_configuration() const
4646
{
4747
controller_interface::InterfaceConfiguration command_interfaces_config;
4848
command_interfaces_config.type = controller_interface::interface_configuration_type::INDIVIDUAL;
@@ -55,13 +55,14 @@ controller_interface::InterfaceConfiguration TwistController::command_interface_
5555
return command_interfaces_config;
5656
}
5757

58-
controller_interface::InterfaceConfiguration TwistController::state_interface_configuration() const
58+
controller_interface::InterfaceConfiguration PicknikTwistControler::state_interface_configuration()
59+
const
5960
{
6061
return controller_interface::InterfaceConfiguration{
6162
controller_interface::interface_configuration_type::NONE};
6263
}
6364

64-
CallbackReturn TwistController::on_init()
65+
CallbackReturn PicknikTwistControler::on_init()
6566
{
6667
try
6768
{
@@ -78,7 +79,8 @@ CallbackReturn TwistController::on_init()
7879
return CallbackReturn::SUCCESS;
7980
}
8081

81-
CallbackReturn TwistController::on_configure(const rclcpp_lifecycle::State & /*previous_state*/)
82+
CallbackReturn PicknikTwistControler::on_configure(
83+
const rclcpp_lifecycle::State & /*previous_state*/)
8284
{
8385
joint_name_ = get_node()->get_parameter("joint").as_string();
8486

@@ -108,21 +110,23 @@ CallbackReturn TwistController::on_configure(const rclcpp_lifecycle::State & /*p
108110
return CallbackReturn::SUCCESS;
109111
}
110112

111-
CallbackReturn TwistController::on_activate(const rclcpp_lifecycle::State & /*previous_state*/)
113+
CallbackReturn PicknikTwistControler::on_activate(
114+
const rclcpp_lifecycle::State & /*previous_state*/)
112115
{
113116
// reset command buffer if a command came through callback when controller was inactive
114117
rt_command_ptr_ = realtime_tools::RealtimeBuffer<std::shared_ptr<CmdType>>(nullptr);
115118
return CallbackReturn::SUCCESS;
116119
}
117120

118-
CallbackReturn TwistController::on_deactivate(const rclcpp_lifecycle::State & /*previous_state*/)
121+
CallbackReturn PicknikTwistControler::on_deactivate(
122+
const rclcpp_lifecycle::State & /*previous_state*/)
119123
{
120124
// reset command buffer
121125
rt_command_ptr_ = realtime_tools::RealtimeBuffer<std::shared_ptr<CmdType>>(nullptr);
122126
return CallbackReturn::SUCCESS;
123127
}
124128

125-
controller_interface::return_type TwistController::update(
129+
controller_interface::return_type PicknikTwistControler::update(
126130
const rclcpp::Time & /*time*/, const rclcpp::Duration & /*period*/)
127131
{
128132
auto twist_commands = rt_command_ptr_.readFromRT();
@@ -150,8 +154,9 @@ controller_interface::return_type TwistController::update(
150154

151155
return controller_interface::return_type::OK;
152156
}
153-
} // namespace twist_controller
157+
} // namespace picknik_twist_controller
154158

155159
#include "pluginlib/class_list_macros.hpp"
156160

157-
PLUGINLIB_EXPORT_CLASS(twist_controller::TwistController, controller_interface::ControllerInterface)
161+
PLUGINLIB_EXPORT_CLASS(
162+
picknik_twist_controller::PicknikTwistControler, controller_interface::ControllerInterface)

twist_controller/controller_plugins.xml

Lines changed: 0 additions & 7 deletions
This file was deleted.

twist_controller/include/twist_controller/visibility_control.h

Lines changed: 0 additions & 49 deletions
This file was deleted.

0 commit comments

Comments
 (0)