Go to the documentation of this file.
34 #ifndef FUSE_OPTIMIZERS_FIXED_LAG_SMOOTHER_H
35 #define FUSE_OPTIMIZERS_FIXED_LAG_SMOOTHER_H
43 #include <std_srvs/Empty.h>
46 #include <condition_variable>
120 fuse_core::Graph::UniquePtr graph,
334 const std::string& sensor_name,
335 fuse_core::Transaction::SharedPtr transaction)
override;
346 #endif // FUSE_OPTIMIZERS_FIXED_LAG_SMOOTHER_H
FixedLagSmoother(fuse_core::Graph::UniquePtr graph, const ros::NodeHandle &node_handle=ros::NodeHandle(), const ros::NodeHandle &private_node_handle=ros::NodeHandle("~"))
Constructor.
std::mutex start_time_mutex_
Synchronize modification to the start_time_ variable.
void setStartTime(const ros::Time &start_time)
Thread-safe write access to the optimizer start time.
std::thread optimization_thread_
Thread used to run the optimizer as a background process.
void transactionCallback(const std::string &sensor_name, fuse_core::Transaction::SharedPtr transaction) override
Callback fired every time the SensorModel plugin creates a new transaction.
void optimizerTimerCallback(const ros::TimerEvent &event)
Callback fired at a fixed frequency to trigger a new optimization cycle.
FUSE_SMART_PTR_DEFINITIONS(FixedLagSmoother)
TransactionQueue pending_transactions_
const ros::Time & stamp() const
const ros::Time & minStamp() const
ros::Time start_time_
The timestamp of the first ignition sensor transaction.
void publishStatus(const bool running)
Publish the optimizer status message.
ceres::Solver::Summary summary_
Optimization summary, written by optimizationLoop and read by setDiagnostics.
void autostart()
Automatically start the smoother if no ignition sensors are specified.
std::condition_variable optimization_requested_
const ros::Time & maxStamp() const
ros::Time getStartTime() const
Thread-safe read-only access to the optimizer start time.
fuse_core::Transaction::SharedPtr transaction
ros::Time lag_expiration_
The oldest stamp that is inside the fixed-lag smoother window.
void optimizationLoop()
Function that optimizes all constraints, designed to be run in a separate thread.
void setDiagnostics(diagnostic_updater::DiagnosticStatusWrapper &status) override
Update and publish diagnotics.
void preprocessMarginalization(const fuse_core::Transaction &new_transaction)
Perform any required preprocessing steps before computeVariablesToMarginalize() is called.
ParameterType params_
Configuration settings for this fixed-lag smoother.
A fixed-lag smoother implementation that marginalizes out variables that are older than a defined lag...
std::atomic< bool > ignited_
std::mutex optimization_mutex_
Mutex held while the graph is begin optimized.
VariableStampIndex timestamp_tracking_
Object that tracks the timestamp associated with each variable.
ros::Timer optimize_timer_
Trigger an optimization operation at a fixed frequency.
std::atomic< bool > started_
Flag indicating the optimizer has received a transaction from an ignition sensor.
bool startServiceCallback(std_srvs::Empty::Request &, std_srvs::Empty::Response &)
Service callback that starts the optimizer plugins after they have been stopped.
fuse_core::Transaction marginal_transaction_
The marginals to add during the next optimization cycle.
ros::ServiceServer stop_service_server_
Service that stops and clears the optimizer.
std::vector< fuse_core::UUID > computeVariablesToMarginalize(const ros::Time &lag_expiration)
Compute the set of variables that should be marginalized from the graph.
ros::Publisher status_publisher_
Publishing the started/stopped status of the optimizer.
virtual ~FixedLagSmoother()
Destructor.
bool optimization_request_
Flag to trigger a new optimization.
ros::ServiceServer reset_service_server_
Service that resets the optimizer to its initial state.
Object designed to track the timestamps associated with each variable.
Defines the set of parameters required by the fuse_optimizers::FixedLagSmoother class.
ros::Time computeLagExpirationTime() const
Compute the oldest timestamp that is part of the configured lag window.
void start()
Start the optimizer.
ros::ServiceServer start_service_server_
Service that restarts the optimizer.
void stop()
Stop the optimizer.
std::vector< TransactionQueueElement > TransactionQueue
Queue of Transaction objects, sorted by timestamp.
std::mutex pending_transactions_mutex_
Synchronize modification of the pending_transactions_ container.
void postprocessMarginalization(const fuse_core::Transaction &marginal_transaction)
Perform any required post-marginalization bookkeeping.
bool stopServiceCallback(std_srvs::Empty::Request &, std_srvs::Empty::Response &)
Service callback that stops the optimizer plugins and clears the existing graph. Essentially performs...
ros::Time optimization_deadline_
The deadline for the optimization to complete. Triggers a warning if exceeded.
A base class that can be used to build fuse optimizer nodes.
std::mutex optimization_requested_mutex_
Required condition variable mutex.
std::atomic< bool > optimization_running_
Flag indicating the optimization thread should be running.
void processQueue(fuse_core::Transaction &transaction, const ros::Time &lag_expiration)
Generate motion model constraints for pending transactions and combine them into a single transaction...
bool resetServiceCallback(std_srvs::Empty::Request &, std_srvs::Empty::Response &)
Service callback that resets the optimizer to its original state.
fuse_optimizers
Author(s): Stephen Williams
, Tom Moore
autogenerated on Thu Apr 24 2025 02:19:11