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

Merge main #1

Merged
merged 66 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
a7e3777
Create PID Controller package.
destogl Sep 10, 2022
3667a20
Updated PID controller with functionality.
destogl Sep 15, 2022
eb6c296
Move parameter read and check into separate method for easier inherit…
destogl Sep 15, 2022
1b387c7
Small fixes of pid_controller for compilation.
destogl Sep 29, 2022
22f7094
Correct dependencies of PID controller.
destogl Nov 30, 2022
c076bda
Debug PID controller to actually work.
destogl Nov 30, 2022
3dea74c
Remove validation file since it is not needed.
destogl Dec 1, 2022
f451038
Delete LICENSE
destogl Feb 7, 2023
7c47ae0
Simplify things in the PID controller and add some error management.
destogl Dec 16, 2022
dacd8ea
Update CMake export in pid-controller
tylerjw Mar 18, 2023
a1eb1ac
Cleaning CMakeLists and deprecation from PID controller and starting …
destogl Mar 20, 2023
a423cc9
pid_controller compiles, tests need adjustments
muritane Mar 21, 2023
314adb7
all tests in test_pid_controller are green
muritane Mar 24, 2023
4e40be8
test_pid_controller_preceeding: all green
muritane Mar 27, 2023
edce147
Update pid_controller/include/pid_controller/pid_controller.hpp
destogl Mar 28, 2023
56e1a6e
Apply suggestions from code review
destogl Mar 28, 2023
703ee25
Apply suggestions from code review
destogl Apr 3, 2023
b11a67c
Rename test_pid_controller_preceeding.cpp to test_pid_controller_prec…
destogl Apr 3, 2023
d5bb3a6
Rename pid_controller_preceeding_params.yaml to pid_controller_preced…
destogl Apr 3, 2023
9145987
Update pid_controller/CMakeLists.txt
destogl Apr 3, 2023
d229ed8
Update pid_controller/test/test_pid_controller.cpp
destogl Apr 4, 2023
f1b6bca
More fixups for PID after renaming stuff in the message.
destogl Apr 4, 2023
0733d01
Apply suggestions from code review
destogl Apr 4, 2023
2fd0490
Add user doc
destogl Apr 4, 2023
00d03b7
Update controllers_index.rst
destogl Apr 4, 2023
072600e
Apply suggestions from code review
destogl Apr 5, 2023
a9868dc
Fixup formatting.
destogl Apr 5, 2023
5ddf108
Squashed commit of the following:
destogl Apr 3, 2023
b84b40a
Add reseting of individual DoFs to state values in JTC when using in …
destogl Apr 6, 2023
edc703b
Fix missing .cpp extension in CMakeLists for CTG
bijoua29 Apr 7, 2023
8b2761b
Fix unused variable compiler warning in pid_controller tests
bijoua29 Apr 7, 2023
81ca561
Added structures for joint limits.
destogl Jul 25, 2022
06d5f0b
Integrate SimpleJointLimiter in to JTC.
destogl May 4, 2023
8b97f22
Adjust default value of limiters.
destogl May 4, 2023
3ecaaa3
Fix missing .cpp extension in CMakeLists for CTG
bijoua29 Apr 7, 2023
7e4d851
Fix unused variable compiler warning in pid_controller tests
bijoua29 Apr 7, 2023
bcbb3fc
Added support for save integral term parameter
Whalex451 Apr 20, 2023
520a099
Applied suggestions from code review
Whalex451 Apr 20, 2023
8c6fff8
More comment updates
Whalex451 Apr 20, 2023
b41f5f7
Merge pull request #5 from SchillingRobotics/Add-support-for-new-para…
Whalex451 Apr 20, 2023
2ae8260
Check measured state for null to determine if hardware state available
bijoua29 May 8, 2023
cb851b4
Fix pre-commit warnings not related to changes in this branch
bijoua29 May 8, 2023
069ec65
Remove unused variable
bijoua29 May 8, 2023
1b4ee7b
Fix bug in processing read of state from hardware
bijoua29 May 8, 2023
61f6eee
Remove deprecated rclcpp/qos_event.hpp
bijoua29 May 12, 2023
eb1cd2b
Remove unused free functions for resetting controlled feedback messages
bijoua29 May 12, 2023
e495783
Use time from start passed in from input reference if non-zero in CTG
bijoua29 Aug 30, 2023
dfbd63e
Merge pull request #8 from SchillingRobotics/ctg-use-time-from-start
destogl Aug 30, 2023
2fb152c
Modify CTG to expect twist in measured state input to be in body frame
bijoua29 Sep 5, 2023
3cc05db
Update comment
bijoua29 Sep 6, 2023
486c078
Merge pull request #9 from SchillingRobotics/ctg-meas-state-twist-body
bijoua29 Sep 6, 2023
92e7139
Update PIDController to enable parameter updates.
destogl Sep 11, 2023
6b118f4
Handle NaNs in measured state in CTG
bijoua29 Sep 12, 2023
8ca56ef
Merge pull request #10 from SchillingRobotics/bijoua/handle_meas_stat…
bijoua29 Sep 12, 2023
06b35a1
Add cartesian state into CTG.
destogl Sep 20, 2023
71c128a
Fix stair step in JTC when new trajectory message received
bijoua29 Sep 25, 2023
4411276
Reset initial value of last commanded time to 0.
destogl Sep 26, 2023
0c83a41
Use previous state for limiters.
destogl Sep 28, 2023
68920c4
Use values, if present in reset dofs service, instead of fb to reset
bijoua29 Oct 18, 2023
986de2d
Merge pull request #11 from SchillingRobotics/bijoua/update_reset_dof…
bijoua29 Oct 18, 2023
377ebb9
Fix bug when two reset dofs req sent without being processed in between
bijoua29 Oct 20, 2023
0756f14
Update reset dofs output messages in JTC
bijoua29 Oct 20, 2023
8af535b
Merge pull request #12 from SchillingRobotics/bijoua/fix_reset_dofs_bug
bijoua29 Oct 20, 2023
bbaee37
Remove service for setting joint limits in CTG.
destogl Nov 1, 2023
b6b8ba7
Merge remote-tracking branch 'upstream/master' into merge_main
henrygerardmoore May 9, 2024
17515b1
wip JTC fix
Jun 26, 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 joint_state_broadcaster/src/joint_state_broadcaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "hardware_interface/types/hardware_interface_return_values.hpp"
#include "hardware_interface/types/hardware_interface_type_values.hpp"
#include "rclcpp/clock.hpp"
#include "rclcpp/event_handler.hpp"
#include "rclcpp/qos.hpp"
#include "rclcpp/time.hpp"
#include "rclcpp_lifecycle/lifecycle_node.hpp"
Expand Down
42 changes: 39 additions & 3 deletions joint_trajectory_controller/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,20 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS
control_toolbox
controller_interface
generate_parameter_library
joint_limits
hardware_interface
joint_limits
nav_msgs
pluginlib
rclcpp
rclcpp_lifecycle
realtime_tools
rsl
ruckig
tl_expected
trajectory_msgs
tf2
tf2_geometry_msgs
urdf
)

