Carma-platform v4.2.0
CARMA Platform is built on robot operating system (ROS) and utilizes open source software (OSS) that enables Cooperative Driving Automation (CDA) features to allow Automated Driving Systems to interact and cooperate with infrastructure and other vehicles through communication.
localization_manager::LocalizationManager Class Reference

Primary logic class for the localization manager node. More...

#include <LocalizationManager.hpp>

Collaboration diagram for localization_manager::LocalizationManager:
Collaboration graph

Public Types

using PosePublisher = std::function< void(const geometry_msgs::msg::PoseStamped &)>
 
using ManagedInitialPosePublisher = std::function< void(const geometry_msgs::msg::PoseWithCovarianceStamped &)>
 
using StatePublisher = std::function< void(const carma_localization_msgs::msg::LocalizationStatusReport &)>
 
using TimerUniquePtr = std::unique_ptr< carma_ros2_utils::timers::Timer >
 

Public Member Functions

 LocalizationManager (PosePublisher pose_pub, StatePublisher state_pub, ManagedInitialPosePublisher initialpose_pub, const LocalizationManagerConfig &config, rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr logger, std::unique_ptr< carma_ros2_utils::timers::TimerFactory > timer_factory)
 Constructor. More...
 
void gnssPoseCallback (const geometry_msgs::msg::PoseStamped::SharedPtr msg)
 Callback for new GNSS messages. More...
 
void poseAndStatsCallback (const geometry_msgs::msg::PoseStamped::ConstPtr pose, const autoware_msgs::msg::NDTStat::ConstPtr stats)
 Synced callback for the NDT reported pose and status messages. More...
 
void systemAlertCallback (const carma_msgs::msg::SystemAlert::SharedPtr alert)
 Callback for SystemAlert data. Used to check for lidar failure. More...
 
void initialPoseCallback (const geometry_msgs::msg::PoseWithCovarianceStamped::SharedPtr msg)
 Callback for the initial pose provided by Rviz or some external localization initializer. More...
 
void posePubTick ()
 Timer callback that controls the publication of the selected pose and status report. More...
 
void stateTransitionCallback (LocalizationState prev_state, LocalizationState new_state, LocalizationSignal signal)
 Callback for when a new state was triggered. Allows creation of entry/exit behavior for states. More...
 
void timerCallback (const LocalizationState origin_state)
 Callback for timeouts. Used to trigger timeout signals for the state machine. More...
 
LocalizationState getState () const
 Returns the current localization state. More...
 
void clearTimers ()
 Clears the expired timers from the memory of this scheduler. More...
 
void setConfig (const LocalizationManagerConfig &config)
 Set config. More...
 

Private Member Functions

double computeNDTFreq (const rclcpp::Time &new_stamp)
 Helper function to both compute the NDT Frequency and update the previous pose timestamp. More...
 
double computeFreq (const rclcpp::Time &old_stamp, const rclcpp::Time &new_stamp) const
 Helper function to compute the instantaneous frequency between two times. More...
 
uint32_t nextId ()
 Generates the next id to be used for a timer. More...
 

Private Attributes

PosePublisher pose_pub_
 
StatePublisher state_pub_
 
ManagedInitialPosePublisher initialpose_pub_
 
LocalizationManagerConfig config_
 
LocalizationTransitionTable transition_table_
 
boost::optional< rclcpp::Time > prev_ndt_stamp_
 
int lidar_init_sequential_timesteps_counter_ = 0
 
bool is_sequential_ = false
 
boost::optional< geometry_msgs::msg::PoseStamped > last_raw_gnss_value_
 
boost::optional< tf2::Vector3 > gnss_offset_
 
boost::optional< geometry_msgs::msg::PoseStamped > current_pose_
 
rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr logger_
 
std::mutex mutex_
 
std::unique_ptr< carma_ros2_utils::timers::TimerFactory > timer_factory_
 
std::unordered_map< uint32_t, std::pair< TimerUniquePtr, bool > > timers_
 
TimerUniquePtr current_timer_
 
uint32_t next_id_ = 0
 
uint32_t current_timer_id_
 
rcl_clock_type_t timer_clock_type_ = RCL_SYSTEM_TIME
 

Static Private Attributes

static const std::unordered_set< std::string > LIDAR_FAILURE_STRINGS
 The set of strings which mark a lidar failure in a system alert message. More...
 

Detailed Description

