Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/fri wrench control #179

Open
wants to merge 33 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
f36d0a2
add forward wrench controller to kuka controllers
krmihaly Aug 1, 2024
c2a52c4
add cartesian impedance controller for stifness/damping values
krmihaly Aug 1, 2024
56834f2
add cart imp ctr mode, wrench cmd mode to fri_connection; use wrench …
krmihaly Aug 1, 2024
0644001
seperate joint and cart stiffness and damping, fix s/d values not bei…
krmihaly Aug 2, 2024
65edcb7
wrench control impedance size fix, remove init in controller
krmihaly Aug 6, 2024
5897bd0
refactor impedance values publishing
krmihaly Aug 6, 2024
41d9914
robot application add cartesian impedance control mode
krmihaly Aug 6, 2024
ef7c966
format
krmihaly Aug 6, 2024
3023104
Merge commit '41d9914350c3c2a0bb19ca1bde0d412301c85302' into feature/…
krmihaly Aug 6, 2024
78360e5
format java
krmihaly Aug 6, 2024
84db233
typos, parameter set access rights changed, constexpressions added
krmihaly Aug 7, 2024
91fb08b
comment, exec depend
krmihaly Aug 7, 2024
e566cdc
wrench control interface joint names change, refactor export control …
krmihaly Aug 9, 2024
5ac53a8
wrench config typo
krmihaly Aug 26, 2024
9aef28d
industrial ci upstream robot description branch to fri wrench control
krmihaly Aug 26, 2024
e82711c
branch typo
krmihaly Aug 26, 2024
c8ef56e
sorry I stole your branch
Aug 29, 2024
ebc181e
Revert "sorry I stole your branch"
Aug 29, 2024
360b3fb
send period < 5 ms is not needed in joint impedance mode
krmihaly Sep 16, 2024
0d60f9e
publish impedance config values after controllers start
krmihaly Sep 19, 2024
746efeb
add impedance commands to wrench mode
krmihaly Sep 20, 2024
ac33516
fromat
krmihaly Sep 20, 2024
a64a563
removed friction compensation
krmihaly Sep 20, 2024
be90c17
send period < 5 ms is not needed in joint impedance mode
krmihaly Sep 16, 2024
b1a458c
publish impedance config values after controllers start
krmihaly Sep 19, 2024
ba2dafb
add impedance commands to wrench mode
krmihaly Sep 20, 2024
c6a6dd0
fromat
krmihaly Sep 20, 2024
f29d295
removed friction compensation
krmihaly Sep 20, 2024
427deec
Merge commit 'a64a5637468e8b47519f23dd1d940312b2024838' into feature/…
krmihaly Sep 20, 2024
bfacd30
update wiki
krmihaly Oct 14, 2024
f1753e9
Merge branch 'master' into feature/fri_wrench_control
krmihaly Oct 14, 2024
080dc21
udate wiki
krmihaly Oct 14, 2024
92d3ad5
format
krmihaly Oct 17, 2024
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
1 change: 1 addition & 0 deletions controllers/kuka_controllers/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<exec_depend>fri_configuration_controller</exec_depend>
<exec_depend>fri_state_broadcaster</exec_depend>
<exec_depend>joint_group_impedance_controller</exec_depend>
<exec_depend>wrench_controller</exec_depend>

<export>
<build_type>ament_cmake</build_type>
Expand Down
16 changes: 16 additions & 0 deletions controllers/wrench_controller/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Changelog for package wrench_controller
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0.9.2 (2024-07-10)
------------------
* Fix GCC warning causing unstable build

0.9.1 (2024-07-08)
------------------
* Add missing test dependency

0.9.0 (2024-07-08)
------------------
* Add controller for updating stiffness and damping command interfaces
* Contributors: Aron Svastits
69 changes: 69 additions & 0 deletions controllers/wrench_controller/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
cmake_minimum_required(VERSION 3.5)
project(wrench_controller)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra)
endif()

find_package(ament_cmake REQUIRED)
find_package(pluginlib REQUIRED)
find_package(forward_command_controller)
find_package(kuka_drivers_core)
find_package(generate_parameter_library)

include_directories(include)

generate_parameter_library(
wrench_controller_parameters
src/wrench_controller_parameters.yaml
)

add_library(${PROJECT_NAME} SHARED
src/wrench_controller.cpp)

target_include_directories(${PROJECT_NAME} PRIVATE
include
)

ament_target_dependencies(${PROJECT_NAME} forward_command_controller kuka_drivers_core
)
target_link_libraries(${PROJECT_NAME} wrench_controller_parameters)

# Causes the visibility macros to use dllexport rather than dllimport,
# which is appropriate when building the dll but not consuming it.
target_compile_definitions(${PROJECT_NAME} PRIVATE "WRENCH_CONTROLLER_BUILDING_LIBRARY")
# prevent pluginlib from using boost
target_compile_definitions(${PROJECT_NAME} PUBLIC "PLUGINLIB__DISABLE_BOOST_FUNCTIONS")

