![]() |
ros2_control - rolling
|
Executes Cartesian motion on top of the Joint Trajectory Controller (JTC). More...
#include <cartesian_trajectory_controller.hpp>


Public Member Functions | |
| controller_interface::CallbackReturn | on_init () override |
| Extending interface with initialization method which is individual for each controller. | |
| controller_interface::CallbackReturn | on_configure (const rclcpp_lifecycle::State &previous_state) override |
| Public Member Functions inherited from joint_trajectory_controller::JointTrajectoryController | |
| controller_interface::InterfaceConfiguration | command_interface_configuration () const override |
| Get configuration for controller's required command interfaces. | |
| controller_interface::InterfaceConfiguration | state_interface_configuration () const override |
| Get configuration for controller's required state interfaces. | |
| controller_interface::return_type | update (const rclcpp::Time &time, const rclcpp::Duration &period) override |
| Control step update. Command interfaces are updated based on on reference inputs and current states. | |
| controller_interface::CallbackReturn | on_init () override |
| Extending interface with initialization method which is individual for each controller. | |
| controller_interface::CallbackReturn | on_configure (const rclcpp_lifecycle::State &previous_state) override |
| controller_interface::CallbackReturn | on_activate (const rclcpp_lifecycle::State &previous_state) override |
| controller_interface::CallbackReturn | on_deactivate (const rclcpp_lifecycle::State &previous_state) override |
| controller_interface::CallbackReturn | on_error (const rclcpp_lifecycle::State &previous_state) override |
| Public Member Functions inherited from controller_interface::ControllerInterface | |
| bool | is_chainable () const final |
| Controller is not chainable. | |
| std::vector< hardware_interface::StateInterface::ConstSharedPtr > | export_state_interfaces () final |
| A non-chainable controller doesn't export any state interfaces. | |
| std::vector< hardware_interface::CommandInterface::SharedPtr > | export_reference_interfaces () final |
| Controller has no reference interfaces. | |
| bool | set_chained_mode (bool chained_mode) final |
| Controller is not chainable, therefore no chained mode can be set. | |
| bool | is_in_chained_mode () const final |
| Controller can not be in chained mode. | |
| Public Member Functions inherited from controller_interface::ControllerInterfaceBase | |
| virtual void | assign_interfaces (std::vector< hardware_interface::LoanedCommandInterface > &&command_interfaces, std::vector< hardware_interface::LoanedStateInterface > &&state_interfaces) |
| Method that assigns the Loaned interfaces to the controller. | |
| virtual void | release_interfaces () |
| Method that releases the Loaned interfaces from the controller. | |
| return_type | init (const std::string &controller_name, const std::string &urdf, unsigned int cm_update_rate, const std::string &node_namespace, const rclcpp::NodeOptions &node_options) |
| return_type | init (const controller_interface::ControllerInterfaceParams ¶ms) |
| const rclcpp_lifecycle::State & | configure () |
| Custom configure method to read additional parameters for controller-nodes. | |
| ControllerUpdateStatus | trigger_update (const rclcpp::Time &time, const rclcpp::Duration &period) |
| Trigger update method. This method is used by the controller_manager to trigger the update method of the controller. The method is used to trigger the update method of the controller synchronously or asynchronously, based on the controller configuration. | |
| std::shared_ptr< rclcpp_lifecycle::LifecycleNode > | get_node () |
| std::shared_ptr< const rclcpp_lifecycle::LifecycleNode > | get_node () const |
| const rclcpp_lifecycle::State & | get_lifecycle_state () const |
| Get the current lifecycle state of the controller node. | |
| uint8_t | get_lifecycle_id () const |
| Get the lifecycle id of the controller node that is cached internally to avoid calls to get_lifecycle_state() in the real-time control loop. | |
| unsigned int | get_update_rate () const |
| bool | is_async () const |
| const std::string & | get_robot_description () const |
| const std::unordered_map< std::string, joint_limits::JointLimits > & | get_hard_joint_limits () const |
| Get the unordered map of joint limits that are defined in the robot description. | |
| const std::unordered_map< std::string, joint_limits::SoftJointLimits > & | get_soft_joint_limits () const |
| Get the unordered map of soft joint limits that are defined in the robot description. | |
| virtual rclcpp::NodeOptions | define_custom_node_options () const |
| Method used by the controller_manager for base NodeOptions to instantiate the Lifecycle node of the controller upon loading the controller. | |
| template<typename ParameterT> | |
| auto | auto_declare (const std::string &name, const ParameterT &default_value) |
| Declare and initialize a parameter with a type. | |
| void | wait_for_trigger_update_to_finish () |
| Method to wait for any running async update cycle to finish after finishing the current cycle. This is needed to be called before deactivating the controller by the controller_manager, so that the interfaces still exist when the controller finishes its cycle and then it's exits. | |
| void | prepare_for_deactivation () |
| Method to prepare the controller for deactivation. This method is called by the controller manager before deactivating the controller. The method is used to prepare the controller for deactivation, e.g., to stop triggering the update cycles further. This method is especially needed for controllers running in async mode and different frequency than the control manager. | |
| std::string | get_name () const |
| void | enable_introspection (bool enable) |
| Enable or disable introspection of the controller. | |
Protected Member Functions | |
| void | reference_callback (std::shared_ptr< trajectory_msgs::msg::MultiDOFJointTrajectory > msg) |
| Convert an incoming Cartesian chunk into a joint trajectory and install it into JTC. | |
| bool | build_joint_trajectory (const trajectory_msgs::msg::MultiDOFJointTrajectory &msg, trajectory_msgs::msg::JointTrajectory &joint_traj) |
| Build the joint trajectory for a Cartesian message; false drops the message. | |
| Protected Member Functions inherited from joint_trajectory_controller::JointTrajectoryController | |
| void | topic_callback (const std::shared_ptr< trajectory_msgs::msg::JointTrajectory > msg) |
| void | preprocess_incoming_trajectory (trajectory_msgs::msg::JointTrajectory &msg) const |
| bool | is_positions_only (const trajectory_msgs::msg::JointTrajectory &traj) const |
| void | synthesize_timing (trajectory_msgs::msg::JointTrajectory &traj) const |
| bool | prepend_commanded_state (trajectory_msgs::msg::JointTrajectory &traj, std::vector< double > &start_velocity) const |
| rclcpp_action::GoalResponse | goal_received_callback (const rclcpp_action::GoalUUID &uuid, std::shared_ptr< const FollowJTrajAction::Goal > goal) |
| rclcpp_action::CancelResponse | goal_cancelled_callback (const std::shared_ptr< rclcpp_action::ServerGoalHandle< FollowJTrajAction > > goal_handle) |
| void | goal_accepted_callback (std::shared_ptr< rclcpp_action::ServerGoalHandle< FollowJTrajAction > > goal_handle) |
| void | compute_error_for_joint (JointTrajectoryPoint &error, const size_t index, const JointTrajectoryPoint ¤t, const JointTrajectoryPoint &desired) const |
| void | fill_partial_goal (std::shared_ptr< trajectory_msgs::msg::JointTrajectory > trajectory_msg) const |
| void | fill_omitted_joints_from_old (const std::shared_ptr< trajectory_msgs::msg::JointTrajectory > &trajectory_msg, const rclcpp::Time &new_start) |
| bool | blend_with_active_trajectory (const std::shared_ptr< trajectory_msgs::msg::JointTrajectory > &trajectory_msg, const rclcpp::Time &time) |
| void | sort_to_local_joint_order (std::shared_ptr< trajectory_msgs::msg::JointTrajectory > trajectory_msg) const |
| bool | validate_trajectory_msg (const trajectory_msgs::msg::JointTrajectory &trajectory) const |
| void | add_new_trajectory_msg (const std::shared_ptr< trajectory_msgs::msg::JointTrajectory > &traj_msg) |
| bool | validate_trajectory_point_field (size_t joint_names_size, const std::vector< double > &vector_field, const std::string &string_for_vector_field, size_t i, bool allow_empty) const |
| void | preempt_active_goal () |
| std::shared_ptr< trajectory_msgs::msg::JointTrajectory > | set_hold_position () |
| set the current position with zero velocity and acceleration as new command | |
| std::shared_ptr< trajectory_msgs::msg::JointTrajectory > | decelerate_to_hold_position () |
| decelerate at constant rate to a holding position with zero velocity and acceleration as new command | |
| std::shared_ptr< trajectory_msgs::msg::JointTrajectory > | set_success_trajectory_point () |
| set last trajectory point to be repeated at success | |
| bool | reset () |
| bool | has_active_trajectory () const |
| void | publish_state (const rclcpp::Time &time, const JointTrajectoryPoint &desired_state, const JointTrajectoryPoint ¤t_state, const JointTrajectoryPoint &state_error) |
| void | read_state_from_state_interfaces (JointTrajectoryPoint &state) |
| void | update_state_from_command_interfaces (JointTrajectoryPoint &state) |
| bool | read_commands_from_command_interfaces (JointTrajectoryPoint &commands) |
| void | query_state_service (const std::shared_ptr< control_msgs::srv::QueryTrajectoryState::Request > request, std::shared_ptr< control_msgs::srv::QueryTrajectoryState::Response > response) |
Additional Inherited Members | |
| Protected Types inherited from joint_trajectory_controller::JointTrajectoryController | |
| template<typename T> | |
| using | InterfaceReferences = std::vector<std::vector<std::reference_wrapper<T>>> |
| using | PidPtr = std::shared_ptr<control_toolbox::Pid> |
| using | ControllerStateMsg = control_msgs::msg::JointTrajectoryControllerState |
| using | StatePublisher = realtime_tools::RealtimePublisher<ControllerStateMsg> |
| using | StatePublisherPtr = std::unique_ptr<StatePublisher> |
| using | FollowJTrajAction = control_msgs::action::FollowJointTrajectory |
| using | RealtimeGoalHandle = realtime_tools::RealtimeServerGoalHandle<FollowJTrajAction> |
| using | RealtimeGoalHandlePtr = std::shared_ptr<RealtimeGoalHandle> |
| using | JointTrajectoryPoint = trajectory_msgs::msg::JointTrajectoryPoint |
| Protected Attributes inherited from joint_trajectory_controller::JointTrajectoryController | |
| const std::vector< std::string > | allowed_interface_types_ |
| trajectory_msgs::msg::JointTrajectoryPoint | state_current_ |
| trajectory_msgs::msg::JointTrajectoryPoint | command_current_ |
| trajectory_msgs::msg::JointTrajectoryPoint | command_next_ |
| trajectory_msgs::msg::JointTrajectoryPoint | state_desired_ |
| trajectory_msgs::msg::JointTrajectoryPoint | state_error_ |
| trajectory_msgs::msg::JointTrajectoryPoint | blend_sample_ |
| trajectory_msgs::msg::JointTrajectoryPoint | blend_bridge_ |
| std::vector< bool > | blend_commanded_ |
| size_t | blend_prefix_size_ = 0 |
| size_t | dof_ |
| size_t | num_cmd_joints_ |
| std::vector< size_t > | map_cmd_to_joints_ |
| std::vector< std::string > | command_joint_names_ |
| std::shared_ptr< ParamListener > | param_listener_ |
| Params | params_ |
| rclcpp::Duration | update_period_ {0, 0} |
| rclcpp::Time | traj_time_ |
| trajectory_msgs::msg::JointTrajectoryPoint | last_commanded_state_ |
| rclcpp::Time | last_commanded_time_ |
| realtime_tools::RealtimeThreadSafeBox< trajectory_msgs::msg::JointTrajectoryPoint > | rt_last_commanded_state_ |
| interpolation_methods::InterpolationMethod | interpolation_method_ |
| Specify interpolation method. Default to splines. | |
| InterfaceReferences< hardware_interface::LoanedCommandInterface > | joint_command_interface_ |
| InterfaceReferences< hardware_interface::LoanedStateInterface > | joint_state_interface_ |
| std::optional< std::reference_wrapper< hardware_interface::LoanedStateInterface > > | scaling_state_interface_ |
| std::optional< std::reference_wrapper< hardware_interface::LoanedCommandInterface > > | scaling_command_interface_ |
| bool | has_position_state_interface_ = false |
| bool | has_velocity_state_interface_ = false |
| bool | has_acceleration_state_interface_ = false |
| bool | has_position_command_interface_ = false |
| bool | has_velocity_command_interface_ = false |
| bool | has_acceleration_command_interface_ = false |
| bool | has_effort_command_interface_ = false |
| bool | use_closed_loop_pid_adapter_ = false |
| If true, a velocity feedforward term plus corrective PID term is used. | |
| std::vector< PidPtr > | pids_ |
| std::vector< double > | ff_velocity_scale_ |
| std::vector< bool > | joints_angle_wraparound_ |
| std::vector< double > | closed_loop_pid_command_ |
| bool | should_decelerate_on_cancel_ = false |
| std::vector< double > | max_decel_ |
| std::vector< double > | stop_time_ |
| std::vector< double > | hold_position_ |
| std::vector< double > | stop_direction_ |
| std::shared_ptr< trajectory_msgs::msg::JointTrajectory > | stop_trajectory_ |
| std::atomic< double > | scaling_factor_ {1.0} |
| std::atomic< double > | scaling_factor_cmd_ {1.0} |
| double | cmd_timeout_ |
| std::atomic< bool > | rt_is_holding_ {false} |
| std::atomic< bool > | subscriber_is_active_ {false} |
| rclcpp::Subscription< trajectory_msgs::msg::JointTrajectory >::SharedPtr | joint_command_subscriber_ |
| rclcpp::Service< control_msgs::srv::QueryTrajectoryState >::SharedPtr | query_state_srv_ |
| std::unique_ptr< Trajectory > | current_trajectory_ = nullptr |
| realtime_tools::RealtimeThreadSafeBox< std::shared_ptr< trajectory_msgs::msg::JointTrajectory > > | rt_new_trajectory_msg_ |
| std::shared_ptr< trajectory_msgs::msg::JointTrajectory > | hold_position_msg_ptr_ = nullptr |
| StatePublisherPtr | state_publisher_ |
| ControllerStateMsg | state_msg_ |
| rclcpp_action::Server< FollowJTrajAction >::SharedPtr | action_server_ |
| realtime_tools::RealtimeThreadSafeBox< RealtimeGoalHandlePtr > | rt_active_goal_ |
| RealtimeGoalHandlePtr | rt_active_goal_local_ {nullptr} |
| std::atomic< bool > | rt_has_pending_goal_ {false} |
| rclcpp::TimerBase::SharedPtr | goal_handle_timer_ |
| rclcpp::Duration | goal_handle_timer_period_ = rclcpp::Duration(50ms) |
| SegmentTolerances | default_tolerances_ |
| realtime_tools::RealtimeThreadSafeBox< SegmentTolerances > | rt_goal_tolerances_ |
| SegmentTolerances | active_tol_ |
| Protected Attributes inherited from controller_interface::ControllerInterfaceBase | |
| std::vector< hardware_interface::LoanedCommandInterface > | command_interfaces_ |
| Loaned command interfaces. | |
| std::vector< hardware_interface::LoanedStateInterface > | state_interfaces_ |
| Loaned state interfaces. | |
| pal_statistics::RegistrationsRAII | stats_registrations_ |
Executes Cartesian motion on top of the Joint Trajectory Controller (JTC).
Accepts a MultiDOFJointTrajectory of end-effector poses (single pose or an action chunk), interpolates it in Cartesian space (cubic-spline translation + SLERP orientation), resamples the path densely and runs differential inverse kinematics to produce an ordinary joint-space trajectory. The joint trajectory is handed to JTC, whose update loop executes it unchanged.
IK runs once per incoming message in the (non-RT) subscription callback, so the real-time loop stays pure JTC. The joints parameter names the real robot joints; the kinematics plugin (kinematics_interface, KDL by default) provides the forward kinematics and Jacobian.
|
overridevirtual |
Extending interface with initialization method which is individual for each controller.
Implements controller_interface::ControllerInterfaceBase.