Primary logic class for the localization manager node.

Definition at line 40 of file LocalizationManager.hpp.

Member Typedef Documentation

◆ ManagedInitialPosePublisher

using localization_manager::LocalizationManager::ManagedInitialPosePublisher = std::function<void(const geometry_msgs::msg::PoseWithCovarianceStamped &)>

Definition at line 45 of file LocalizationManager.hpp.

◆ PosePublisher

using localization_manager::LocalizationManager::PosePublisher = std::function<void(const geometry_msgs::msg::PoseStamped &)>

Definition at line 44 of file LocalizationManager.hpp.

◆ StatePublisher

using localization_manager::LocalizationManager::StatePublisher = std::function<void(const carma_localization_msgs::msg::LocalizationStatusReport &)>

Definition at line 46 of file LocalizationManager.hpp.

◆ TimerUniquePtr

using localization_manager::LocalizationManager::TimerUniquePtr = std::unique_ptr<carma_ros2_utils::timers::Timer>

Definition at line 47 of file LocalizationManager.hpp.

Constructor & Destructor Documentation

◆ LocalizationManager()

localization_manager::LocalizationManager::LocalizationManager ( PosePublisher  pose_pub,
StatePublisher  state_pub,
ManagedInitialPosePublisher  initialpose_pub,
const LocalizationManagerConfig config,
rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr  logger,
std::unique_ptr< carma_ros2_utils::timers::TimerFactory >  timer_factory 
)

Constructor.

Parameters
pose_pubA callback to trigger publication of the selected pose
state_pubA callback to trigger publication of the localization state
initialpose_pubA callback to trigger publication of the intial pose
configThe configuration settings to use for this manager
loggerLogger interface of node calling manager object
node_timersTimer interface of node calling manager object

Definition at line 26 of file LocalizationManager.cpp.

31 : pose_pub_(pose_pub), state_pub_(state_pub), initialpose_pub_(initialpose_pub), config_(config), logger_(logger), timer_factory_(std::move(timer_factory)), transition_table_(static_cast<LocalizerMode>(config_.localization_mode))
32
33 {
34
36 std::placeholders::_1, std::placeholders::_2,
37 std::placeholders::_3));
38 timer_clock_type_ = timer_factory_->now().get_clock_type();
39 }
rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr logger_
void stateTransitionCallback(LocalizationState prev_state, LocalizationState new_state, LocalizationSignal signal)
Callback for when a new state was triggered. Allows creation of entry/exit behavior for states.
std::unique_ptr< carma_ros2_utils::timers::TimerFactory > timer_factory_
void setTransitionCallback(TransitionCallback cb)
Callback setting function. The provided callback will be triggered any time the current state changes...
LocalizerMode
Enum describing the possible operational modes of the LocalizationManager.

References localization_manager::LocalizationTransitionTable::setTransitionCallback(), stateTransitionCallback(), timer_clock_type_, timer_factory_, and transition_table_.

Here is the call graph for this function:

Member Function Documentation

◆ clearTimers()

void localization_manager::LocalizationManager::clearTimers ( )

Clears the expired timers from the memory of this scheduler.

Definition at line 206 of file LocalizationManager.cpp.

207 {
208 std::lock_guard<std::mutex> guard(mutex_);
209
210 // Clear expired timers
211 auto it = timers_.begin();
212 while (it != timers_.end())
213 {
214 // Check if timer is marked for deletion
215 if (it->second.second)
216 {
217 // erase() function returns the iterator of the next to last deleted element
218 it = timers_.erase(it);
219 }
220 else
221 {
222 it++;
223 }
224 }
225 }
std::unordered_map< uint32_t, std::pair< TimerUniquePtr, bool > > timers_

References mutex_, and timers_.

Referenced by posePubTick().

Here is the caller graph for this function:

◆ computeFreq()

double localization_manager::LocalizationManager::computeFreq ( const rclcpp::Time &  old_stamp,
const rclcpp::Time &  new_stamp 
) const
private

Helper function to compute the instantaneous frequency between two times.

Parameters
old_stampThe old timestamp
new_stampThe new timestamp
Returns
The computed instantaneous frequency in Hz

Definition at line 41 of file LocalizationManager.cpp.

42 {
43 return 1.0 / (new_stamp - old_stamp).seconds(); // Convert delta to frequency (Hz = 1/s)
44 }

Referenced by computeNDTFreq(), and posePubTick().

Here is the caller graph for this function:

◆ computeNDTFreq()

double localization_manager::LocalizationManager::computeNDTFreq ( const rclcpp::Time &  new_stamp)
private

Helper function to both compute the NDT Frequency and update the previous pose timestamp.

Parameters
new_stampThe new pose timestamp
Returns
The computed instantaneous frequency in Hz

Definition at line 51 of file LocalizationManager.cpp.

52 {
53 if (!prev_ndt_stamp_)
54 { // Check if this is the first data point
55 prev_ndt_stamp_ = new_stamp;
56 // When no historic data is available force the frequency into the operational range
58 }
59
60 if (new_stamp <= rclcpp::Time(prev_ndt_stamp_.get(), timer_clock_type_))
61 {
62 RCLCPP_ERROR_STREAM(rclcpp::get_logger("localization_manager"), "LocalizationManager received NDT data out of order. Prev stamp was "
63 << prev_ndt_stamp_.get().seconds() << " new stamp is " << new_stamp.seconds());
64 // When invalid data is received from NDT force the frequency into the fault range
66 }
67 return computeFreq(rclcpp::Time(prev_ndt_stamp_.get(), timer_clock_type_), new_stamp); // Convert delta to frequency (Hz = 1/s)
68 }
double computeFreq(const rclcpp::Time &old_stamp, const rclcpp::Time &new_stamp) const
Helper function to compute the instantaneous frequency between two times.
boost::optional< rclcpp::Time > prev_ndt_stamp_
double ndt_frequency_degraded_threshold
NDT solution frequency below which the localization is considered in a degraded state.

References computeFreq(), config_, localization_manager::LocalizationManagerConfig::ndt_frequency_degraded_threshold, localization_manager::LocalizationManagerConfig::ndt_frequency_fault_threshold, prev_ndt_stamp_, and timer_clock_type_.

Referenced by poseAndStatsCallback().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getState()

LocalizationState localization_manager::LocalizationManager::getState ( ) const

Returns the current localization state.

Returns
The current localization state

Definition at line 316 of file LocalizationManager.cpp.

317 {
319 }
LocalizationState getState() const
Returns the current state.

References localization_manager::LocalizationTransitionTable::getState(), and transition_table_.

Here is the call graph for this function:

◆ gnssPoseCallback()

void localization_manager::LocalizationManager::gnssPoseCallback ( const geometry_msgs::msg::PoseStamped::SharedPtr  msg)

Callback for new GNSS messages.

Parameters
msgThe pose of vehicle in map frame provided by GNSS

Definition at line 143 of file LocalizationManager.cpp.

144 {
146 // Just like ndt_matching the gnss pose is treated as an initialize signal if the system is not yet intialized
148 {
151
152 geometry_msgs::msg::PoseWithCovarianceStamped new_initial_pose;
153 new_initial_pose.header = msg->header;
154 new_initial_pose.pose.pose = msg->pose;
155
156 initialpose_pub_(new_initial_pose);
157 }
158
160 {
161 geometry_msgs::msg::PoseStamped corrected_pose = *msg;
162 if (gnss_offset_)
163 {
164 corrected_pose.pose.position.x = corrected_pose.pose.position.x + gnss_offset_->x();
165 corrected_pose.pose.position.y = corrected_pose.pose.position.y + gnss_offset_->y();
166 corrected_pose.pose.position.z = corrected_pose.pose.position.z + gnss_offset_->z();
167 }
168 RCLCPP_DEBUG_STREAM(rclcpp::get_logger("localization_manager"), "Publishing GNSS pose with lidar_init_sequential_timesteps_counter_: " << lidar_init_sequential_timesteps_counter_);
169 current_pose_ = corrected_pose;
170 }
171 }
boost::optional< geometry_msgs::msg::PoseStamped > last_raw_gnss_value_
boost::optional< tf2::Vector3 > gnss_offset_
boost::optional< geometry_msgs::msg::PoseStamped > current_pose_
void signal(LocalizationSignal signal)
Trigger signal for the transition table.

References current_pose_, localization_manager::DEGRADED_NO_LIDAR_FIX, localization_manager::LocalizationTransitionTable::getState(), gnss_offset_, localization_manager::INITIAL_POSE, initialpose_pub_, last_raw_gnss_value_, lidar_init_sequential_timesteps_counter_, localization_manager::LocalizationTransitionTable::signal(), transition_table_, and localization_manager::UNINITIALIZED.

Referenced by localization_manager::Node::handle_on_configure().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initialPoseCallback()

void localization_manager::LocalizationManager::initialPoseCallback ( const geometry_msgs::msg::PoseWithCovarianceStamped::SharedPtr  msg)

Callback for the initial pose provided by Rviz or some external localization initializer.

Parameters
msgThe initial pose message

Definition at line 173 of file LocalizationManager.cpp.

174 {
177 current_pose_ = boost::none; // Reset the current pose until a new pose is recieved
178 initialpose_pub_(*msg); // Forward the initial pose to the rest of the system
179 }

References current_pose_, localization_manager::INITIAL_POSE, initialpose_pub_, lidar_init_sequential_timesteps_counter_, localization_manager::LocalizationTransitionTable::signal(), and transition_table_.

Referenced by localization_manager::Node::handle_on_configure().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nextId()

uint32_t localization_manager::LocalizationManager::nextId ( )
private

Generates the next id to be used for a timer.

Returns
The next available timer id

Definition at line 200 of file LocalizationManager.cpp.

201 {
202 next_id_++;
203 return next_id_;
204 }

References next_id_.

Referenced by stateTransitionCallback().

Here is the caller graph for this function:

◆ poseAndStatsCallback()

void localization_manager::LocalizationManager::poseAndStatsCallback ( const geometry_msgs::msg::PoseStamped::ConstPtr  pose,
const autoware_msgs::msg::NDTStat::ConstPtr  stats 
)

Synced callback for the NDT reported pose and status messages.

Parameters
poseThe pose reported by NDT matching of the vehicle in the map frame
statsThe stats reported by NDT matching for the accuracy of the provided pose

Definition at line 70 of file LocalizationManager.cpp.

72 {
73 double ndt_freq = computeNDTFreq(rclcpp::Time(pose->header.stamp, timer_clock_type_));
74 RCLCPP_DEBUG_STREAM(rclcpp::get_logger("localization_manager"), "Received pose resulting in frequency value of " << ndt_freq << " with score of " << stats->score);
75
77 {
79 }
81 {
83 }
84 else
85 {
86 // In GNSS_WITH_NDT_INIT mode, we shouldn't switch back to NDT and only rely on GPS
90 {
92 }
93 }
94
96
98 {
99 RCLCPP_DEBUG_STREAM(rclcpp::get_logger("localization_manager"), "lidar_init_sequential_timesteps_counter_: " << lidar_init_sequential_timesteps_counter_);
101 {
102 if (is_sequential_)
104
105 is_sequential_ = true;
106 }
107 else
108 {
110 RCLCPP_DEBUG_STREAM(rclcpp::get_logger("localization_manager"), "Switched to LIDAR_INITIALIZED_SWITCH_TO_GPS at lidar_init_sequential_timesteps_counter_: " << lidar_init_sequential_timesteps_counter_
111 << ", with new state: " << transition_table_.getState());
112 }
113 }
117 lidar_init_sequential_timesteps_counter_ >= config_.sequential_timesteps_until_gps_operation)) // don't reset counter if Lidar initialized and switched to GPS
118 // as it will reset state to OPERATIONAL
119 {
120 is_sequential_ = false;
122 RCLCPP_DEBUG_STREAM(rclcpp::get_logger("localization_manager"), "Resetting lidar_init_sequential_timesteps_counter_: " << lidar_init_sequential_timesteps_counter_ << ", with new state: " << transition_table_.getState());
123 }
124
126 {
127 tf2::Vector3 ndt_translation(pose->pose.position.x, pose->pose.position.y, pose->pose.position.z);
128
129 tf2::Vector3 gnss_translation(last_raw_gnss_value_->pose.position.x, last_raw_gnss_value_->pose.position.y, last_raw_gnss_value_->pose.position.z);
130
131 gnss_offset_ = ndt_translation - gnss_translation;
132 }
133
135 {
136 RCLCPP_DEBUG_STREAM(rclcpp::get_logger("localization_manager"), "Publishing mixed pose with lidar_init_sequential_timesteps_counter_: " << lidar_init_sequential_timesteps_counter_ << ", and state" << state);
137 current_pose_ = *pose;
138 }
139
140 prev_ndt_stamp_ = pose->header.stamp;
141 }
double computeNDTFreq(const rclcpp::Time &new_stamp)
Helper function to both compute the NDT Frequency and update the previous pose timestamp.
LocalizationState
Enum describing the possible states of the localization system.
double fitness_score_degraded_threshold
NDT Fitness score above which the localization is considered in a degraded state.