pluginlib_export_plugin_description_file(controller_interface controller_plugins.xml)

install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)

install(DIRECTORY include/
DESTINATION include
)

install(FILES controller_plugins.xml
DESTINATION share/${PROJECT_NAME}
)

if(BUILD_TESTING)

endif()

ament_export_include_directories(include)
ament_export_libraries(${PROJECT_NAME})

ament_export_include_directories(
include
)

ament_export_libraries(
${PROJECT_NAME}
)

ament_package()
7 changes: 7 additions & 0 deletions controllers/wrench_controller/controller_plugins.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<library path="wrench_controller">
<class name="kuka_controllers/WrenchController" type="kuka_controllers::WrenchController" base_class_type="controller_interface::ControllerInterface">
<description>
This controller forwards the wrench commands in real time
</description>
</class>
</library>
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Copyright 2023 Aron Svastits
Svastits marked this conversation as resolved.
Show resolved Hide resolved
//
// 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 WRENCH_CONTROLLER__VISIBILITY_CONTROL_H_
#define WRENCH_CONTROLLER__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 WRENCH_CONTROLLER_EXPORT __attribute__((dllexport))
#define WRENCH_CONTROLLER_IMPORT __attribute__((dllimport))
#else
#define WRENCH_CONTROLLER_EXPORT __declspec(dllexport)
#define WRENCH_CONTROLLER_IMPORT __declspec(dllimport)
#endif
#ifdef WRENCH_CONTROLLER_BUILDING_LIBRARY
#define WRENCH_CONTROLLER_PUBLIC WRENCH_CONTROLLER_EXPORT
#else
#define WRENCH_CONTROLLER_PUBLIC WRENCH_CONTROLLER_IMPORT
#endif
#define WRENCH_CONTROLLER_PUBLIC_TYPE WRENCH_CONTROLLER_PUBLIC
#define WRENCH_CONTROLLER_LOCAL
#else
#define WRENCH_CONTROLLER_EXPORT __attribute__((visibility("default")))
#define WRENCH_CONTROLLER_IMPORT
#if __GNUC__ >= 4
#define WRENCH_CONTROLLER_PUBLIC __attribute__((visibility("default")))
#define WRENCH_CONTROLLER_LOCAL __attribute__((visibility("hidden")))
#else
#define WRENCH_CONTROLLER_PUBLIC
#define WRENCH_CONTROLLER_LOCAL
#endif
#define WRENCH_CONTROLLER_PUBLIC_TYPE
#endif

#endif // WRENCH_CONTROLLER__VISIBILITY_CONTROL_H_
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright 2022 Aron Svastits
//
// 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 WRENCH_CONTROLLER__WRENCH_CONTROLLER_HPP_
#define WRENCH_CONTROLLER__WRENCH_CONTROLLER_HPP_

#include <memory>
#include <string>
#include <vector>

#include "forward_command_controller/multi_interface_forward_command_controller.hpp"

#include "wrench_controller/visibility_control.h"
#include "wrench_controller_parameters.hpp"

namespace kuka_controllers
{
class WrenchController : public forward_command_controller::ForwardControllersBase
{
public:
WRENCH_CONTROLLER_PUBLIC WrenchController();

private:
WRENCH_CONTROLLER_LOCAL void declare_parameters() override;
WRENCH_CONTROLLER_LOCAL controller_interface::CallbackReturn read_parameters() override;

using Params = wrench_controller::Params;
using ParamListener = wrench_controller::ParamListener;

std::shared_ptr<ParamListener> param_listener_;
Params params_;
};
} // namespace kuka_controllers
#endif // WRENCH_CONTROLLER__WRENCH_CONTROLLER_HPP_
22 changes: 22 additions & 0 deletions controllers/wrench_controller/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?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>wrench_controller</name>
<version>0.9.2</version>
<description>Controller for forwarding wrench commands</description>

<maintainer email="[email protected]">Mihaly Kristofi</maintainer>
Svastits marked this conversation as resolved.
Show resolved Hide resolved

<license>Apache-2.0</license>

<buildtool_depend>ament_cmake</buildtool_depend>

<depend>forward_command_controller</depend>
<depend>pluginlib</depend>
<depend>kuka_drivers_core</depend>
<depend>generate_parameter_library</depend>

<export>
<build_type>ament_cmake</build_type>
</export>
</package>
66 changes: 66 additions & 0 deletions controllers/wrench_controller/src/wrench_controller.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// Copyright 2022 Aron Svastits
//
// 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.

#include "pluginlib/class_list_macros.hpp"

#include "kuka_drivers_core/hardware_interface_types.hpp"

#include "wrench_controller/wrench_controller.hpp"

