Easy Navigation
Loading...
Searching...
No Matches
GNSSPerception Class Reference

Represents a single GNSS perception from a sensor. More...

#include <GNSSPerception.hpp>

Inheritance diagram for GNSSPerception:
Collaboration diagram for GNSSPerception:

Public Member Functions

bool consume_new_data ()
 Atomically reads and clears new_data.
 GNSSPerception ()
 GNSSPerception (const GNSSPerception &other)
GNSSPerception & operator= (const GNSSPerception &other)
void set_data (const sensor_msgs::msg::NavSatFix &msg, const rclcpp::Time &msg_stamp, const std::string &msg_frame_id)
 Atomically overwrites stamp/frame_id/data/valid from the subscription callback.
Public Member Functions inherited from PerceptionBase
virtual ~PerceptionBase ()=default

Static Public Member Functions

static bool supports_msg_type (std::string_view t)
 Returns whether the given ROS 2 type name is supported by this perception.

Public Attributes

sensor_msgs::msg::NavSatFix data
 GNSS data received from the sensor.
Public Attributes inherited from PerceptionBase
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 Public Attributes

static constexpr std::string_view default_group_ = "gnss"
 Group identifier for GNSS perceptions.

Protected Attributes

std::mutex mutex_

Detailed Description

Represents a single GNSS perception from a sensor.

Inherits from PerceptionBase and stores a sensor_msgs/msg/NavSatFix message.

Constructor & Destructor Documentation

◆ GNSSPerception() [1/2]

GNSSPerception ( )

◆ GNSSPerception() [2/2]

GNSSPerception ( const GNSSPerception & other)

Member Function Documentation

◆ consume_new_data()

bool consume_new_data ( )

Atomically reads and clears new_data.

Returns
The value of new_data before it was cleared.

◆ operator=()

GNSSPerception & operator= ( const GNSSPerception & other)

◆ set_data()

void set_data ( const sensor_msgs::msg::NavSatFix & msg,
const rclcpp::Time & msg_stamp,
const std::string & msg_frame_id )

Atomically overwrites stamp/frame_id/data/valid from the subscription callback.

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
tFully qualified message type name (e.g., "sensor_msgs/msg/NavSatFix").
Returns
true if t equals "sensor_msgs/msg/NavSatFix", otherwise false.

Member Data Documentation

◆ data

sensor_msgs::msg::NavSatFix data

GNSS data received from the sensor.

◆ default_group_

std::string_view default_group_ = "gnss"
staticconstexpr

Group identifier for GNSS perceptions.

◆ mutex_

std::mutex mutex_
mutableprotected

The documentation for this class was generated from the following file: