Class PSDKWrapper
Defined in File psdk_wrapper.hpp
Nested Relationships
Nested Types
Inheritance Relationships
Base Type
public rclcpp_lifecycle::LifecycleNode
Class Documentation
-
class psdk_ros2::PSDKWrapper : public rclcpp_lifecycle::LifecycleNode
A ROS 2 wrapper that brings all the DJI PSDK functionalities to ROS 2.
Public Functions
-
explicit PSDKWrapper(const std::string &node_name)
Construct a new PSDKWrapper object.
- Parameters
node_name –
-
~PSDKWrapper()
Destroy the PSDKWrapper object.
-
CallbackReturn on_configure(const rclcpp_lifecycle::State &state) override
Configures member variable and sets the environment.
- Parameters
state – Reference to Lifecycle state
- Returns
CallbackReturn SUCCESS or FAILURE
-
CallbackReturn on_activate(const rclcpp_lifecycle::State &state) override
Initializes main PSDK modules.
- Parameters
state – Reference to Lifecycle state
- Returns
CallbackReturn SUCCESS or FAILURE
-
CallbackReturn on_deactivate(const rclcpp_lifecycle::State &state) override
Deactivates main PSDK modules and other member variables.
- Parameters
state – Reference to Lifecycle state
- Returns
CallbackReturn SUCCESS or FAILURE
-
CallbackReturn on_cleanup(const rclcpp_lifecycle::State &state) override
Resets member variables.
- Parameters
state – Reference to Lifecycle state
- Returns
CallbackReturn SUCCESS or FAILURE
-
CallbackReturn on_shutdown(const rclcpp_lifecycle::State &state) override
Deinitializes main PSDK modules.
- Parameters
state – Reference to Lifecycle state
- Returns
CallbackReturn SUCCESS or FAILURE
Private Functions
Creates a PSDK module.
- Template Parameters
ModuleType – Type of the module
- Parameters
is_mandatory – If the module is mandatory
module_ptr – Pointer to the module
thread_ptr – Pointer to the thread
node_name – Name of the node
global_ptr – Pointer to the global module
Stop and destroy a PSDK module.
- Template Parameters
ModuleType – Type of the module
- Parameters
is_mandatory – If the module is mandatory
module_ptr – Pointer to the module
thread_ptr – Pointer to the thread
Initialize a PSDK module.
- Template Parameters
ModuleType – Type of the module
- Parameters
is_mandatory – If the module is mandatory
module_ptr – Pointer to the module
- Returns
true/false
-
bool set_environment()
Set the environment handlers.
- Returns
true/false
-
bool set_user_info(T_DjiUserInfo *user_info)
Set the user information for the PSDK application.
- Parameters
user_info – object containing the main information regarding the psdk application
- Returns
true/false
-
void load_parameters()
Load ROS parameters.
-
bool init(T_DjiUserInfo *user_info)
Initiate the PSDK application.
- Parameters
user_info – object containing the main information regarding the psdk application
- Returns
true/false
-
bool initialize_psdk_modules()
Method to initialize all psdk modules.
- Returns
true if all mandatory modules have been correctly initialized, false otherwise
-
void get_and_validate_frequency(const std::string ¶m_name, int &frequency, const int max_frequency)
Get the frequency parameters and validate their value.
- Parameters
param_name – name of the parameter to be retrieved
frequency – variable where to store the frequency
max_frequency – maximum frequency allowed
-
void get_non_mandatory_param(const std::string ¶m_name, std::string ¶m_string)
Retrieve non mandatory parameters of string type.
- Parameters
param_name – name of the parameter to be retrieved
param_string – variable to store the parameter
-
void get_mandatory_param(const std::string ¶m_name, std::string ¶m_string)
Retrieve mandatory parameters. Issue an error if the parameter is not found.
- Parameters
param_name – name of the parameter to be retrieved
param_string – variable to store the parameter
-
bool transition_modules_to_state(LifecycleState state)
Transition all modules to a specific state.
- Parameters
state – state to transition the modules as defined by the enum LifecycleState
- Returns
true if all module transitions are successful, false otherwise
-
struct PSDKParams
-
explicit PSDKWrapper(const std::string &node_name)