namespace kuka_controllers
{

WrenchController::WrenchController() : ForwardControllersBase() {}

void WrenchController::declare_parameters()
{
param_listener_ = std::make_shared<ParamListener>(get_node());
}

controller_interface::CallbackReturn WrenchController::read_parameters()
{
if (!param_listener_)
{
RCLCPP_ERROR(get_node()->get_logger(), "Error encountered during init");
return controller_interface::CallbackReturn::ERROR;
}
params_ = param_listener_->get_params();

if (params_.joints.empty())
{
RCLCPP_ERROR(get_node()->get_logger(), "'joints' parameter is empty");
return controller_interface::CallbackReturn::ERROR;
}

if (params_.interface_names.empty())
{
RCLCPP_ERROR(get_node()->get_logger(), "'interfaces' parameter is empty");
return controller_interface::CallbackReturn::ERROR;
}

for (const auto & joint : params_.joints)
{
for (const auto & interface : params_.interface_names)
{
command_interface_types_.push_back(joint + "/" + interface);
}
}

return controller_interface::CallbackReturn::SUCCESS;
}

} // namespace kuka_controllers

PLUGINLIB_EXPORT_CLASS(
kuka_controllers::WrenchController, controller_interface::ControllerInterface)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
wrench_controller:
joints: {
type: string_array,
default_value: [],
description: "Name of the joints to control",
}
interface_names: {
type: string_array,
default_value: [],
description: "Names of the interfaces to command",
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ static constexpr char FRI_STATE_BROADCASTER[] = "fri_state_broadcaster";
// Controller names with default values
static constexpr char JOINT_TRAJECTORY_CONTROLLER[] = "joint_trajectory_controller";
static constexpr char JOINT_GROUP_IMPEDANCE_CONTROLLER[] = "joint_group_impedance_controller";
static constexpr char CARTESIAN_IMPEDANCE_CONTROLLER[] = "cartesian_impedance_controller";

} // namespace kuka_drivers_core

#endif // KUKA_DRIVERS_CORE__CONTROLLER_NAMES_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ static constexpr char HW_IF_DAMPING[] = "damping";
// Constant defining external torque interface
static constexpr char HW_IF_EXTERNAL_TORQUE[] = "external_torque";

// Constand defining cartesian coordinate interfaces
static constexpr char HW_IF_X[] = "x";
static constexpr char HW_IF_Y[] = "y";
static constexpr char HW_IF_Z[] = "z";

/* Interface prefixes */
// Constant defining prefix for I/O interfaces
static constexpr char IO_PREFIX[] = "gpio";
Expand All @@ -34,7 +39,10 @@ static constexpr char CONFIG_PREFIX[] = "runtime_config";
static constexpr char FRI_STATE_PREFIX[] = "fri_state";
// Constant defining prefix for states
static constexpr char STATE_PREFIX[] = "state";

// Constant defining wrench interface prefixes
static constexpr char HW_IF_WRENCH_PREFIX[] = "wrench";
static constexpr char HW_IF_FORCE_PREFIX[] = "force";
static constexpr char HW_IF_TORQUE_PREFIX[] = "torque";
/* Configuration interfaces */
// Constant defining control_mode configuration interface
static constexpr char CONTROL_MODE[] = "control_mode";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cartesian_impedance_controller:
ros__parameters:
joints:
- CartDOF.X
Svastits marked this conversation as resolved.
Show resolved Hide resolved
- CartDOF.Y
- CartDOF.Z
- CartDOF.A
- CartDOF.B
- CartDOF.C
7 changes: 5 additions & 2 deletions kuka_sunrise_fri_driver/config/driver_config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
robot_manager:
ros__parameters:
control_mode: 1
Svastits marked this conversation as resolved.
Show resolved Hide resolved
control_mode: 8
position_controller_name: "joint_trajectory_controller"
torque_controller_name: "effort_controller"
wrench_controller_name: "wrench_controller"
receive_multiplier: 1
send_period_ms: 10
send_period_ms: 5
joint_damping: [0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7]
joint_stiffness: [100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0]
cartesian_damping: [0.7, 0.7, 0.7, 0.7, 0.7, 0.7]
cartesian_stiffness: [2000.0, 2000.0, 2000.0, 200.0, 200.0, 200.0]
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
controller_manager:
ros__parameters:
update_rate: 100 # Hz
update_rate: 200 # Hz

joint_trajectory_controller:
type: joint_trajectory_controller/JointTrajectoryController
Expand All @@ -12,10 +12,14 @@ controller_manager:
type: kuka_controllers/FRIStateBroadcaster
event_broadcaster:
type: kuka_controllers/EventBroadcaster
wrench_controller:
type: kuka_controllers/WrenchController

# Configuration controllers
joint_group_impedance_controller:
type: kuka_controllers/JointGroupImpedanceController
cartesian_impedance_controller:
type: kuka_controllers/JointGroupImpedanceController
fri_configuration_controller:
type: kuka_controllers/FRIConfigurationController
control_mode_handler:
Expand Down
12 changes: 12 additions & 0 deletions kuka_sunrise_fri_driver/config/wrench_controller_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
wrench_controller:
ros__parameters:
joints:
- wrench

interface_names:
- force/x
- force/z
- force/y
- torque/x
- torque/y
- torque/z
Loading
Loading