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

[JTC] Update trajectory documentation (backport #714) #723

Closed
wants to merge 3 commits into from
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
4 changes: 4 additions & 0 deletions .github/workflows/rolling-binary-build-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ on:
workflow_dispatch:
branches:
- master
- '*feature*'
- '*feature/**'
pull_request:
branches:
- master
- '*feature*'
- '*feature/**'
push:
branches:
- master
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/rolling-binary-build-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ on:
workflow_dispatch:
branches:
- master
- '*feature*'
- '*feature/**'
pull_request:
branches:
- master
- '*feature*'
- '*feature/**'
push:
branches:
- master
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/rolling-semi-binary-build-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ on:
workflow_dispatch:
branches:
- master
- '*feature*'
- '*feature/**'
pull_request:
branches:
- master
- '*feature*'
- '*feature/**'
push:
branches:
- master
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/rolling-semi-binary-build-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ on:
workflow_dispatch:
branches:
- master
- '*feature*'
- '*feature/**'
pull_request:
branches:
- master
- '*feature*'
- '*feature/**'
push:
branches:
- master
Expand Down
16 changes: 12 additions & 4 deletions admittance_controller/test/test_admittance_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,18 @@ INSTANTIATE_TEST_SUITE_P(
// wrong length selected axes
std::make_tuple(
std::string("admittance.selected_axes"),
rclcpp::ParameterValue(std::vector<double>() = {1, 2, 3})),
// invalid robot description
std::make_tuple(
std::string("robot_description"), rclcpp::ParameterValue(std::string() = "bad_robot"))));
rclcpp::ParameterValue(std::vector<double>() = {1, 2, 3}))
// invalid robot description.
// TODO(anyone): deactivated, because SetUpController returns SUCCESS here?
// ,std::make_tuple(
// std::string("robot_description"), rclcpp::ParameterValue(std::string() = "bad_robot")))
));

// Test on_init returns ERROR when a parameter is invalid
TEST_P(AdmittanceControllerTestParameterizedInvalidParameters, invalid_parameters)
{
ASSERT_EQ(SetUpController(), controller_interface::return_type::ERROR);
}

TEST_F(AdmittanceControllerTest, all_parameters_set_configure_success)
{
Expand Down
12 changes: 9 additions & 3 deletions admittance_controller/test/test_admittance_controller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

#include "gmock/gmock.h"

#include "6d_robot_description.hpp"
#include "admittance_controller/admittance_controller.hpp"
#include "control_msgs/msg/admittance_controller_state.hpp"
#include "geometry_msgs/msg/transform_stamped.hpp"
Expand All @@ -38,6 +37,7 @@
#include "rclcpp/utilities.hpp"
#include "rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp"
#include "semantic_components/force_torque_sensor.hpp"
#include "test_asset_6d_robot_description.hpp"
#include "tf2_ros/transform_broadcaster.h"
#include "trajectory_msgs/msg/joint_trajectory.hpp"

Expand Down Expand Up @@ -454,9 +454,15 @@ class AdmittanceControllerTestParameterizedInvalidParameters
static void TearDownTestCase() { AdmittanceControllerTest::TearDownTestCase(); }

protected:
void SetUpController()
controller_interface::return_type SetUpController()
{
AdmittanceControllerTest::SetUpController("test_admittance_controller");
auto param_name = std::get<0>(GetParam());
auto param_value = std::get<1>(GetParam());
std::vector<rclcpp::Parameter> parameter_overrides;
rclcpp::Parameter param(param_name, param_value);
parameter_overrides.push_back(param);
return AdmittanceControllerTest::SetUpController(
"test_admittance_controller", parameter_overrides);
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef ROS2_CONTROL_TEST_ASSETS__6D_ROBOT_DESCRIPTION_HPP_
#define ROS2_CONTROL_TEST_ASSETS__6D_ROBOT_DESCRIPTION_HPP_
#ifndef TEST_ASSET_6D_ROBOT_DESCRIPTION_HPP_
#define TEST_ASSET_6D_ROBOT_DESCRIPTION_HPP_

#include <string>

Expand Down Expand Up @@ -310,4 +310,4 @@ const auto valid_6d_robot_srdf =

} // namespace ros2_control_test_assets

#endif // ROS2_CONTROL_TEST_ASSETS__6D_ROBOT_DESCRIPTION_HPP_
#endif // TEST_ASSET_6D_ROBOT_DESCRIPTION_HPP_
14 changes: 7 additions & 7 deletions joint_trajectory_controller/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ if(BUILD_TESTING)
ros2_control_test_assets
)