Expand All @@ -44,22 +50,38 @@ target_include_directories(joint_trajectory_controller PUBLIC
)
target_link_libraries(joint_trajectory_controller PUBLIC
joint_trajectory_controller_parameters
ruckig::ruckig
)
ament_target_dependencies(joint_trajectory_controller PUBLIC ${THIS_PACKAGE_INCLUDE_DEPENDS})

# Causes the visibility macros to use dllexport rather than dllimport,
# which is appropriate when building the dll but not consuming it.
target_compile_definitions(joint_trajectory_controller PRIVATE "JOINT_TRAJECTORY_CONTROLLER_BUILDING_DLL" "_USE_MATH_DEFINES")

add_library(cartesian_trajectory_generator SHARED
src/cartesian_trajectory_generator.cpp
)
target_compile_features(cartesian_trajectory_generator PUBLIC cxx_std_17)
target_include_directories(cartesian_trajectory_generator PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include/joint_trajectory_controller>
)
target_link_libraries(cartesian_trajectory_generator PUBLIC
joint_trajectory_controller
)
ament_target_dependencies(cartesian_trajectory_generator PUBLIC ${THIS_PACKAGE_INCLUDE_DEPENDS})

pluginlib_export_plugin_description_file(controller_interface joint_trajectory_plugin.xml)

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

ament_add_gmock(test_trajectory test/test_trajectory.cpp)
target_link_libraries(test_trajectory joint_trajectory_controller)
target_compile_definitions(test_trajectory PRIVATE _USE_MATH_DEFINES)
# TODO(henrygerardmoore): re-enable
# ament_add_gmock(test_trajectory test/test_trajectory.cpp)
# target_link_libraries(test_trajectory joint_trajectory_controller)
# target_compile_definitions(test_trajectory PRIVATE _USE_MATH_DEFINES)
Comment on lines +81 to +84

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this commented out?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me see if it can be re-enabled. If I remember correctly, it was making the build fail.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, the test is using the old version of trajectory.sample. There are a lot of them, so I thought I would leave re-enabling it until later (since the fix is more involved than just a find and replace, too). Is that okay?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we change trajectory.sample in our fork? Then it is ok as it will get fixed when we merge upstream?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we changed that in our fork and it should be fixed when we merge upstream


ament_add_gmock(test_trajectory_controller
test/test_trajectory_controller.cpp)
Expand All @@ -82,6 +104,19 @@ if(BUILD_TESTING)
ros2_control_test_assets
)

ament_add_gmock(test_load_cartesian_trajectory_generator
test/test_load_cartesian_trajectory_generator.cpp
)
target_link_libraries(test_load_cartesian_trajectory_generator
cartesian_trajectory_generator
)
ament_target_dependencies(test_load_cartesian_trajectory_generator
controller_manager
control_toolbox
realtime_tools
ros2_control_test_assets
)

