Skip to content

add basic CI tests #26

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

Merged
merged 14 commits into from
Aug 6, 2024
Merged
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
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ jobs:
vcs import src < src/cartesian_controllers_ros2/cartesian_controllers_ros2.repos
rosdep install --ignore-src --from-paths . -y -r
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release --symlink-install
source install/setup.bash
colcon test --event-handlers console_direct+
colcon test-result

Expand Down
4 changes: 3 additions & 1 deletion cartesian_vic_controller/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,15 @@ target_compile_definitions(cartesian_vic_controller PRIVATE "CARTESIAN_VIC_CONTR
pluginlib_export_plugin_description_file(controller_interface cartesian_vic_controller.xml)
pluginlib_export_plugin_description_file(cartesian_vic_controller cartesian_vic_rules.xml)

if(0) # (BUILD_TESTING)
if(BUILD_TESTING)
find_package(ament_cmake_gmock REQUIRED)
find_package(controller_manager REQUIRED)
find_package(ros2_control_test_assets REQUIRED)

# Dynamically loaded during test
find_package(kinematics_interface_kdl REQUIRED)

#[[
# test controller (loading only)
add_rostest_with_parameters_gmock(test_load_controller
test/test_load_controller.cpp
Expand All @@ -87,6 +88,7 @@ if(0) # (BUILD_TESTING)
hardware_interface
ros2_control_test_assets
)
#]]

# test controller
add_rostest_with_parameters_gmock(test_controller
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
cartesian_vic_controller:
cartesian_impedance_controller:
ros__parameters:
command_interfaces:
- position
# - velocity
- velocity
state_interfaces:
- position
- velocity
Expand All @@ -13,17 +12,21 @@ cartesian_vic_controller:
- joint_a4
- joint_a5
- joint_a6
- joint_a7

# Parameters for the controller
# Note: having ".0" at the end of float is a MUST, otherwise there is a loading error

filters:
state_position_filter_cuttoff_freq: 100.0
state_position_filter_cuttoff_freq: -1.0
state_velocity_filter_cuttoff_freq: 100.0
command_filter_cuttoff_freq: -1.0
ft_sensor_filter_cuttoff_freq: 30.0

dynamics:
plugin_name: kinematics_interface_kdl/KinematicsInterfaceKDL
plugin_package: kinematics_interface
base: base_link # Assumed to be stationary
plugin_name: dynamics_interface_kdl/DynamicsInterfaceKDL
plugin_package: dynamics_interface
base: iiwa_base # Assumed to be stationary
tip: interaction_point
alpha: 0.0005
gravity: [0.0, 0.0, -9.81]
Expand All @@ -41,33 +44,37 @@ cartesian_vic_controller:

control:
frame:
id: interaction_point # Vic calcs (displacement etc) are done in this frame. Usually the tool or end-effector
id: interaction_point # Admittance calcs (displacement etc) are done in this frame. Usually the tool or end-effector
external: false # control frame exists within URDF kinematic chain

fixed_world_frame: # Gravity points down (neg. Z) in this frame (Usually: world or base_link)
frame:
id: world # Vic calcs (displacement etc) are done in this frame. Usually the tool or end-effector
external: false # control frame exists within URDF kinematic chain
id: iiwa_base
external: false

gravity_compensation:
frame:
id: ft_sensor
external: false

CoG: # specifies the center of gravity of the end effector (post FT sensor)
CoG:
pos:
- 0.0015 # x
- 0.0001 # y
- 0.0371 # z
force: 0.5 # mass * 9.81
- 0.01
- 0.01
- 0.01
force: 0.0 # mass * 9.81

vic:
frame:
id: interaction_point # Vic calcs (displacement etc) are done in this frame. Usually the tool or end-effector
# Vic rule
id: interaction_point # Admittance calcs (displacement etc) are done in this frame. Usually the tool or end-effector
external: false # control frame exists within URDF kinematic chain
# VIC rule
plugin_package: cartesian_vic_controller
plugin_name: cartesian_vic_controller/VanillaCartesianAdmittanceRule # Nominal admittance controller
# plugin_name: cartesian_vic_controller/VanillaCartesianImpedanceRule # Nominal impedance controller
plugin_name: cartesian_vic_controller/VanillaCartesianAdmittanceRule # As nominal controller

# Misc. control parameters
activate_nullspace_control: false
activate_gravity_compensation: false

selected_axes:
- true # x
Expand All @@ -77,8 +84,6 @@ cartesian_vic_controller:
- true # ry
- true # rz

# Having ".0" at the end is MUST, otherwise there is a loading error
# F = M*a + D*v + S*(x - x_d)
inertia:
- 5.0
- 5.0
Expand All @@ -91,9 +96,9 @@ cartesian_vic_controller:
- 0.9 # x
- 0.9 # y
- 0.9 # z
- 0.9 # rx
- 0.9 # ry
- 0.9 # rz
- 0.99 # rx
- 0.99 # ry
- 0.99 # rz

stiffness:
- 200.0
Expand All @@ -102,5 +107,3 @@ cartesian_vic_controller:
- 2.0
- 2.0
- 2.0

joint_damping: 0.5
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
cartesian_impedance_controller:
ros__parameters:
command_interfaces:
- force
state_interfaces:
- position
- velocity
joints:
- joint_a1
- joint_a2
- joint_a3
- joint_a4
- joint_a5
- joint_a6
- joint_a7

# Parameters for the controller
# Note: having ".0" at the end of float is a MUST, otherwise there is a loading error

filters:
state_position_filter_cuttoff_freq: -1.0
state_velocity_filter_cuttoff_freq: 100.0
command_filter_cuttoff_freq: -1.0
ft_sensor_filter_cuttoff_freq: 30.0

dynamics:
plugin_name: dynamics_interface_kdl/DynamicsInterfaceKDL
plugin_package: dynamics_interface
base: iiwa_base # Assumed to be stationary
tip: interaction_point
alpha: 0.0005
gravity: [0.0, 0.0, -9.81]

ft_sensor:
name: ft_sensor
frame:
id: ft_sensor # Wrench measurements are in this frame
external: false # force torque frame exists within URDF kinematic chain

external_torque_sensor:
is_enabled: false
name: ""

control:
frame:
id: interaction_point # Admittance calcs (displacement etc) are done in this frame. Usually the tool or end-effector
external: false # control frame exists within URDF kinematic chain

fixed_world_frame: # Gravity points down (neg. Z) in this frame (Usually: world or base_link)
frame:
id: iiwa_base
external: false

gravity_compensation:
frame:
id: ft_sensor
external: false

CoG:
pos:
- 0.01
- 0.01
- 0.01
force: 0.0 # mass * 9.81

vic:
frame:
id: interaction_point # Admittance calcs (displacement etc) are done in this frame. Usually the tool or end-effector
external: false # control frame exists within URDF kinematic chain
# VIC rule
plugin_package: cartesian_vic_controller
plugin_name: cartesian_vic_controller/VanillaCartesianImpedanceRule # As nominal controller

# Misc. control parameters
activate_nullspace_control: true
activate_gravity_compensation: true

selected_axes:
- true # x
- true # y
- true # z
- true # rx
- true # ry
- true # rz

inertia:
- 5.0
- 5.0
- 5.0
- 0.1
- 0.1
- 0.1

damping_ratio: # damping can be used instead: zeta = D / (2 * sqrt( M * S ))
- 0.9 # x
- 0.9 # y
- 0.9 # z
- 0.99 # rx
- 0.99 # ry
- 0.99 # rz

stiffness:
- 200.0
- 200.0
- 200.0
- 2.0
- 2.0
- 2.0

nullspace_control:
# desired_joint_positions: [...] # if empty, defaults to initial joint positions
# desired_joint_positions: [0.0, -0.7854, 0.0, 1.3962, 0.0, 0.6109, 0.0]
joint_inertia: [25.0]
joint_stiffness: [100.0]
joint_damping: [90.0] # e.g., 2 * 0.9 * sqrt (m * k)
# Example values for {M, K, D} : {25, 10, 28}, {25, 100, 90}, {25, 200, 128}
1 change: 1 addition & 0 deletions cartesian_vic_controller/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

<depend>cartesian_control_msgs</depend>
<depend>dynamics_interface</depend>
<depend>dynamics_interface_kdl</depend>

<depend>backward_ros</depend>
<depend>control_msgs</depend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,10 @@ cartesian_vic_controller:
}
plugin_name: {
type: string,
default_value: "cartesian_vic_controller/VanillaCartesianAdmittanceRule",
description: "Specifies the name of the vic rule plugin to load."
}
plugin_package: {
type: string,
default_value: "cartesian_vic_controller",
description: "Specifies the package name that contains the admittance rule plugin."
}
selected_axes:
Expand Down Expand Up @@ -196,7 +194,7 @@ cartesian_vic_controller:
The damping ratio is defined as: zeta = D / (2 * sqrt( M * S )).",
validation: {
fixed_size<>: 6,
element_bounds<>: [ 0.0, 1.2 ]
element_bounds<>: [ 0.0, 5.0 ]
}
}
stiffness: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2021, Stogl Robotics Consulting UG (haftungsbeschränkt)
// Copyright 2024 ICUBE Laboratory, University of Strasbourg
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -258,6 +258,32 @@ const auto valid_6d_robot_urdf =
</command_interface>
<state_interface name="position"/>
</joint>
<!-- F/T sensor -->
<sensor name="tool0">
<state_interface name="force.x">
<param name="initial_value">0.0</param>
</state_interface>

<state_interface name="force.y">
<param name="initial_value">0.0</param>
</state_interface>

<state_interface name="force.z">
<param name="initial_value">0.0</param>
</state_interface>

<state_interface name="torque.x">
<param name="initial_value">0.0</param>
</state_interface>

<state_interface name="torque.y">
<param name="initial_value">0.0</param>
</state_interface>

<state_interface name="torque.z">
<param name="initial_value">0.0</param>
</state_interface>
</sensor>
</ros2_control>
</robot>
)";
Expand Down
Loading