Represents a single image perception from a sensor.
More...
#include <ImagePerception.hpp>
|
| bool | consume_new_data () |
| | Atomically reads and clears new_data.
|
| | ImagePerception () |
| | ImagePerception (const ImagePerception &other) |
| void | mark_invalid (const rclcpp::Time &msg_stamp, const std::string &msg_frame_id) |
| | Atomically records a failed decode: updates stamp/frame_id, marks invalid, and leaves data untouched (matches the pre-existing behavior on cv_bridge exceptions).
|
| ImagePerception & | operator= (const ImagePerception &other) |
| void | set_data (cv::Mat &&image, const rclcpp::Time &msg_stamp, const std::string &msg_frame_id) |
| | Atomically overwrites stamp/frame_id/data with a successfully decoded image and marks the perception valid.
|
| virtual | ~PerceptionBase ()=default |
|
| static bool | supports_msg_type (std::string_view t) |
| | Returns whether the given ROS 2 type name is supported by this perception.
|
|
| cv::Mat | data |
| | Image data received from the sensor.
|
| std::string | frame_id |
| | Coordinate frame associated with the perception.
|
| bool | new_data = false |
| | Whether the data has changed since the last observation.
|
| rclcpp::Time | stamp |
| | Timestamp of the perception (ROS time).
|
| bool | valid = false |
| | Whether the perception holds usable data: set with new data, cleared by SensorsNode once it is older than "forget_time".
|
|
| static constexpr std::string_view | default_group_ = "image" |
| | Group identifier for image perceptions.
|
Represents a single image perception from a sensor.
Inherits from PerceptionBase and stores an OpenCV image (cv::Mat) along with metadata such as timestamp and frame_id.
◆ ImagePerception() [1/2]
◆ ImagePerception() [2/2]
| ImagePerception |
( |
const ImagePerception & | other | ) |
|
◆ consume_new_data()
| bool consume_new_data |
( |
| ) |
|
Atomically reads and clears new_data.
- Returns
- The value of new_data before it was cleared.
◆ mark_invalid()
| void mark_invalid |
( |
const rclcpp::Time & | msg_stamp, |
|
|
const std::string & | msg_frame_id ) |
Atomically records a failed decode: updates stamp/frame_id, marks invalid, and leaves data untouched (matches the pre-existing behavior on cv_bridge exceptions).
◆ operator=()
◆ set_data()
| void set_data |
( |
cv::Mat && | image, |
|
|
const rclcpp::Time & | msg_stamp, |
|
|
const std::string & | msg_frame_id ) |
Atomically overwrites stamp/frame_id/data with a successfully decoded image and marks the perception valid.
Guards against a concurrent copy (e.g. via NavState::get_safe()) observing a partially-updated object while this handler's RT-thread callback is writing.
◆ supports_msg_type()
| bool supports_msg_type |
( |
std::string_view | t | ) |
|
|
static |
Returns whether the given ROS 2 type name is supported by this perception.
- Parameters
-
| t | Fully qualified message type name (e.g., "sensor_msgs/msg/Image"). |
- Returns
- true if
t equals "sensor_msgs/msg/Image", otherwise false.
◆ data
Image data received from the sensor.
The matrix layout follows OpenCV conventions. The encoding and channel depth depend on upstream conversion (typically via cv_bridge).
◆ default_group_
| std::string_view default_group_ = "image" |
|
staticconstexpr |
Group identifier for image perceptions.
◆ mutex_
The documentation for this class was generated from the following file: