Class PerceptionModule

Nested Relationships

Nested Types

Inheritance Relationships

Base Type

  • public rclcpp_lifecycle::LifecycleNode

Class Documentation

class psdk_ros2::PerceptionModule : public rclcpp_lifecycle::LifecycleNode

Public Functions

explicit PerceptionModule(const std::string &name)

Construct a new PerceptionModule object.

Parameters

node_name – Name of the node

~PerceptionModule()

Destroy the PerceptionModule object.

CallbackReturn on_configure(const rclcpp_lifecycle::State &state)

Configures the PerceptionModule. 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 PerceptionModule.

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 PerceptionModule. 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 PerceptionModule.

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 PerceptionModule.

Parameters

state – rclcpp_lifecycle::State. Current state of the node.

Returns

CallbackReturn SUCCESS or FAILURE

bool init()

Initialize the PerceptionModule.

Returns

true/false

bool deinit()

Deinitialize the PerceptionModule.

Returns

true/false

Private Functions

void perception_image_callback(T_DjiPerceptionImageInfo imageInfo, uint8_t *imageRawBuffer, uint32_t bufferLen)

Stereo camera stream of both left and right camera sensor.

void perception_camera_parameters_publisher()

Stereo camera parameters publisher publish camera parametes of selected direction.

Returns

true/false True if pervious camera strem cleared successfully otherwise false

void start_perception_cb(const std::shared_ptr<PerceptionStereoVisionSetup::Request> request, const std::shared_ptr<PerceptionStereoVisionSetup::Response> response)

Start Perception Streaming.

Parameters
  • request – Perception stereo camera stream Direction DOWN = 0, FRONT = 1, REAR = 2, UP = 3, LEFT = 4, RIGHT = 5

  • response – PerceptionStereoVisionSetup service response

bool start_perception_stereo_cameras_stream(const uint stereo_cameras_direction)

Start the perception stereo camera stream.

Parameters

stereo_cameras_direction – select perception stereo cameras direction

Returns

true/false Returns true if the streaming has been started correctly and False otherwise.

bool stop_perception_stereo_cameras_stream(const uint stereo_cameras_direction)

Stop the perception stereo camera stream.

Parameters

stereo_cameras_direction – select perception stereo cameras direction

Returns

true/false Returns true if the streaming has been stoped correctly and False otherwise.

bool clear_perception_stereo_cameras_stream()

Clear the previous perception stereo camera stream.

Private Members

std::unordered_map<std::string, uint8_t> direction_map_ = {{"DOWN", 0}, {"FRONT", 1}, {"REAR", 2}, {"UP", 3}, {"LEFT", 4}, {"RIGHT", 5}}

Populate the direction map for perception stereo camera direction. refer typedef enum E_DjiPerceptionDirection for more information.

struct PerceptionParams