diff --git a/versions/main/_controller_interface_8cpp_source.html b/versions/main/_controller_interface_8cpp_source.html new file mode 100644 index 000000000..ab5f40c02 --- /dev/null +++ b/versions/main/_controller_interface_8cpp_source.html @@ -0,0 +1,949 @@ + + +
+ + + + +
+ Modulo 4.1.0
+
+ |
+
+ Modulo 4.1.0
+
+ |
+
+ Modulo 4.1.0
+
+ |
+
+ Modulo 4.1.0
+
+ |
+
+ Modulo 4.1.0
+
+ |
+
This is the complete list of members for modulo_controllers::ControllerInterface, including all inherited members.
+add_command_interface(const std::string &name, const std::string &interface) | modulo_controllers::ControllerInterface | protected |
add_input(const std::string &name, const std::string &topic_name="") | modulo_controllers::ControllerInterface | inlineprotected |
add_input(const std::string &name, const std::string &topic_name) (defined in modulo_controllers::ControllerInterface) | modulo_controllers::ControllerInterface | inlineprotected |
add_input(const std::string &name, const std::string &topic_name) (defined in modulo_controllers::ControllerInterface) | modulo_controllers::ControllerInterface | inlineprotected |
add_input(const std::string &name, const std::string &topic_name) (defined in modulo_controllers::ControllerInterface) | modulo_controllers::ControllerInterface | inlineprotected |
add_output(const std::string &name, const std::string &topic_name="") | modulo_controllers::ControllerInterface | inlineprotected |
add_output(const std::string &name, const std::string &topic_name) (defined in modulo_controllers::ControllerInterface) | modulo_controllers::ControllerInterface | inlineprotected |
add_output(const std::string &name, const std::string &topic_name) (defined in modulo_controllers::ControllerInterface) | modulo_controllers::ControllerInterface | inlineprotected |
add_output(const std::string &name, const std::string &topic_name) (defined in modulo_controllers::ControllerInterface) | modulo_controllers::ControllerInterface | inlineprotected |
add_parameter(const std::shared_ptr< state_representation::ParameterInterface > ¶meter, const std::string &description, bool read_only=false) | modulo_controllers::ControllerInterface | protected |
add_parameter(const std::string &name, const T &value, const std::string &description, bool read_only=false) | modulo_controllers::ControllerInterface | inlineprotected |
add_predicate(const std::string &predicate_name, bool predicate_value) | modulo_controllers::ControllerInterface | protected |
add_predicate(const std::string &predicate_name, const std::function< bool(void)> &predicate_function) | modulo_controllers::ControllerInterface | protected |
add_service(const std::string &service_name, const std::function< ControllerServiceResponse(void)> &callback) | modulo_controllers::ControllerInterface | protected |
add_service(const std::string &service_name, const std::function< ControllerServiceResponse(const std::string &string)> &callback) | modulo_controllers::ControllerInterface | protected |
add_state_interface(const std::string &name, const std::string &interface) | modulo_controllers::ControllerInterface | protected |
add_trigger(const std::string &trigger_name) | modulo_controllers::ControllerInterface | protected |
command_interface_configuration() const final | modulo_controllers::ControllerInterface | |
ControllerInterface(bool claim_all_state_interfaces=false) | modulo_controllers::ControllerInterface | |
evaluate(const rclcpp::Time &time, const std::chrono::nanoseconds &period)=0 | modulo_controllers::ControllerInterface | protectedpure virtual |
get_command_interface(const std::string &name, const std::string &interface) const | modulo_controllers::ControllerInterface | protected |
get_parameter(const std::string &name) const | modulo_controllers::ControllerInterface | protected |
get_parameter_value(const std::string &name) const | modulo_controllers::ControllerInterface | inlineprotected |
get_predicate(const std::string &predicate_name) const | modulo_controllers::ControllerInterface | protected |
get_qos() const | modulo_controllers::ControllerInterface | protected |
get_state_interface(const std::string &name, const std::string &interface) const | modulo_controllers::ControllerInterface | protected |
get_state_interfaces(const std::string &name) const | modulo_controllers::ControllerInterface | protected |
hardware_name_ | modulo_controllers::ControllerInterface | protected |
is_active() const | modulo_controllers::ControllerInterface | protected |
on_activate(const rclcpp_lifecycle::State &previous_state) final | modulo_controllers::ControllerInterface | |
on_activate() | modulo_controllers::ControllerInterface | protectedvirtual |
on_configure(const rclcpp_lifecycle::State &previous_state) final | modulo_controllers::ControllerInterface | |
on_configure() | modulo_controllers::ControllerInterface | protectedvirtual |
on_deactivate(const rclcpp_lifecycle::State &previous_state) final | modulo_controllers::ControllerInterface | |
on_deactivate() | modulo_controllers::ControllerInterface | protectedvirtual |
on_init() override | modulo_controllers::ControllerInterface | |
on_validate_parameter_callback(const std::shared_ptr< state_representation::ParameterInterface > ¶meter) | modulo_controllers::ControllerInterface | protectedvirtual |
read_input(const std::string &name) | modulo_controllers::ControllerInterface | inlineprotected |
read_input(const std::string &name) (defined in modulo_controllers::ControllerInterface) | modulo_controllers::ControllerInterface | inlineprotected |
read_input(const std::string &name) (defined in modulo_controllers::ControllerInterface) | modulo_controllers::ControllerInterface | inlineprotected |
read_input(const std::string &name) (defined in modulo_controllers::ControllerInterface) | modulo_controllers::ControllerInterface | inlineprotected |
read_state_interfaces() | modulo_controllers::ControllerInterface | protectedvirtual |
set_command_interface(const std::string &name, const std::string &interface, double value) | modulo_controllers::ControllerInterface | protected |
set_parameter_value(const std::string &name, const T &value) | modulo_controllers::ControllerInterface | inlineprotected |
set_predicate(const std::string &predicate_name, bool predicate_value) | modulo_controllers::ControllerInterface | protected |
set_predicate(const std::string &predicate_name, const std::function< bool(void)> &predicate_function) | modulo_controllers::ControllerInterface | protected |
set_qos(const rclcpp::QoS &qos) | modulo_controllers::ControllerInterface | protected |
state_interface_configuration() const final | modulo_controllers::ControllerInterface | |
trigger(const std::string &trigger_name) | modulo_controllers::ControllerInterface | protected |
update(const rclcpp::Time &time, const rclcpp::Duration &period) final | modulo_controllers::ControllerInterface | |
write_command_interfaces(const rclcpp::Duration &period) | modulo_controllers::ControllerInterface | protectedvirtual |
write_output(const std::string &name, const T &data) | modulo_controllers::ControllerInterface | inlineprotected |
write_output(const std::string &name, const bool &data) (defined in modulo_controllers::ControllerInterface) | modulo_controllers::ControllerInterface | inline |
write_output(const std::string &name, const double &data) (defined in modulo_controllers::ControllerInterface) | modulo_controllers::ControllerInterface | inline |
write_output(const std::string &name, const std::vector< double > &data) (defined in modulo_controllers::ControllerInterface) | modulo_controllers::ControllerInterface | inline |
write_output(const std::string &name, const int &data) (defined in modulo_controllers::ControllerInterface) | modulo_controllers::ControllerInterface | inline |
write_output(const std::string &name, const std::string &data) (defined in modulo_controllers::ControllerInterface) | modulo_controllers::ControllerInterface | inline |
+ Modulo 4.1.0
+
+ |
+
Base controller class to combine ros2_control, control libraries and modulo. + More...
+ +#include <ControllerInterface.hpp>
+Public Member Functions | |
ControllerInterface (bool claim_all_state_interfaces=false) | |
Default constructor. | |
CallbackReturn | on_init () override |
Declare parameters and register the on_set_parameters callback. | |
CallbackReturn | on_configure (const rclcpp_lifecycle::State &previous_state) final |
Set class properties from parameters and add signals. | |
CallbackReturn | on_activate (const rclcpp_lifecycle::State &previous_state) final |
Initialize internal data attributes from configured interfaces and wait for valid states from hardware. | |
CallbackReturn | on_deactivate (const rclcpp_lifecycle::State &previous_state) final |
Deactivate the controller. | |
controller_interface::return_type | update (const rclcpp::Time &time, const rclcpp::Duration &period) final |
Read the state interfaces, perform control evaluation and write the command interfaces. | |
controller_interface::InterfaceConfiguration | state_interface_configuration () const final |
Configure the state interfaces. | |
controller_interface::InterfaceConfiguration | command_interface_configuration () const final |
Configure the command interfaces. | |
template<> | |
void | write_output (const std::string &name, const bool &data) |
template<> | |
void | write_output (const std::string &name, const double &data) |
template<> | |
void | write_output (const std::string &name, const std::vector< double > &data) |
template<> | |
void | write_output (const std::string &name, const int &data) |
template<> | |
void | write_output (const std::string &name, const std::string &data) |
+Protected Member Functions | |
virtual CallbackReturn | on_configure () |
Configure the controller. | |
virtual CallbackReturn | on_activate () |
Activate the controller. | |
virtual CallbackReturn | on_deactivate () |
Deactivate the controller. | |
virtual controller_interface::return_type | read_state_interfaces () |
Read the state interfaces. | |
virtual controller_interface::return_type | write_command_interfaces (const rclcpp::Duration &period) |
Write the command interfaces. | |
virtual controller_interface::return_type | evaluate (const rclcpp::Time &time, const std::chrono::nanoseconds &period)=0 |
The control logic callback. | |
void | add_state_interface (const std::string &name, const std::string &interface) |
Add a state interface to the controller by name. | |
void | add_command_interface (const std::string &name, const std::string &interface) |
Add a command interface to the controller by name. | |
std::unordered_map< std::string, double > | get_state_interfaces (const std::string &name) const |
Get a map containing the state interfaces by name of the parent tag. | |
double | get_state_interface (const std::string &name, const std::string &interface) const |
Get the value of a state interface by name. | |
double | get_command_interface (const std::string &name, const std::string &interface) const |
Get the value of a command interface by name. | |
void | set_command_interface (const std::string &name, const std::string &interface, double value) |
Set the value of a command interface by name. | |
void | add_parameter (const std::shared_ptr< state_representation::ParameterInterface > ¶meter, const std::string &description, bool read_only=false) |
Add a parameter. | |
template<typename T > | |
void | add_parameter (const std::string &name, const T &value, const std::string &description, bool read_only=false) |
Add a parameter. | |
virtual bool | on_validate_parameter_callback (const std::shared_ptr< state_representation::ParameterInterface > ¶meter) |
Parameter validation function to be redefined by derived controller classes. | |
std::shared_ptr< state_representation::ParameterInterface > | get_parameter (const std::string &name) const |
Get a parameter by name. | |
template<typename T > | |
T | get_parameter_value (const std::string &name) const |
Get a parameter value by name. | |
template<typename T > | |
void | set_parameter_value (const std::string &name, const T &value) |
Set the value of a parameter. | |
void | add_predicate (const std::string &predicate_name, bool predicate_value) |
Add a predicate to the map of predicates. | |
void | add_predicate (const std::string &predicate_name, const std::function< bool(void)> &predicate_function) |
Add a predicate to the map of predicates based on a function to periodically call. | |
bool | get_predicate (const std::string &predicate_name) const |
Get the logical value of a predicate. | |
void | set_predicate (const std::string &predicate_name, bool predicate_value) |
Set the value of the predicate given as parameter, if the predicate is not found does not do anything. | |
void | set_predicate (const std::string &predicate_name, const std::function< bool(void)> &predicate_function) |
Set the value of the predicate given as parameter, if the predicate is not found does not do anything. | |
void | add_trigger (const std::string &trigger_name) |
Add a trigger to the controller. | |
void | trigger (const std::string &trigger_name) |
Latch the trigger with the provided name. | |
template<typename T > | |
void | add_input (const std::string &name, const std::string &topic_name="") |
Add an input to the controller. | |
template<typename T > | |
void | add_output (const std::string &name, const std::string &topic_name="") |
Add an output to the controller. | |
template<typename T > | |
std::optional< T > | read_input (const std::string &name) |
Read the most recent message of an input. | |
template<typename T > | |
void | write_output (const std::string &name, const T &data) |
Write an object to an output. | |
void | add_service (const std::string &service_name, const std::function< ControllerServiceResponse(void)> &callback) |
Add a service to trigger a callback function with no input arguments. | |
void | add_service (const std::string &service_name, const std::function< ControllerServiceResponse(const std::string &string)> &callback) |
Add a service to trigger a callback function with a string payload. | |
rclcpp::QoS | get_qos () const |
Getter of the Quality of Service attribute. | |
void | set_qos (const rclcpp::QoS &qos) |
Set the Quality of Service for ROS publishers and subscribers. | |
bool | is_active () const |
Check if the controller is currently in state active or not. | |
template<> | |
void | add_input (const std::string &name, const std::string &topic_name) |
template<> | |
void | add_input (const std::string &name, const std::string &topic_name) |
template<> | |
void | add_input (const std::string &name, const std::string &topic_name) |
template<> | |
void | add_output (const std::string &name, const std::string &topic_name) |
template<> | |
void | add_output (const std::string &name, const std::string &topic_name) |
template<> | |
void | add_output (const std::string &name, const std::string &topic_name) |
template<> | |
std::optional< bool > | read_input (const std::string &name) |
template<> | |
std::optional< double > | read_input (const std::string &name) |
template<> | |
std::optional< int > | read_input (const std::string &name) |
+Protected Attributes | |
std::string | hardware_name_ |
The hardware name provided by a parameter. | |
Base controller class to combine ros2_control, control libraries and modulo.
+ +Definition at line 98 of file ControllerInterface.hpp.
+modulo_controllers::ControllerInterface::ControllerInterface | +( | +bool | +claim_all_state_interfaces = false | ) | ++ |
Default constructor.
+claim_all_state_interfaces | Flag to indicate if all state interfaces should be claimed |
Definition at line 21 of file ControllerInterface.cpp.
+ +
+
|
+ +protected | +
Add a command interface to the controller by name.
+name | The name of the parent tag, e.g. the name of the joint, sensor or gpio |
interface | The desired command interface |
Definition at line 99 of file ControllerInterface.cpp.
+ +
+
|
+ +inlineprotected | +
Definition at line 666 of file ControllerInterface.hpp.
+ +
+
|
+ +inlineprotected | +
Definition at line 673 of file ControllerInterface.hpp.
+ +
+
|
+ +inlineprotected | +
Definition at line 688 of file ControllerInterface.hpp.
+ +
+
|
+ +inlineprotected | +
Add an input to the controller.
+Inputs should be added in the on_init function of the derived controllers. Doing this will create a ROS 2 subscription for the message type.
T | The type of the input data |
name | The name of the input |
topic_name | The topic name of the input (defaults to ~/name) |
Definition at line 657 of file ControllerInterface.hpp.
+ +
+
|
+ +inlineprotected | +
Definition at line 717 of file ControllerInterface.hpp.
+ +
+
|
+ +inlineprotected | +
Definition at line 722 of file ControllerInterface.hpp.
+ +
+
|
+ +inlineprotected | +
Definition at line 733 of file ControllerInterface.hpp.
+ +
+
|
+ +inlineprotected | +
Add an output to the controller.
+Outputs should be added in the on_init function of the derived controllers. Doing this will create a ROS 2 publisher for the message type and wrap it in a RealtimePublisher.
T | The type of the output data |
name | The name of the output |
topic_name | The topic name of the output (defaults to ~/name) |
Definition at line 711 of file ControllerInterface.hpp.
+ +
+
|
+ +protected | +
Add a parameter.
+This method stores a pointer reference to an existing Parameter object in the local parameter map and declares the equivalent ROS parameter on the ROS interface.
parameter | A ParameterInterface pointer to a Parameter instance |
description | The description of the parameter |
read_only | If true, the value of the parameter cannot be changed after declaration |
+
|
+ +inlineprotected | +
Add a parameter.
+This method creates a new Parameter object instance to reference in the local parameter map and declares the equivalent ROS parameter on the ROS interface.
T | The type of the parameter |
name | The name of the parameter |
value | The value of the parameter |
description | The description of the parameter |
read_only | If true, the value of the parameter cannot be changed after declaration |
Definition at line 622 of file ControllerInterface.hpp.
+ +
+
|
+ +protected | +
Add a predicate to the map of predicates.
+predicate_name | the name of the associated predicate |
predicate_value | the boolean value of the predicate |
Definition at line 383 of file ControllerInterface.cpp.
+ +
+
|
+ +protected | +
Add a predicate to the map of predicates based on a function to periodically call.
+predicate_name | the name of the associated predicate |
predicate_function | the function to call that returns the value of the predicate |
Definition at line 387 of file ControllerInterface.cpp.
+ +
+
|
+ +protected | +
Add a service to trigger a callback function with a string payload.
+The string payload can have an arbitrary format to parameterize and control the callback behaviour as desired. It is the responsibility of the service callback to parse the string according to some payload format. When adding a service with a string payload, be sure to document the payload format appropriately.
service_name | The name of the service |
callback | A service callback function with a string argument that returns a ControllerServiceResponse |
Definition at line 709 of file ControllerInterface.cpp.
+ +
+
|
+ +protected | +
Add a service to trigger a callback function with no input arguments.
+service_name | The name of the service |
callback | A service callback function with no arguments that returns a ControllerServiceResponse |
Definition at line 676 of file ControllerInterface.cpp.
+ +
+
|
+ +protected | +
Add a state interface to the controller by name.
+name | The name of the parent tag, e.g. the name of the joint, sensor or gpio |
interface | The desired state interface |
Definition at line 95 of file ControllerInterface.cpp.
+ +
+
|
+ +protected | +
Add a trigger to the controller.
+Triggers are predicates that are always false except when it's triggered in which case it is set back to false immediately after it is read.
trigger_name | The name of the trigger |
Definition at line 451 of file ControllerInterface.cpp.
+ +
+
|
+ +final | +
Configure the command interfaces.
+Definition at line 121 of file ControllerInterface.cpp.
+ +
+
|
+ +protectedpure virtual | +
The control logic callback.
+This method should be overridden by derived classes. It is called in the update() method between reading the state interfaces and writing the command interfaces.
time | The controller clock time |
period | Time elapsed since the last control evaluation |
+
|
+ +protected | +
Get the value of a command interface by name.
+name | The name of the parent tag, e.g. the name of the joint, sensor or gpio |
interface | The desired command interface |
out_of_range | if the desired command interface is not available |
Definition at line 283 of file ControllerInterface.cpp.
+ +
+
|
+ +protected | +
Get a parameter by name.
+name | The name of the parameter |
Definition at line 332 of file ControllerInterface.cpp.
+ +
+
|
+ +inlineprotected | +
Get a parameter value by name.
+T | The type of the parameter |
name | The name of the parameter |
Definition at line 632 of file ControllerInterface.hpp.
+ +
+
|
+ +protected | +
Get the logical value of a predicate.
+If the predicate is not found or the callable function fails, the return value is false.
predicate_name | the name of the predicate to retrieve from the map of predicates |
Definition at line 404 of file ControllerInterface.cpp.
+ +
+
|
+ +protected | +
Getter of the Quality of Service attribute.
+Definition at line 743 of file ControllerInterface.cpp.
+ +
+
|
+ +protected | +
Get the value of a state interface by name.
+name | The name of the parent tag, e.g. the name of the joint, sensor or gpio |
interface | The desired state interface |
out_of_range | if the desired state interface is not available |
Definition at line 279 of file ControllerInterface.cpp.
+ +
+
|
+ +protected | +
Get a map containing the state interfaces by name of the parent tag.
+name | The name of the parent tag, e.g. the name of the joint, sensor or gpio |
out_of_range | if the desired state interface is not available |
Definition at line 275 of file ControllerInterface.cpp.
+ +
+
|
+ +protected | +
Check if the controller is currently in state active or not.
+Definition at line 751 of file ControllerInterface.cpp.
+ +
+
|
+ +protectedvirtual | +
Activate the controller.
+This method should be overridden by derived classes.
Reimplemented in modulo_controllers::RobotControllerInterface.
+ +Definition at line 204 of file ControllerInterface.cpp.
+ +
+
|
+ +final | +
Initialize internal data attributes from configured interfaces and wait for valid states from hardware.
+This functions calls the internal on_activate() method
previous_state | The previous lifecycle state |
Definition at line 156 of file ControllerInterface.cpp.
+ +
+
|
+ +protectedvirtual | +
Configure the controller.
+This method should be overridden by derived classes.
Reimplemented in modulo_controllers::RobotControllerInterface.
+ +Definition at line 91 of file ControllerInterface.cpp.
+ +
+
|
+ +final | +
Set class properties from parameters and add signals.
+This functions calls the internal on_configure() method
previous_state | The previous lifecycle state |
Definition at line 56 of file ControllerInterface.cpp.
+ +
+
|
+ +protectedvirtual | +
Deactivate the controller.
+This method should be overridden by derived classes.
Definition at line 213 of file ControllerInterface.cpp.
+ +
+
|
+ +final | +
Deactivate the controller.
+previous_state | The previous lifecycle state |
Definition at line 209 of file ControllerInterface.cpp.
+ +
+
|
+ +override | +
Declare parameters and register the on_set_parameters callback.
+Definition at line 27 of file ControllerInterface.cpp.
+ +
+
|
+ +protectedvirtual | +
Parameter validation function to be redefined by derived controller classes.
+This method is automatically invoked whenever the ROS interface tried to modify a parameter. Validation and sanitization can be performed by reading or writing the value of the parameter through the ParameterInterface pointer, depending on the parameter name and desired controller behaviour. If the validation returns true, the updated parameter value (including any modifications) is applied. If the validation returns false, any changes to the parameter are discarded and the parameter value is not changed.
parameter | A ParameterInterface pointer to a Parameter instance |
Reimplemented in modulo_controllers::RobotControllerInterface.
+ +Definition at line 379 of file ControllerInterface.cpp.
+ +
+
|
+ +inlineprotected | +
Read the most recent message of an input.
+T | The expected type of the input data |
name | The name of the input |
Definition at line 743 of file ControllerInterface.hpp.
+ +
+
|
+ +inlineprotected | +
Definition at line 743 of file ControllerInterface.hpp.
+ +
+
|
+ +inlineprotected | +
Definition at line 743 of file ControllerInterface.hpp.
+ +
+
|
+ +inlineprotected | +
Definition at line 743 of file ControllerInterface.hpp.
+ +
+
|
+ +protectedvirtual | +
Read the state interfaces.
+Definition at line 258 of file ControllerInterface.cpp.
+ +
+
|
+ +protected | +
Set the value of a command interface by name.
+name | The name of the parent tag, e.g. the name of the sensor or gpio |
interface | The name of the command interface |
value | The new value of the interface |
Definition at line 287 of file ControllerInterface.cpp.
+ +
+
|
+ +inlineprotected | +
Set the value of a parameter.
+The parameter must have been previously declared. This method preserves the reference to the original Parameter instance
T | The type of the parameter |
name | The name of the parameter |
Definition at line 637 of file ControllerInterface.hpp.
+ +
+
|
+ +protected | +
Set the value of the predicate given as parameter, if the predicate is not found does not do anything.
+Even though the predicates are published periodically, the new value of this predicate will be published once immediately after setting it.
predicate_name | the name of the predicate to retrieve from the map of predicates |
predicate_value | the new value of the predicate |
Definition at line 431 of file ControllerInterface.cpp.
+ +
+
|
+ +protected | +
Set the value of the predicate given as parameter, if the predicate is not found does not do anything.
+Even though the predicates are published periodically, the new value of this predicate will be published once immediately after setting it.
predicate_name | the name of the predicate to retrieve from the map of predicates |
predicate_function | the function to call that returns the value of the predicate |
Definition at line 435 of file ControllerInterface.cpp.
+ +
+
|
+ +protected | +
Set the Quality of Service for ROS publishers and subscribers.
+qos | The desired Quality of Service |
Definition at line 747 of file ControllerInterface.cpp.
+ +
+
|
+ +final | +
Configure the state interfaces.
+Definition at line 138 of file ControllerInterface.cpp.
+ +
+
|
+ +protected | +
Latch the trigger with the provided name.
+trigger_name | The name of the trigger |
Definition at line 470 of file ControllerInterface.cpp.
+ +
+
|
+ +final | +
Read the state interfaces, perform control evaluation and write the command interfaces.
+time | The controller clock time |
period | Time elapsed since the last control evaluation |
Definition at line 218 of file ControllerInterface.cpp.
+ +
+
|
+ +protectedvirtual | +
Write the command interfaces.
+period | Time elapsed since the last control evaluation |
Definition at line 267 of file ControllerInterface.cpp.
+ +
+
|
+ +inline | +
Definition at line 895 of file ControllerInterface.hpp.
+ +
+
|
+ +inline | +
Definition at line 900 of file ControllerInterface.hpp.
+ +
+
|
+ +inline | +
Definition at line 910 of file ControllerInterface.hpp.
+ +
+
|
+ +inline | +
Definition at line 915 of file ControllerInterface.hpp.
+ +
+
|
+ +inline | +
Definition at line 905 of file ControllerInterface.hpp.
+ +
+
|
+ +inlineprotected | +
Write an object to an output.
+This uses the realtime publisher from add_output() to simplify publishing data in the realtime context of the control loop.
T | The type of the the object to publish |
name | The name of the output |
state | The object to publish |
Definition at line 829 of file ControllerInterface.hpp.
+ +
+
|
+ +protected | +
The hardware name provided by a parameter.
+ +Definition at line 448 of file ControllerInterface.hpp.
+ +
+ Modulo 4.1.0
+
+ |
+
This is the complete list of members for modulo_controllers::RobotControllerInterface, including all inherited members.
+
+ Modulo 4.1.0
+
+ |
+
Base controller class that automatically associates joints with a JointState object. + More...
+ +#include <RobotControllerInterface.hpp>
+Public Member Functions | |
RobotControllerInterface () | |
Default constructor. | |
RobotControllerInterface (bool robot_model_required, const std::string &control_type="") | |
Constructor with robot model flag and a control type to determine the command interfaces to claim. | |
CallbackReturn | on_init () override |
Declare parameters and register the on_set_parameters callback. | |
CallbackReturn | on_configure () override |
Configure the controller. | |
CallbackReturn | on_activate () override |
Activate the controller. | |
Public Member Functions inherited from modulo_controllers::ControllerInterface | |
ControllerInterface (bool claim_all_state_interfaces=false) | |
Default constructor. | |
CallbackReturn | on_init () override |
Declare parameters and register the on_set_parameters callback. | |
CallbackReturn | on_configure (const rclcpp_lifecycle::State &previous_state) final |
Set class properties from parameters and add signals. | |
CallbackReturn | on_activate (const rclcpp_lifecycle::State &previous_state) final |
Initialize internal data attributes from configured interfaces and wait for valid states from hardware. | |
CallbackReturn | on_deactivate (const rclcpp_lifecycle::State &previous_state) final |
Deactivate the controller. | |
controller_interface::return_type | update (const rclcpp::Time &time, const rclcpp::Duration &period) final |
Read the state interfaces, perform control evaluation and write the command interfaces. | |
controller_interface::InterfaceConfiguration | state_interface_configuration () const final |
Configure the state interfaces. | |
controller_interface::InterfaceConfiguration | command_interface_configuration () const final |
Configure the command interfaces. | |
template<> | |
void | write_output (const std::string &name, const bool &data) |
template<> | |
void | write_output (const std::string &name, const double &data) |
template<> | |
void | write_output (const std::string &name, const std::vector< double > &data) |
template<> | |
void | write_output (const std::string &name, const int &data) |
template<> | |
void | write_output (const std::string &name, const std::string &data) |
+Protected Member Functions | |
const state_representation::JointState & | get_joint_state () |
Access the joint state object. | |
const state_representation::CartesianState & | get_cartesian_state () |
Access the Cartesian state object. | |
const state_representation::CartesianWrench & | get_ft_sensor () |
Access the Cartesian wrench object. | |
void | compute_cartesian_state () |
Compute the Cartesian state from forward kinematics of the current joint state. | |
void | set_joint_command (const state_representation::JointState &joint_command) |
Set the joint command object. | |
bool | on_validate_parameter_callback (const std::shared_ptr< state_representation::ParameterInterface > ¶meter) override |
Parameter validation function to be redefined by derived controller classes. | |
Protected Member Functions inherited from modulo_controllers::ControllerInterface | |
virtual CallbackReturn | on_deactivate () |
Deactivate the controller. | |
virtual controller_interface::return_type | evaluate (const rclcpp::Time &time, const std::chrono::nanoseconds &period)=0 |
The control logic callback. | |
void | add_state_interface (const std::string &name, const std::string &interface) |
Add a state interface to the controller by name. | |
void | add_command_interface (const std::string &name, const std::string &interface) |
Add a command interface to the controller by name. | |
std::unordered_map< std::string, double > | get_state_interfaces (const std::string &name) const |
Get a map containing the state interfaces by name of the parent tag. | |
double | get_state_interface (const std::string &name, const std::string &interface) const |
Get the value of a state interface by name. | |
double | get_command_interface (const std::string &name, const std::string &interface) const |
Get the value of a command interface by name. | |
void | set_command_interface (const std::string &name, const std::string &interface, double value) |
Set the value of a command interface by name. | |
void | add_parameter (const std::shared_ptr< state_representation::ParameterInterface > ¶meter, const std::string &description, bool read_only=false) |
Add a parameter. | |
template<typename T > | |
void | add_parameter (const std::string &name, const T &value, const std::string &description, bool read_only=false) |
Add a parameter. | |
std::shared_ptr< state_representation::ParameterInterface > | get_parameter (const std::string &name) const |
Get a parameter by name. | |
template<typename T > | |
T | get_parameter_value (const std::string &name) const |
Get a parameter value by name. | |
template<typename T > | |
void | set_parameter_value (const std::string &name, const T &value) |
Set the value of a parameter. | |
void | add_predicate (const std::string &predicate_name, bool predicate_value) |
Add a predicate to the map of predicates. | |
void | add_predicate (const std::string &predicate_name, const std::function< bool(void)> &predicate_function) |
Add a predicate to the map of predicates based on a function to periodically call. | |
bool | get_predicate (const std::string &predicate_name) const |
Get the logical value of a predicate. | |
void | set_predicate (const std::string &predicate_name, bool predicate_value) |
Set the value of the predicate given as parameter, if the predicate is not found does not do anything. | |
void | set_predicate (const std::string &predicate_name, const std::function< bool(void)> &predicate_function) |
Set the value of the predicate given as parameter, if the predicate is not found does not do anything. | |
void | add_trigger (const std::string &trigger_name) |
Add a trigger to the controller. | |
void | trigger (const std::string &trigger_name) |
Latch the trigger with the provided name. | |
template<typename T > | |
void | add_input (const std::string &name, const std::string &topic_name="") |
Add an input to the controller. | |
template<typename T > | |
void | add_output (const std::string &name, const std::string &topic_name="") |
Add an output to the controller. | |
template<typename T > | |
std::optional< T > | read_input (const std::string &name) |
Read the most recent message of an input. | |
template<typename T > | |
void | write_output (const std::string &name, const T &data) |
Write an object to an output. | |
void | add_service (const std::string &service_name, const std::function< ControllerServiceResponse(void)> &callback) |
Add a service to trigger a callback function with no input arguments. | |
void | add_service (const std::string &service_name, const std::function< ControllerServiceResponse(const std::string &string)> &callback) |
Add a service to trigger a callback function with a string payload. | |
rclcpp::QoS | get_qos () const |
Getter of the Quality of Service attribute. | |
void | set_qos (const rclcpp::QoS &qos) |
Set the Quality of Service for ROS publishers and subscribers. | |
bool | is_active () const |
Check if the controller is currently in state active or not. | |
template<> | |
void | add_input (const std::string &name, const std::string &topic_name) |
template<> | |
void | add_input (const std::string &name, const std::string &topic_name) |
template<> | |
void | add_input (const std::string &name, const std::string &topic_name) |
template<> | |
void | add_output (const std::string &name, const std::string &topic_name) |
template<> | |
void | add_output (const std::string &name, const std::string &topic_name) |
template<> | |
void | add_output (const std::string &name, const std::string &topic_name) |
template<> | |
std::optional< bool > | read_input (const std::string &name) |
template<> | |
std::optional< double > | read_input (const std::string &name) |
template<> | |
std::optional< int > | read_input (const std::string &name) |
+Protected Attributes | |
std::shared_ptr< robot_model::Model > | robot_ |
Robot model object generated from URDF. | |
std::string | task_space_frame_ |
The frame in task space for forward kinematics calculations, if applicable. | |
std::string | ft_sensor_name_ |
The name of a force torque sensor in the hardware description. | |
std::string | ft_sensor_reference_frame_ |
The sensing reference frame. | |
Protected Attributes inherited from modulo_controllers::ControllerInterface | |
std::string | hardware_name_ |
The hardware name provided by a parameter. | |
Base controller class that automatically associates joints with a JointState object.
+The robot controller interface extends the functionality of the modulo controller interface byautomatically claiming all state interfaces from joints and command interfaces of a given type (position, velocity, effort or acceleration) for those same joints. Joint state and command are associated with these interfaces and abstracted as JointState pointers for derived classes to access. A robot model, Cartesian state and force-torque sensor state are similarly available based on the URDF and state interfaces.
+ +Definition at line 23 of file RobotControllerInterface.hpp.
+modulo_controllers::RobotControllerInterface::RobotControllerInterface | +( | +) | ++ |
Default constructor.
+ +Definition at line 17 of file RobotControllerInterface.cpp.
+ +
+
|
+ +explicit | +
Constructor with robot model flag and a control type to determine the command interfaces to claim.
+robot_model_required | Flag to indicate if a robot model is required for the controller |
control_type | One of [position, velocity, effort or acceleration] |
Definition at line 19 of file RobotControllerInterface.cpp.
+ +
+
|
+ +protected | +
Compute the Cartesian state from forward kinematics of the current joint state.
+This should only be used if a robot model has been generated, in which case the forward kinematics is calculated to get pose and twist for the desired target frame.
+ +Definition at line 302 of file RobotControllerInterface.cpp.
+ +
+
|
+ +protected | +
Access the Cartesian state object.
+This internally calls compute_cartesian_state()
Definition at line 292 of file RobotControllerInterface.cpp.
+ +
+
|
+ +protected | +
Access the Cartesian wrench object.
+Definition at line 298 of file RobotControllerInterface.cpp.
+ +
+
|
+ +protected | +
Access the joint state object.
+Definition at line 288 of file RobotControllerInterface.cpp.
+ +
+
|
+ +overridevirtual | +
Activate the controller.
+This method should be overridden by derived classes.
Initialize a fore torque sensor if applicable
+ +Reimplemented from modulo_controllers::ControllerInterface.
+ +Definition at line 176 of file RobotControllerInterface.cpp.
+ +
+
|
+ +overridevirtual | +
Configure the controller.
+This method should be overridden by derived classes.
Create a robot model from the robot description, get and sort the joints and construct the internal joint state object.
+ +Reimplemented from modulo_controllers::ControllerInterface.
+ +Definition at line 66 of file RobotControllerInterface.cpp.
+ +
+
|
+ +override | +
Declare parameters and register the on_set_parameters callback.
+Declare additional parameters.
+ +Definition at line 32 of file RobotControllerInterface.cpp.
+ +
+
|
+ +overrideprotectedvirtual | +
Parameter validation function to be redefined by derived controller classes.
+This method is automatically invoked whenever the ROS interface tried to modify a parameter. Validation and sanitization can be performed by reading or writing the value of the parameter through the ParameterInterface pointer, depending on the parameter name and desired controller behaviour. If the validation returns true, the updated parameter value (including any modifications) is applied. If the validation returns false, any changes to the parameter are discarded and the parameter value is not changed.
parameter | A ParameterInterface pointer to a Parameter instance |
Reimplemented from modulo_controllers::ControllerInterface.
+ +Definition at line 356 of file RobotControllerInterface.cpp.
+ +
+
|
+ +protected | +
Set the joint command object.
+joint_command | A JointState command object |
Definition at line 314 of file RobotControllerInterface.cpp.
+ +
+
|
+ +protected | +
The name of a force torque sensor in the hardware description.
+ +Definition at line 98 of file RobotControllerInterface.hpp.
+ +
+
|
+ +protected | +
The sensing reference frame.
+ +Definition at line 99 of file RobotControllerInterface.hpp.
+ +
+
|
+ +protected | +
Robot model object generated from URDF.
+ +Definition at line 95 of file RobotControllerInterface.hpp.
+ +
+
|
+ +protected | +
The frame in task space for forward kinematics calculations, if applicable.
+ +Definition at line 96 of file RobotControllerInterface.hpp.
+ +
+ Modulo 4.1.0
+
+ |
+
+ Modulo 4.1.0
+
+ |
+
+ Modulo 4.1.0
+
+ |
+
+Directories | |
utils | |
+Files | |
ControllerInterface.hpp | |
RobotControllerInterface.hpp | |
+ Modulo 4.1.0
+
+ |
+
+Directories | |
modulo_controllers | |
+ Modulo 4.1.0
+
+ |
+
+Directories | |
src | |
+ Modulo 4.1.0
+
+ |
+
ROS2 control interface class for controllers based on the control libraries stack.
+This C++ class derives from ros2_control ControllerInterface
and incorporates modulo
concepts like inputs, outputs, parameters, predicates, and services.
It supports the following parameters:
+hardware_name
[string]: the name of the hardware interfacerobot_description
[string]: the string formatted content of the controller's URDF descriptionjoints
[string_array]: a vector of joint names that the controller will claimactivation_timeout
[double]: the seconds to wait for valid data on state interfaces before activatinginput_validity_period
[double]: the maximum age of an input state before discarding it as expiredThe controller will claim either all or individually added state interfaces and individually added command interfaces. The class is intended to be used as a base class to implement any kind of controller.
+The activation_timeout
parameter gives the controller plugin and hardware interface additional time to read the initial states to prevent any NaN data from propagating through to the control logic.
The RobotControllerInterface
is derived from the ControllerInterface
. It incorporates JointState
and CartesianState
classes to leverage the robot_model::Model
class for forward and inverse kinematics, and supports force-torque sensor data in CartesianWrench
format.
+ Modulo 4.1.0
+
+ |
+
+ Modulo 4.1.0
+
+ |
+
+ Modulo 4.1.0
+
+ |
+
Modulo controllers utilities. +More...
++Typedefs | |
typedef std::variant< bool, std::function< bool(void)> > | PredicateVariant |
Modulo controllers utilities.
+typedef std::variant<bool, std::function<bool(void)> > modulo_controllers::utilities::PredicateVariant | +
Definition at line 13 of file utilities.hpp.
+ +Modulo Component Interfaces | |
Modulo Components | |
Modulo Core | |
Modulo Interfaces | |
Modulo Utils | |
modulo-controllers | |
Modulo Core | |
Modulo Interfaces | |
Modulo Utils |
+ Modulo 4.1.0
+
+ |
+
This is the complete list of members for modulo_controllers::ControllerInput, including all inherited members.
+buffer (defined in modulo_controllers::ControllerInput) | modulo_controllers::ControllerInput | |
ControllerInput(BufferVariant buffer_variant) (defined in modulo_controllers::ControllerInput) | modulo_controllers::ControllerInput | inline |
timestamp (defined in modulo_controllers::ControllerInput) | modulo_controllers::ControllerInput |
+ Modulo 4.1.0
+
+ |
+
Input structure to save topic data in a realtime buffer and timestamps in one object. + More...
+ +#include <ControllerInterface.hpp>
+Public Member Functions | |
ControllerInput (BufferVariant buffer_variant) | |
+Public Attributes | |
BufferVariant | buffer |
std::chrono::time_point< std::chrono::steady_clock > | timestamp |
Input structure to save topic data in a realtime buffer and timestamps in one object.
+ +Definition at line 77 of file ControllerInterface.hpp.
+
+
|
+ +inline | +
Definition at line 78 of file ControllerInterface.hpp.
+ +BufferVariant modulo_controllers::ControllerInput::buffer | +
Definition at line 79 of file ControllerInterface.hpp.
+ +std::chrono::time_point<std::chrono::steady_clock> modulo_controllers::ControllerInput::timestamp | +
Definition at line 80 of file ControllerInterface.hpp.
+ +
+ Modulo 4.1.0
+
+ |
+
This is the complete list of members for modulo_controllers::ControllerServiceResponse, including all inherited members.
+message (defined in modulo_controllers::ControllerServiceResponse) | modulo_controllers::ControllerServiceResponse | |
success (defined in modulo_controllers::ControllerServiceResponse) | modulo_controllers::ControllerServiceResponse |
+ Modulo 4.1.0
+
+ |
+
Response structure to be returned by controller services. + More...
+ +#include <ControllerInterface.hpp>
+Public Attributes | |
bool | success |
std::string | message |
Response structure to be returned by controller services.
+The structure contains a bool success field and a string message field. This information is used to provide feedback on the service outcome to the service client.
+ +Definition at line 89 of file ControllerInterface.hpp.
+std::string modulo_controllers::ControllerServiceResponse::message | +
Definition at line 91 of file ControllerInterface.hpp.
+ +bool modulo_controllers::ControllerServiceResponse::success | +
Definition at line 90 of file ControllerInterface.hpp.
+ +