References computeNDTFreq(), config_, current_pose_, localization_manager::DEGRADED_NO_LIDAR_FIX, localization_manager::LocalizationManagerConfig::fitness_score_degraded_threshold, localization_manager::LocalizationManagerConfig::fitness_score_fault_threshold, localization_manager::LocalizationTransitionTable::getState(), gnss_offset_, localization_manager::GNSS_WITH_NDT_INIT, localization_manager::GOOD_NDT_FREQ_AND_FITNESS_SCORE, is_sequential_, last_raw_gnss_value_, lidar_init_sequential_timesteps_counter_, localization_manager::LIDAR_INITIALIZED_SWITCH_TO_GPS, localization_manager::LocalizationManagerConfig::localization_mode, localization_manager::LocalizationManagerConfig::ndt_frequency_degraded_threshold, localization_manager::LocalizationManagerConfig::ndt_frequency_fault_threshold, localization_manager::OPERATIONAL, localization_manager::POOR_NDT_FREQ_OR_FITNESS_SCORE, prev_ndt_stamp_, localization_manager::LocalizationManagerConfig::sequential_timesteps_until_gps_operation, localization_manager::LocalizationTransitionTable::signal(), timer_clock_type_, transition_table_, and localization_manager::UNUSABLE_NDT_FREQ_OR_FITNESS_SCORE.

Here is the call graph for this function:

◆ posePubTick()

void localization_manager::LocalizationManager::posePubTick ( )

Timer callback that controls the publication of the selected pose and status report.

Definition at line 263 of file LocalizationManager.cpp.

264 {
265 // Clear any expired timers
266 clearTimers();
267
268 // Evaluate NDT Frequency if we have started receiving messages
269 // This check provides protection against excessively long NDT computation times that do not trigger the callback
270 if (prev_ndt_stamp_)
271 {
272 double freq = computeFreq(rclcpp::Time(prev_ndt_stamp_.get(), timer_clock_type_), timer_factory_->now());
274 {
276 }
278 {
280 }
281 }
282
283 // check if last gnss time stamp is older than threshold and send the corresponding signal
284 if (last_raw_gnss_value_ && timer_factory_->now() - rclcpp::Time(last_raw_gnss_value_->header.stamp, timer_clock_type_) > rclcpp::Duration(config_.gnss_data_timeout * 1e6))
285 {
287 }
288
289 // Used in LocalizerMode::GNSS_WITH_NDT_INIT
290 // If the state is not Operational with good NDT, or already using GPS only, we reset the counter
293 {
295 RCLCPP_DEBUG_STREAM(rclcpp::get_logger("localization_manager"), "Resetting lidar_init_sequential_timesteps_counter_: " << lidar_init_sequential_timesteps_counter_ << ", with new state: " << transition_table_.getState());
296 }
297
298 // Publish current pose message if available
299 if (current_pose_)
300 {
301 auto pose_to_publish = *current_pose_;
303 {
304 pose_to_publish.pose.position.x += config_.x_offset;
305 pose_to_publish.pose.position.y += config_.y_offset;
306 pose_to_publish.pose.position.z += config_.z_offset;
307 }
308 pose_pub_(pose_to_publish);
309 }
310
311 // Create and publish status report message
312 carma_localization_msgs::msg::LocalizationStatusReport msg = stateToMsg(transition_table_.getState(), timer_factory_->now());
313 state_pub_(msg);
314 }
void clearTimers()
Clears the expired timers from the memory of this scheduler.
carma_localization_msgs::msg::LocalizationStatusReport stateToMsg(LocalizationState state, const rclcpp::Time &stamp)
Helper function to convert LocalizationState objects into LocalizationStatusReport ROS messages.
double x_offset
GPS Offset to apply if that mode is enabled.
int gnss_data_timeout
GNSS Data timeout. If exceeded the system will assume the GNSS is no longer functional....

