-
Notifications
You must be signed in to change notification settings - Fork 431
Ahcorde/add/joint limit interface #181
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
bmagyar
merged 15 commits into
ros-controls:master
from
guru-florida:ahcorde/add/joint_limit_interface
Oct 10, 2020
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
21da0a2
Added joint_limits_interface - Direct port from ROS 1
ahcorde 5c1bd59
Follow ros2 styles and added tests
ahcorde 1cab86b
Added missing dependencies in package.xml
ahcorde dff8ae6
Merge remote-tracking branch 'origin/master' into ahcorde/add/joint_l…
ahcorde 4354690
Added feedback
ahcorde e05d0da
removed pycache
ahcorde 2f43785
updated joint limits interface exception to nothrow and match base ov…
guru-florida 5686279
converted joint limit interfaces to use new JointHandles (no more Joi…
guru-florida 39ae057
updated joint limits tests to use new JointHandles
guru-florida 33dfce1
updated package version from 2 to 3
guru-florida 254e7ad
added memory include as suggested by ros_industrial test
guru-florida a167be9
uncrustify fixes
guru-florida 79d45eb
removing changelog from ROS1
guru-florida f7b509d
Reset version and fix links
bmagyar bd96b79
Update maintainers
bmagyar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| cmake_minimum_required(VERSION 3.5.0) | ||
| project(joint_limits_interface) | ||
|
|
||
| find_package(ament_cmake REQUIRED) | ||
| find_package(hardware_interface REQUIRED) | ||
| find_package(rclcpp REQUIRED) | ||
| find_package(urdf REQUIRED) | ||
|
|
||
| if(BUILD_TESTING) | ||
| find_package(ament_cmake_gtest REQUIRED) | ||
| find_package(ament_lint_auto REQUIRED) | ||
| find_package(launch_testing_ament_cmake REQUIRED) | ||
|
|
||
| ament_lint_auto_find_test_dependencies() | ||
|
|
||
| ament_add_gtest(joint_limits_interface_test test/joint_limits_interface_test.cpp) | ||
| target_include_directories(joint_limits_interface_test PUBLIC include) | ||
| ament_target_dependencies(joint_limits_interface_test hardware_interface rclcpp) | ||
|
|
||
| add_executable(joint_limits_rosparam_test test/joint_limits_rosparam_test.cpp) | ||
| target_include_directories(joint_limits_rosparam_test PUBLIC include ${GTEST_INCLUDE_DIRS}) | ||
| target_link_libraries(joint_limits_rosparam_test ${GTEST_LIBRARIES}) | ||
| ament_target_dependencies(joint_limits_rosparam_test rclcpp) | ||
| add_launch_test(test/joint_limits_rosparam.launch.py) | ||
| install( | ||
| TARGETS | ||
| joint_limits_rosparam_test | ||
| DESTINATION lib/${PROJECT_NAME} | ||
| ) | ||
| install( | ||
| FILES | ||
| test/joint_limits_rosparam.yaml | ||
| DESTINATION share/${PROJECT_NAME}/test | ||
| ) | ||
|
|
||
| ament_add_gtest(joint_limits_urdf_test test/joint_limits_urdf_test.cpp) | ||
| target_include_directories(joint_limits_urdf_test PUBLIC include) | ||
| ament_target_dependencies(joint_limits_urdf_test rclcpp) | ||
| endif() | ||
|
|
||
| # Install headers | ||
| install( | ||
| DIRECTORY include/${PROJECT_NAME}/ | ||
| DESTINATION include/${PROJECT_NAME} | ||
| ) | ||
|
|
||
| ament_export_include_directories(include) | ||
| ament_export_dependencies(rclcpp urdf) | ||
|
|
||
| ament_package() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| ## Joint Limits Interface ## | ||
|
|
||
| ### Overview ### | ||
|
|
||
| **joint_limits_interface** contains data structures for representing joint limits, methods for populating them from common | ||
| formats such as URDF and the ROS parameter server, and methods for enforcing limits on different kinds of hardware interfaces. | ||
|
|
||
| The **joint_limits_interface** is *not* used by controllers themselves (it does not implement a `HardwareInterface`) but | ||
| instead operates after the controllers have updated, in the `write()` method (or equivalent) of the robot abstraction. | ||
| Enforcing limits will *overwrite* the commands set by the controllers, it does not operate on a separate raw data buffer. | ||
|
|
||
| There are two main elements involved in setting up a joint limits interface: | ||
|
|
||
| - **Joint limits representation** | ||
| - **JointLimits** Position, velocity, acceleration, jerk and effort. | ||
| - **SoftJointLimits** Soft position limits, `k_p`, `k_v` (as described [here](http://www.ros.org/wiki/pr2_controller_manager/safety_limits)). | ||
| - **Loading from URDF** There are convenience methods for loading joint limits information | ||
| (position, velocity and effort), as well as soft joint limits information from the URDF. | ||
| - **Loading from ROS params** There are convenience methods for loading joint limits from the ROS parameter server | ||
| (position, velocity, acceleration, jerk and effort). Parameter specification is the same used in MoveIt, | ||
| with the addition that we also parse jerk and effort limits. | ||
|
|
||
| - **Joint limits interface** | ||
|
|
||
| - For **effort-controlled** joints, the soft-limits implementation from the PR2 has been ported. | ||
| - For **position-controlled** joints, a modified version of the PR2 soft limits has been implemented. | ||
| - For **velocity-controlled** joints, simple saturation based on acceleration and velocity limits has been implemented. | ||
|
|
||
| ### Examples ### | ||
| Please refer to the [joint_limits_interface](https://github.com/ros-controls/ros_control/wiki/joint_limits_interface) wiki page. |
90 changes: 90 additions & 0 deletions
90
joint_limits_interface/include/joint_limits_interface/joint_limits.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| // Copyright 2013, PAL Robotics S.L. | ||
| // All rights reserved. | ||
| // | ||
| // Software License Agreement (BSD License 2.0) | ||
| // | ||
| // Redistribution and use in source and binary forms, with or without | ||
| // modification, are permitted provided that the following conditions | ||
| // are met: | ||
| // | ||
| // * Redistributions of source code must retain the above copyright | ||
| // notice, this list of conditions and the following disclaimer. | ||
| // * Redistributions in binary form must reproduce the above | ||
| // copyright notice, this list of conditions and the following | ||
| // disclaimer in the documentation and/or other materials provided | ||
| // with the distribution. | ||
| // * Neither the name of the copyright holders nor the names of its | ||
| // contributors may be used to endorse or promote products derived | ||
| // from this software without specific prior written permission. | ||
| // | ||
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
| // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
| // COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
| // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
| // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | ||
| // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| // POSSIBILITY OF SUCH DAMAGE. | ||
|
|
||
| /// \author Adolfo Rodriguez Tsouroukdissian | ||
|
|
||
| #ifndef JOINT_LIMITS_INTERFACE__JOINT_LIMITS_HPP_ | ||
| #define JOINT_LIMITS_INTERFACE__JOINT_LIMITS_HPP_ | ||
|
|
||
| namespace joint_limits_interface | ||
| { | ||
|
|
||
| struct JointLimits | ||
| { | ||
| JointLimits() | ||
| : min_position(0.0), | ||
| max_position(0.0), | ||
| max_velocity(0.0), | ||
| max_acceleration(0.0), | ||
| max_jerk(0.0), | ||
| max_effort(0.0), | ||
| has_position_limits(false), | ||
| has_velocity_limits(false), | ||
| has_acceleration_limits(false), | ||
| has_jerk_limits(false), | ||
| has_effort_limits(false), | ||
| angle_wraparound(false) | ||
| {} | ||
|
|
||
| double min_position; | ||
| double max_position; | ||
| double max_velocity; | ||
| double max_acceleration; | ||
| double max_jerk; | ||
| double max_effort; | ||
|
|
||
| bool has_position_limits; | ||
| bool has_velocity_limits; | ||
| bool has_acceleration_limits; | ||
| bool has_jerk_limits; | ||
| bool has_effort_limits; | ||
| bool angle_wraparound; | ||
| }; | ||
|
|
||
| struct SoftJointLimits | ||
| { | ||
| SoftJointLimits() | ||
| : min_position(0.0), | ||
| max_position(0.0), | ||
| k_position(0.0), | ||
| k_velocity(0.0) | ||
| {} | ||
|
|
||
| double min_position; | ||
| double max_position; | ||
| double k_position; | ||
| double k_velocity; | ||
| }; | ||
|
|
||
| } // namespace joint_limits_interface | ||
|
|
||
| #endif // JOINT_LIMITS_INTERFACE__JOINT_LIMITS_HPP_ | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.