ament_add_gmock(test_trajectory_actions
test/test_trajectory_actions.cpp
)
Expand All @@ -97,6 +132,7 @@ install(
DESTINATION include/joint_trajectory_controller
)
install(TARGETS
cartesian_trajectory_generator
joint_trajectory_controller
joint_trajectory_controller_parameters
EXPORT export_joint_trajectory_controller
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
// Copyright (c) 2023 Stogl Robotics Consulting UG (haftungsbeschränkt)
//
// 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 JOINT_TRAJECTORY_CONTROLLER__CARTESIAN_TRAJECTORY_GENERATOR_HPP_
#define JOINT_TRAJECTORY_CONTROLLER__CARTESIAN_TRAJECTORY_GENERATOR_HPP_

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

#include "control_msgs/msg/cartesian_trajectory_generator_state.hpp"
#include "geometry_msgs/msg/pose.hpp"
#include "geometry_msgs/msg/transform_stamped.hpp"
#include "joint_limits/joint_limits.hpp"
#include "joint_trajectory_controller/joint_trajectory_controller.hpp"
#include "nav_msgs/msg/odometry.hpp"
#include "trajectory_msgs/msg/multi_dof_joint_trajectory_point.hpp"

using namespace std::chrono_literals; // NOLINT

namespace cartesian_trajectory_generator
{
class CartesianTrajectoryGenerator : public joint_trajectory_controller::JointTrajectoryController
{
public:
JOINT_TRAJECTORY_CONTROLLER_PUBLIC
CartesianTrajectoryGenerator();

/**
* @brief command_interface_configuration This controller requires the position and velocity
* state interfaces for the controlled joints
*/
JOINT_TRAJECTORY_CONTROLLER_PUBLIC
controller_interface::InterfaceConfiguration state_interface_configuration() const override;

JOINT_TRAJECTORY_CONTROLLER_PUBLIC
controller_interface::CallbackReturn on_configure(
const rclcpp_lifecycle::State & previous_state) override;

JOINT_TRAJECTORY_CONTROLLER_PUBLIC
controller_interface::CallbackReturn on_activate(
const rclcpp_lifecycle::State & previous_state) override;

using ControllerReferenceMsg = trajectory_msgs::msg::MultiDOFJointTrajectoryPoint;
using ControllerFeedbackMsg = nav_msgs::msg::Odometry;

protected:
bool read_state_from_hardware(JointTrajectoryPoint & state) override;

using JointTrajectoryPoint = trajectory_msgs::msg::JointTrajectoryPoint;
JOINT_TRAJECTORY_CONTROLLER_PUBLIC
void publish_state(
const rclcpp::Time & time, const JointTrajectoryPoint & desired_state,
const JointTrajectoryPoint & current_state, const JointTrajectoryPoint & state_error,
const JointTrajectoryPoint & splines_output, const JointTrajectoryPoint & ruckig_input_target,
const JointTrajectoryPoint & ruckig_input) override;

// Command subscribers and Controller State publisher
rclcpp::Subscription<ControllerReferenceMsg>::SharedPtr ref_subscriber_ = nullptr;
rclcpp::Subscription<ControllerReferenceMsg>::SharedPtr ref_subscriber_reliable_ = nullptr;
realtime_tools::RealtimeBuffer<std::shared_ptr<ControllerReferenceMsg>> reference_world_;

rclcpp::Subscription<ControllerFeedbackMsg>::SharedPtr feedback_subscriber_ = nullptr;
realtime_tools::RealtimeBuffer<std::shared_ptr<ControllerFeedbackMsg>> feedback_;

trajectory_msgs::msg::JointTrajectoryPoint control_output_local_;

private:
void reference_callback(const std::shared_ptr<ControllerReferenceMsg> msg);

using CartControllerStateMsg = control_msgs::msg::CartesianTrajectoryGeneratorState;
using CartStatePublisher = realtime_tools::RealtimePublisher<CartControllerStateMsg>;
using CartStatePublisherPtr = std::unique_ptr<CartStatePublisher>;
rclcpp::Publisher<CartControllerStateMsg>::SharedPtr cart_publisher_;
CartStatePublisherPtr cart_state_publisher_;

std::vector<joint_limits::JointLimits> configured_joint_limits_;

// storage of last received measured position to
geometry_msgs::msg::Pose last_received_measured_position_;
};

} // namespace cartesian_trajectory_generator

#endif // JOINT_TRAJECTORY_CONTROLLER__CARTESIAN_TRAJECTORY_GENERATOR_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,16 @@ namespace interpolation_methods
enum class InterpolationMethod
{
NONE,
VARIABLE_DEGREE_SPLINE
VARIABLE_DEGREE_SPLINE,
RUCKIG
};

const InterpolationMethod DEFAULT_INTERPOLATION = InterpolationMethod::VARIABLE_DEGREE_SPLINE;

const std::unordered_map<InterpolationMethod, std::string> InterpolationMethodMap(
{{InterpolationMethod::NONE, "none"}, {InterpolationMethod::VARIABLE_DEGREE_SPLINE, "splines"}});
{{InterpolationMethod::NONE, "none"},
{InterpolationMethod::VARIABLE_DEGREE_SPLINE, "splines"},
{InterpolationMethod::RUCKIG, "ruckig"}});

[[nodiscard]] inline InterpolationMethod from_string(const std::string & interpolation_method)
{
Expand All @@ -50,6 +53,11 @@ const std::unordered_map<InterpolationMethod, std::string> InterpolationMethodMa
{
return InterpolationMethod::VARIABLE_DEGREE_SPLINE;
}
else if (
interpolation_method.compare(InterpolationMethodMap.at(InterpolationMethod::RUCKIG)) == 0)
{
return InterpolationMethod::RUCKIG;
}
// Default
else
{
Expand Down
Loading
Loading