References clearTimers(), computeFreq(), config_, current_pose_, localization_manager::DEGRADED_NO_LIDAR_FIX, localization_manager::LocalizationTransitionTable::getState(), localization_manager::LocalizationManagerConfig::gnss_data_timeout, localization_manager::GNSS_DATA_TIMEOUT, localization_manager::GNSS_WITH_FIXED_OFFSET, last_raw_gnss_value_, lidar_init_sequential_timesteps_counter_, localization_manager::LocalizationManagerConfig::localization_mode, localization_manager::LocalizationManagerConfig::ndt_frequency_degraded_threshold, localization_manager::LocalizationManagerConfig::ndt_frequency_fault_threshold, localization_manager::OPERATIONAL, localization_manager::POOR_NDT_FREQ_OR_FITNESS_SCORE, pose_pub_, prev_ndt_stamp_, localization_manager::LocalizationTransitionTable::signal(), state_pub_, localization_manager::stateToMsg(), timer_clock_type_, timer_factory_, transition_table_, localization_manager::UNUSABLE_NDT_FREQ_OR_FITNESS_SCORE, localization_manager::LocalizationManagerConfig::x_offset, localization_manager::LocalizationManagerConfig::y_offset, and localization_manager::LocalizationManagerConfig::z_offset.

Referenced by localization_manager::Node::handle_on_configure().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setConfig()

void localization_manager::LocalizationManager::setConfig ( const LocalizationManagerConfig config)

Set config.

Parameters
configlocalization manager config

Definition at line 46 of file LocalizationManager.cpp.

47 {
48 config_ = config;
49 }

References config_.

◆ stateTransitionCallback()

void localization_manager::LocalizationManager::stateTransitionCallback ( LocalizationState  prev_state,
LocalizationState  new_state,
LocalizationSignal  signal 
)

Callback for when a new state was triggered. Allows creation of entry/exit behavior for states.

Parameters
prev_stateThe previous state
new_stateThe new current state. This should never equal prev_state.
signalThe signal that triggered the state transition

Definition at line 227 of file LocalizationManager.cpp.

229 {
230 RCLCPP_INFO_STREAM(rclcpp::get_logger("localization_manager"), "State transition from " << prev_state << " to " << new_state << " with signal " << signal);
231 // Mark the expired timers as expired if any
232 if (current_timer_)
233 {
234 // NOTE unit testing of current algorithm depends on all timers being one-shot timers.
235 timers_[current_timer_id_].second = true;
236 }
237
238 switch (new_state)
239 {
241 gnss_offset_ = boost::none;
242 prev_ndt_stamp_ = boost::none;
243
246 std::bind(&LocalizationManager::timerCallback, this, new_state), true, true);
247
248 timers_[current_timer_id_] = std::make_pair(std::move(current_timer_), false); // Add start timer to map by Id
249 break;
253 std::bind(&LocalizationManager::timerCallback, this, new_state), true, true);
254
255 timers_[current_timer_id_] = std::make_pair(std::move(current_timer_), false); // Add start timer to map by Id
256
257 break;
258 default:
259 break;
260 }
261 }
void timerCallback(const LocalizationState origin_state)
Callback for timeouts. Used to trigger timeout signals for the state machine.
uint32_t nextId()
Generates the next id to be used for a timer.
int gnss_only_operation_timeout
Timeout in ms for GNSS only operation. Ignored when in GNSS mode.

References localization_manager::LocalizationManagerConfig::auto_initialization_timeout, config_, current_timer_, current_timer_id_, localization_manager::DEGRADED_NO_LIDAR_FIX, gnss_offset_, localization_manager::LocalizationManagerConfig::gnss_only_operation_timeout, localization_manager::INITIALIZING, nextId(), prev_ndt_stamp_, timer_factory_, timerCallback(), and timers_.

Referenced by LocalizationManager().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ systemAlertCallback()

void localization_manager::LocalizationManager::systemAlertCallback ( const carma_msgs::msg::SystemAlert::SharedPtr  alert)

Callback for SystemAlert data. Used to check for lidar failure.

Parameters
alertThe alert message to evaluate

Definition at line 181 of file LocalizationManager.cpp.

182 {
183 if (LIDAR_FAILURE_STRINGS.find(alert->description) != LIDAR_FAILURE_STRINGS.end())
184 {
186 }
187 }
static const std::unordered_set< std::string > LIDAR_FAILURE_STRINGS
The set of strings which mark a lidar failure in a system alert message.

References LIDAR_FAILURE_STRINGS, localization_manager::LIDAR_SENSOR_FAILURE, localization_manager::LocalizationTransitionTable::signal(), and transition_table_.

Referenced by localization_manager::Node::handle_on_configure().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ timerCallback()

void localization_manager::LocalizationManager::timerCallback ( const LocalizationState  origin_state)

Callback for timeouts. Used to trigger timeout signals for the state machine.

Parameters
origin_stateThe state that was the current state when the timer that triggered this callback was setup

Definition at line 189 of file LocalizationManager.cpp.

190 {
191 // If there is already a timer callback in progress or the expected state has changed then return
192 if (origin_state != transition_table_.getState())
193 {
194 return;
195 }
196
198 }

References localization_manager::LocalizationTransitionTable::getState(), localization_manager::LocalizationTransitionTable::signal(), localization_manager::TIMEOUT, and transition_table_.

Referenced by stateTransitionCallback().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ config_

LocalizationManagerConfig localization_manager::LocalizationManager::config_
private

◆ current_pose_

boost::optional<geometry_msgs::msg::PoseStamped> localization_manager::LocalizationManager::current_pose_
private

◆ current_timer_

TimerUniquePtr localization_manager::LocalizationManager::current_timer_
private

Definition at line 163 of file LocalizationManager.hpp.

Referenced by stateTransitionCallback().

◆ current_timer_id_

uint32_t localization_manager::LocalizationManager::current_timer_id_
private

Definition at line 165 of file LocalizationManager.hpp.

Referenced by stateTransitionCallback().

◆ gnss_offset_

boost::optional<tf2::Vector3> localization_manager::LocalizationManager::gnss_offset_
private

◆ initialpose_pub_

ManagedInitialPosePublisher localization_manager::LocalizationManager::initialpose_pub_
private

Definition at line 142 of file LocalizationManager.hpp.

Referenced by gnssPoseCallback(), and initialPoseCallback().

◆ is_sequential_

bool localization_manager::LocalizationManager::is_sequential_ = false
private

Definition at line 151 of file LocalizationManager.hpp.

Referenced by poseAndStatsCallback().

◆ last_raw_gnss_value_

boost::optional<geometry_msgs::msg::PoseStamped> localization_manager::LocalizationManager::last_raw_gnss_value_
private

Definition at line 152 of file LocalizationManager.hpp.

Referenced by gnssPoseCallback(), poseAndStatsCallback(), and posePubTick().

◆ LIDAR_FAILURE_STRINGS

const std::unordered_set< std::string > localization_manager::LocalizationManager::LIDAR_FAILURE_STRINGS
staticprivate

The set of strings which mark a lidar failure in a system alert message.

Definition at line 138 of file LocalizationManager.hpp.

Referenced by systemAlertCallback().

◆ lidar_init_sequential_timesteps_counter_

int localization_manager::LocalizationManager::lidar_init_sequential_timesteps_counter_ = 0
private

◆ logger_

rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr localization_manager::LocalizationManager::logger_
private

Definition at line 157 of file LocalizationManager.hpp.

◆ mutex_

std::mutex localization_manager::LocalizationManager::mutex_
private

Definition at line 160 of file LocalizationManager.hpp.

Referenced by clearTimers().

◆ next_id_

uint32_t localization_manager::LocalizationManager::next_id_ = 0
private

Definition at line 164 of file LocalizationManager.hpp.

Referenced by nextId().

◆ pose_pub_

PosePublisher localization_manager::LocalizationManager::pose_pub_
private

Definition at line 140 of file LocalizationManager.hpp.

Referenced by posePubTick().

◆ prev_ndt_stamp_

boost::optional<rclcpp::Time> localization_manager::LocalizationManager::prev_ndt_stamp_
private

◆ state_pub_

StatePublisher localization_manager::LocalizationManager::state_pub_
private

Definition at line 141 of file LocalizationManager.hpp.

Referenced by posePubTick().

◆ timer_clock_type_

rcl_clock_type_t localization_manager::LocalizationManager::timer_clock_type_ = RCL_SYSTEM_TIME
private

◆ timer_factory_

std::unique_ptr<carma_ros2_utils::timers::TimerFactory> localization_manager::LocalizationManager::timer_factory_
private

◆ timers_

std::unordered_map<uint32_t, std::pair<TimerUniquePtr, bool> > localization_manager::LocalizationManager::timers_
private

Definition at line 162 of file LocalizationManager.hpp.

Referenced by clearTimers(), and stateTransitionCallback().

◆ transition_table_

LocalizationTransitionTable localization_manager::LocalizationManager::transition_table_
private

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