# TODO(andyz): Disabled due to flakiness
# ament_add_gmock(test_trajectory_actions
# test/test_trajectory_actions.cpp
# )
# target_link_libraries(test_trajectory_actions
# joint_trajectory_controller
# )
ament_add_gmock(test_trajectory_actions
test/test_trajectory_actions.cpp
)
set_tests_properties(test_trajectory_actions PROPERTIES TIMEOUT 300)
target_link_libraries(test_trajectory_actions
joint_trajectory_controller
)
endif()


Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
138 changes: 138 additions & 0 deletions joint_trajectory_controller/doc/parameters.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
:github_url: https://github.com/ros-controls/ros2_controllers/blob/{REPOS_FILE_BRANCH}/joint_trajectory_controller/doc/parameters.rst

.. _parameters:

Details about parameters
^^^^^^^^^^^^^^^^^^^^^^^^

joints (list(string))
Joint names to control and listen to.

command_joints (list(string))
Joint names to control. This parameters is used if JTC is used in a controller chain where command and state interfaces don't have same names.

command_interface (list(string))
Command interfaces provided by the hardware interface for all joints.

Values: [position | velocity | acceleration] (multiple allowed)

state_interfaces (list(string))
State interfaces provided by the hardware for all joints.

Values: position (mandatory) [velocity, [acceleration]].
Acceleration interface can only be used in combination with position and velocity.

state_publish_rate (double)

Publish-rate of the controller's “state” topic.

Default: 50.0

action_monitor_rate (double)
Rate to monitor status changes when the controller is executing action (control_msgs::action::FollowJointTrajectory).

Default: 20.0

allow_partial_joints_goal (boolean)
Allow joint goals defining trajectory for only some joints.

Default: false

allow_integration_in_goal_trajectories (boolean)
Allow integration in goal trajectories to accept goals without position or velocity specified

Default: false

interpolation_method (string)
The type of interpolation to use, if any. Can be "splines" or "none".

Default: splines

open_loop_control (boolean)
Use controller in open-loop control mode:

* The controller ignores the states provided by hardware interface but using last commands as states for starting the trajectory interpolation.
* It deactivates the feedback control, see the ``gains`` structure.

This is useful if hardware states are not following commands, i.e., an offset between those (typical for hydraulic manipulators).

.. Note::
If this flag is set, the controller tries to read the values from the command interfaces on activation.
If they have real numeric values, those will be used instead of state interfaces.
Therefore it is important set command interfaces to NaN (i.e., ``std::numeric_limits<double>::quiet_NaN()``) or state values when the hardware is started.

Default: false

allow_nonzero_velocity_at_trajectory_end (boolean)
If false, the last velocity point has to be zero or the goal will be rejected.

Default: true

constraints (structure)
Default values for tolerances if no explicit values are states in JointTrajectory message.

constraints.stopped_velocity_tolerance (double)
Default value for end velocity deviation.

Default: 0.01

constraints.goal_time (double)
Maximally allowed tolerance for not reaching the end of the trajectory in a predefined time.

Default: 0.0 (not checked)

constraints.<joint_name>.trajectory (double)
Maximally allowed deviation from the target trajectory for a given joint.

Default: 0.0 (tolerance is not enforced)

constraints.<joint_name>.goal (double)
Maximally allowed deviation from the goal (end of the trajectory) for a given joint.

Default: 0.0 (tolerance is not enforced)

gains (structure)
Only relevant, if ``open_loop_control`` is not set.

If ``velocity`` is the only command interface for all joints or an ``effort`` command interface is configured, PID controllers are used for every joint.
This structure contains the controller gains for every joint with the control law

.. math::

u = k_{ff} v_d + k_p e + k_i \sum e dt + k_d (v_d - v)

with the desired velocity :math:`v_d`, the measured velocity :math:`v`, the position error :math:`e` (definition see below),
the controller period :math:`dt`, and the ``velocity`` or ``effort`` manipulated variable (control variable) :math:`u`, respectively.

gains.<joint_name>.p (double)
Proportional gain :math:`k_p` for PID

Default: 0.0

gains.<joint_name>.i (double)
Integral gain :math:`k_i` for PID

Default: 0.0

gains.<joint_name>.d (double)
Derivative gain :math:`k_d` for PID

Default: 0.0

gains.<joint_name>.i_clamp (double)
Integral clamp. Symmetrical in both positive and negative direction.

Default: 0.0

gains.<joint_name>.ff_velocity_scale (double)
Feed-forward scaling :math:`k_{ff}` of velocity

Default: 0.0

gains.<joint_name>.normalize_error (bool)
If true, the position error :math:`e = normalize(s_d - s)` is normalized between :math:`-\pi, \pi`.
Otherwise :math:`e = s_d - s` is used, with the desired position :math:`s_d` and the measured
position :math:`s` from the state interface. Use this for revolute joints without end stop,
where the shortest rotation to the target position is the desired motion.

Default: false
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading