Class HmsModule
Defined in File hms.hpp
Inheritance Relationships
Base Type
public rclcpp_lifecycle::LifecycleNode
Class Documentation
-
class psdk_ros2::HmsModule : public rclcpp_lifecycle::LifecycleNode
Public Functions
-
explicit HmsModule(const std::string &name)
Construct a new HmsModule object.
- Parameters
node_name – Name of the node
-
CallbackReturn on_configure(const rclcpp_lifecycle::State &state)
Configures the HmsModule. Creates the ROS 2 subscribers and services.
- Parameters
state – rclcpp_lifecycle::State. Current state of the node.
- Returns
CallbackReturn SUCCESS or FAILURE
-
CallbackReturn on_activate(const rclcpp_lifecycle::State &state)
Activates the HmsModule.
- Parameters
state – rclcpp_lifecycle::State. Current state of the node.
- Returns
CallbackReturn SUCCESS or FAILURE
-
CallbackReturn on_cleanup(const rclcpp_lifecycle::State &state)
Cleans the HmsModule. Resets the ROS 2 subscribers and services.
- Parameters
state – rclcpp_lifecycle::State. Current state of the node.
- Returns
CallbackReturn SUCCESS or FAILURE
-
CallbackReturn on_deactivate(const rclcpp_lifecycle::State &state)
Deactivates the HmsModule.
- Parameters
state – rclcpp_lifecycle::State. Current state of the node.
- Returns
CallbackReturn SUCCESS or FAILURE
-
CallbackReturn on_shutdown(const rclcpp_lifecycle::State &state)
Shuts down the HmsModule.
- Parameters
state – rclcpp_lifecycle::State. Current state of the node.
- Returns
CallbackReturn SUCCESS or FAILURE
-
bool init()
Initialize the health monitoring system (HMS) module.
Note
Since the HMS module callback function involves a ROS2 publisher, this init method should be invoked after ROS2 elements have been initialized.
- Returns
true/false
-
bool deinit()
Deinitialize the health monitoring system (HMS) module.
- Returns
true/false
Private Functions
-
T_DjiReturnCode hms_callback(T_DjiHmsInfoTable hms_info_table)
Callback function registered to retrieve HMS information. DJI pushes data at a fixed frequency of 1Hz.
- Parameters
hms_info_table – Array of HMS info messages
- Returns
T_DjiReturnCode error code indicating whether there have been any issues processing the HMS info table
-
psdk_interfaces::msg::HmsInfoTable to_ros2_msg(const T_DjiHmsInfoTable &hms_info_table, const nlohmann::json &codes, const char *language = "en")
Create a ‘psdk_interfaces::msg::HmsInfoTable’ from a PSDK HMS message of type ‘T_DjiHmsInfoTable’, given a JSON with all known return codes and a language to retrieve the return code messages in.
- Parameters
hms_info_table – HMS message from PSDK.
codes – JSON containing known return codes.
language – Language to fetch the return codes in.
- Returns
psdk_interfaces::msg::HmsInfoTable
-
explicit HmsModule(const std::string &name)