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

Add Interfaces for reporting of error and warning messages from HW #1319

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
2a065a3
move creation of stateinterfaces to systeminterface
mamueluth Dec 7, 2023
1e35d1f
store description in state_interface and provide functions for
mamueluth Dec 8, 2023
8334d9f
return correct name for InterfaceDescription
mamueluth Dec 11, 2023
e3ca9ef
move parsing of interface description to component parser
mamueluth Dec 11, 2023
112f20f
adjusted actuator- and sensor_interface as well
mamueluth Dec 12, 2023
e6d49e3
add first tests
mamueluth Dec 18, 2023
4b43db4
adjust sensor_interface getting/setting and add tests
mamueluth Dec 18, 2023
7f7d106
add more tests
mamueluth Dec 18, 2023
4f3ce18
first steps towards variants and storing of value in handle, missing:
mamueluth Dec 19, 2023
dedf062
add variant support
mamueluth Dec 19, 2023
5e244a6
adjusted resource manager to work with shared_ptr adapt actuator,sensor
mamueluth Dec 20, 2023
8313284
cleanup
mamueluth Dec 20, 2023
322412d
fix failing tests
mamueluth Dec 20, 2023
5421081
change rest of component_interface test and mark what should be removed
mamueluth Dec 21, 2023
6b214a2
code review suggestions and:
mamueluth Jan 23, 2024
8ea003b
undo prefix_ -> prefix (HWInfo) and Command-/StateIntefaceSharedPtr
mamueluth Jan 26, 2024
373b182
merge parser functions
mamueluth Jan 26, 2024
18301da
export_interfaces_2() virtual for custom interface export
mamueluth Jan 29, 2024
d7b2fb1
use unordered map and adjust tests
mamueluth Jan 29, 2024
e2f1564
make states and commands of component interfaces private
mamueluth Feb 1, 2024
a48e726
add interface for warning, error and report
mamueluth Jan 11, 2024
63c523f
review suggestions
mamueluth Jan 24, 2024
b692f61
add basic test for error codes setting
mamueluth Jan 29, 2024
ccfe700
remove rebase artefacts
mamueluth Feb 1, 2024
3d017a6
docs for error and warning signals
mamueluth Apr 11, 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 doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ Concepts
Controller Manager <../controller_manager/doc/userdoc.rst>
Controller Chaining / Cascade Control <../controller_manager/doc/controller_chaining.rst>
Hardware Components <../hardware_interface/doc/hardware_components_userdoc.rst>
Hardware Components <../hardware_interface/doc/error_and_warning_interfaces_userdoc.rst>
Mock Components <../hardware_interface/doc/mock_components_userdoc.rst>
9 changes: 9 additions & 0 deletions hardware_interface/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ if(BUILD_TESTING)

ament_add_gmock(test_component_interfaces test/test_component_interfaces.cpp)
target_link_libraries(test_component_interfaces hardware_interface)
ament_target_dependencies(test_component_interfaces ros2_control_test_assets)

ament_add_gmock(test_component_interfaces_custom_export test/test_component_interfaces_custom_export.cpp)
target_link_libraries(test_component_interfaces_custom_export hardware_interface)
ament_target_dependencies(test_component_interfaces_custom_export ros2_control_test_assets)

ament_add_gmock(test_error_warning_codes test/test_error_warning_codes.cpp)
target_link_libraries(test_error_warning_codes hardware_interface)
ament_target_dependencies(test_error_warning_codes ros2_control_test_assets)

ament_add_gmock(test_component_parser test/test_component_parser.cpp)
target_link_libraries(test_component_parser hardware_interface)
Expand Down
28 changes: 28 additions & 0 deletions hardware_interface/doc/error_and_warning_interfaces_userdoc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
:github_url: https://github.com/ros-controls/ros2_control/blob/{REPOS_FILE_BRANCH}/hardware_interface/doc/error_and_warning_interfaces_userdoc.rst

.. _error_and_warning_interfaces_userdoc:

Error and Warning Interfaces
============================

By default we now create the following error and warning interfaces:

+-----------------+--------------+----------------------------------------------------------------------------------------------------------------------+
| Type | Datatype | Description |
+=================+====================+================================================================================================================+
| Emergency Stop | Bool | Used for signaling that hardwares emergency stop is active. Only for Actuator and System. |
+-----------------+--------------------+----------------------------------------------------------------------------------------------------------------+
+-----------------+--------------------+----------------------------------------------------------------------------------------------------------------+
| Error Code | array<uint8_t, 32> | Used for sending 32 error codes (uint8_t) at the same time. |
+-----------------+--------------------+----------------------------------------------------------------------------------------------------------------+
| Error Message | array<string, 32> | Used for sending 32 error messages where the message at position x corresponds to error code at position x. |
+-----------------+--------------------+----------------------------------------------------------------------------------------------------------------+
+-----------------+--------------------+----------------------------------------------------------------------------------------------------------------+
| Warning Code | array<int8_t, 32> | Used for sending 32 Warning codes (int8_t) at the same time. |
+-----------------+--------------------+----------------------------------------------------------------------------------------------------------------+
| Warning Message | array<string, 32> | Used for sending 32 warning messages where the message at position x corresponds to warning code at position x.|
+-----------------+--------------------+----------------------------------------------------------------------------------------------------------------+

The error and warning interfaces are created as ``StateInterfaces`` and are stored inside the Actuator-, Sensor- or SystemInterface. They can be accessed via getter and setter methods. E.g. if you want to get/set the emergency stop signal you can do so with the ``get_emergency_stop()`` or ``set_emergency_stop(const bool & emergency_stop)`` methods. For the error and warning signals similar getters and setters exist.

Note: The SensorInterface does not have a Emergency Stop interface.
4 changes: 2 additions & 2 deletions hardware_interface/include/hardware_interface/actuator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ class Actuator final
const rclcpp_lifecycle::State & error();

HARDWARE_INTERFACE_PUBLIC
std::vector<StateInterface> export_state_interfaces();
std::vector<std::shared_ptr<StateInterface>> export_state_interfaces();

HARDWARE_INTERFACE_PUBLIC
std::vector<CommandInterface> export_command_interfaces();
std::vector<std::shared_ptr<CommandInterface>> export_command_interfaces();

HARDWARE_INTERFACE_PUBLIC
return_type prepare_command_mode_switch(
Expand Down
Loading
Loading