ros2_control - rolling
|
#include <controller_interface_base.hpp>
Public Member Functions | |
virtual CONTROLLER_INTERFACE_PUBLIC InterfaceConfiguration | command_interface_configuration () const =0 |
Get configuration for controller's required command interfaces. More... | |
virtual CONTROLLER_INTERFACE_PUBLIC InterfaceConfiguration | state_interface_configuration () const =0 |
Get configuration for controller's required state interfaces. More... | |
virtual CONTROLLER_INTERFACE_PUBLIC 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. More... | |
virtual CONTROLLER_INTERFACE_PUBLIC void | release_interfaces () |
Method that releases the Loaned interfaces from the controller. More... | |
CONTROLLER_INTERFACE_PUBLIC 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) |
CONTROLLER_INTERFACE_PUBLIC const rclcpp_lifecycle::State & | configure () |
Custom configure method to read additional parameters for controller-nodes. | |
virtual CONTROLLER_INTERFACE_PUBLIC CallbackReturn | on_init ()=0 |
Extending interface with initialization method which is individual for each controller. | |
virtual CONTROLLER_INTERFACE_PUBLIC return_type | update (const rclcpp::Time &time, const rclcpp::Duration &period)=0 |
CONTROLLER_INTERFACE_PUBLIC ControllerUpdateStatus | trigger_update (const rclcpp::Time &time, const rclcpp::Duration &period) |
CONTROLLER_INTERFACE_PUBLIC std::shared_ptr< rclcpp_lifecycle::LifecycleNode > | get_node () |
CONTROLLER_INTERFACE_PUBLIC std::shared_ptr< const rclcpp_lifecycle::LifecycleNode > | get_node () const |
CONTROLLER_INTERFACE_PUBLIC const rclcpp_lifecycle::State & | get_lifecycle_state () const |
CONTROLLER_INTERFACE_PUBLIC unsigned int | get_update_rate () const |
CONTROLLER_INTERFACE_PUBLIC bool | is_async () const |
CONTROLLER_INTERFACE_PUBLIC const std::string & | get_robot_description () const |
virtual CONTROLLER_INTERFACE_PUBLIC rclcpp::NodeOptions | define_custom_node_options () const |
template<typename ParameterT > | |
auto | auto_declare (const std::string &name, const ParameterT &default_value) |
Declare and initialize a parameter with a type. More... | |
virtual CONTROLLER_INTERFACE_PUBLIC bool | is_chainable () const =0 |
Get information if a controller is chainable. More... | |
virtual CONTROLLER_INTERFACE_PUBLIC std::vector< hardware_interface::CommandInterface::SharedPtr > | export_reference_interfaces ()=0 |
virtual CONTROLLER_INTERFACE_PUBLIC std::vector< hardware_interface::StateInterface::ConstSharedPtr > | export_state_interfaces ()=0 |
virtual CONTROLLER_INTERFACE_PUBLIC bool | set_chained_mode (bool chained_mode)=0 |
virtual CONTROLLER_INTERFACE_PUBLIC bool | is_in_chained_mode () const =0 |
Get information if a controller is currently in chained mode. More... | |
CONTROLLER_INTERFACE_PUBLIC void | wait_for_trigger_update_to_finish () |
Protected Attributes | |
std::vector< hardware_interface::LoanedCommandInterface > | command_interfaces_ |
std::vector< hardware_interface::LoanedStateInterface > | state_interfaces_ |
Base interface class for an controller. The interface may not be used to implement a controller. The class provides definitions for ControllerInterface
and ChainableControllerInterface
that should be implemented and extended for a specific controller.
|
virtual |
Method that assigns the Loaned interfaces to the controller.
Method used by the controller_manager to assign the interfaces to the controller.
release_interfaces
method by overriding it to release the interfaces.[in] | command_interfaces | vector of command interfaces to be assigned to the controller. |
[in] | state_interfaces | vector of state interfaces to be assigned to the controller. |
|
inline |
Declare and initialize a parameter with a type.
Wrapper function for templated node's declare_parameter() which checks if parameter is already declared. For use in all components that inherit from ControllerInterfaceBase
|
pure virtual |
Get configuration for controller's required command interfaces.
Method used by the controller_manager to get the set of command interfaces used by the controller. Each controller can use individual method to determine interface names that in simples case have the following format: <joint>/<interface>
. The method is called only in inactive
or active
state, i.e., on_configure
has to be called first. The configuration is used to check if controller can be activated and to claim interfaces from hardware. The claimed interfaces are populated in the command_interfaces_ member.
Implemented in tricycle_controller::TricycleController, steering_controllers_library::SteeringControllersLibrary, range_sensor_broadcaster::RangeSensorBroadcaster, pose_broadcaster::PoseBroadcaster, pid_controller::PidController, parallel_gripper_action_controller::GripperActionController, mecanum_drive_controller::MecanumDriveController, joint_trajectory_controller::JointTrajectoryController, joint_state_broadcaster::JointStateBroadcaster, imu_sensor_broadcaster::IMUSensorBroadcaster, gripper_action_controller::GripperActionController< HardwareInterface >, gpio_controllers::GpioCommandController, forward_command_controller::ForwardControllersBase, force_torque_sensor_broadcaster::ForceTorqueSensorBroadcaster, diff_drive_controller::DiffDriveController, admittance_controller::AdmittanceController, ros2_control_demo_example_7::RobotController, passthrough_controller::PassthroughController, and ros2_control_demo_example_10::GPIOController.
|
inlinevirtual |
Method used by the controller_manager for base NodeOptions to instantiate the Lifecycle node of the controller upon loading the controller.
|
pure virtual |
Export interfaces for a chainable controller that can be used as command interface of other controllers.
Implemented in controller_interface::ControllerInterface, and controller_interface::ChainableControllerInterface.
|
pure virtual |
Export interfaces for a chainable controller that can be used as state interface by other controllers.
Implemented in controller_interface::ControllerInterface, and controller_interface::ChainableControllerInterface.
|
pure virtual |
Get information if a controller is chainable.
Get information if a controller is chainable.
Implemented in controller_interface::ControllerInterface, and controller_interface::ChainableControllerInterface.
|
pure virtual |
Get information if a controller is currently in chained mode.
Get information about controller if it is currently used in chained mode. In chained mode only internal interfaces are available and all subscribers are expected to be disabled. This prevents concurrent writing to controller's inputs from multiple sources.
Implemented in controller_interface::ControllerInterface, and controller_interface::ChainableControllerInterface.
|
virtual |
Method that releases the Loaned interfaces from the controller.
Method used by the controller_manager to release the interfaces from the controller.
|
pure virtual |
Set chained mode of a chainable controller. This method triggers internal processes to switch a chainable controller to "chained" mode and vice-versa. Setting controller to "chained" mode usually involves the usage of the controller's reference interfaces by the other controllers
Implemented in controller_interface::ControllerInterface, and controller_interface::ChainableControllerInterface.
|
pure virtual |
Get configuration for controller's required state interfaces.
Method used by the controller_manager to get the set of state interface used by the controller. Each controller can use individual method to determine interface names that in simples case have the following format: <joint>/<interface>
. The method is called only in inactive
or active
state, i.e., on_configure
has to be called first. The configuration is used to check if controller can be activated and to claim interfaces from hardware. The claimed interfaces are populated in the state_interfaces_ member.
Implemented in tricycle_controller::TricycleController, steering_controllers_library::SteeringControllersLibrary, range_sensor_broadcaster::RangeSensorBroadcaster, pose_broadcaster::PoseBroadcaster, pid_controller::PidController, parallel_gripper_action_controller::GripperActionController, mecanum_drive_controller::MecanumDriveController, joint_trajectory_controller::JointTrajectoryController, joint_state_broadcaster::JointStateBroadcaster, imu_sensor_broadcaster::IMUSensorBroadcaster, gripper_action_controller::GripperActionController< HardwareInterface >, gpio_controllers::GpioCommandController, forward_command_controller::ForwardControllersBase, force_torque_sensor_broadcaster::ForceTorqueSensorBroadcaster, diff_drive_controller::DiffDriveController, admittance_controller::AdmittanceController, ros2_control_demo_example_7::RobotController, passthrough_controller::PassthroughController, and ros2_control_demo_example_10::GPIOController.
ControllerUpdateStatus controller_interface::ControllerInterfaceBase::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. The method called in the (real-time) control loop.
[in] | time | The time at the start of this control loop iteration |
[in] | period | The measured time taken by the last control loop iteration |
|
pure virtual |
Control step update. Command interfaces are updated based on on reference inputs and current states. The method called in the (real-time) control loop.
[in] | time | The time at the start of this control loop iteration |
[in] | period | The measured time since the last control loop iteration |
Implemented in tricycle_controller::TricycleController, range_sensor_broadcaster::RangeSensorBroadcaster, pose_broadcaster::PoseBroadcaster, parallel_gripper_action_controller::GripperActionController, joint_trajectory_controller::JointTrajectoryController, joint_state_broadcaster::JointStateBroadcaster, imu_sensor_broadcaster::IMUSensorBroadcaster, gripper_action_controller::GripperActionController< HardwareInterface >, gpio_controllers::GpioCommandController, forward_command_controller::ForwardControllersBase, diff_drive_controller::DiffDriveController, ros2_control_demo_example_7::RobotController, ros2_control_demo_example_10::GPIOController, and controller_interface::ChainableControllerInterface.
void controller_interface::ControllerInterfaceBase::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.
If the controller is running in async mode, the method will wait for the current async update to finish. If the controller is not running in async mode, the method will do nothing.