NASA Astrobee Robot Software  0.19.1
Flight software for the Astrobee robots operating inside the International Space Station.
factor_adder.h
Go to the documentation of this file.
1 /* Copyright (c) 2017, United States Government, as represented by the
2  * Administrator of the National Aeronautics and Space Administration.
3  *
4  * All rights reserved.
5  *
6  * The Astrobee platform is licensed under the Apache License, Version 2.0
7  * (the "License"); you may not use this file except in compliance with the
8  * License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15  * License for the specific language governing permissions and limitations
16  * under the License.
17  */
18 
19 #ifndef FACTOR_ADDERS_FACTOR_ADDER_H_
20 #define FACTOR_ADDERS_FACTOR_ADDER_H_
21 
24 
25 #include <gtsam/nonlinear/NonlinearFactorGraph.h>
26 
27 #include <boost/serialization/serialization.hpp>
28 
29 #include <vector>
30 
31 namespace factor_adders {
32 // Adds factors to a graph. Base class for measurement-based factor adder.
33 class FactorAdder {
34  public:
35  explicit FactorAdder(const FactorAdderParams& params) : params_(params) {}
36 
37  // Default constructor for serialization only
38  FactorAdder() = default;
39 
40  virtual ~FactorAdder() = default;
41 
42  // Add factors in valid time range to existing factor graph.
43  // Returns number of added factors.
44  virtual int AddFactors(const localization_common::Time oldest_allowed_time,
45  const localization_common::Time newest_allowed_time, gtsam::NonlinearFactorGraph& factors) = 0;
46 
47  protected:
49 
50  private:
51  // Serialization function
53  template <class Archive>
54  void serialize(Archive& ar, const unsigned int file_version) {
55  ar& BOOST_SERIALIZATION_NVP(params_);
56  }
57 };
58 } // namespace factor_adders
59 
60 #endif // FACTOR_ADDERS_FACTOR_ADDER_H_
factor_adders::FactorAdder::~FactorAdder
virtual ~FactorAdder()=default
factor_adders::FactorAdder
Definition: factor_adder.h:33
factor_adders::FactorAdder::access
friend class boost::serialization::access
Definition: factor_adder.h:52
factor_adders::FactorAdder::FactorAdder
FactorAdder()=default
factor_adders::FactorAdderParams
Definition: factor_adder_params.h:23
factor_adders::FactorAdder::FactorAdder
FactorAdder(const FactorAdderParams &params)
Definition: factor_adder.h:35
time.h
factor_adder_params.h
factor_adders::FactorAdder::params_
FactorAdderParams params_
Definition: factor_adder.h:48
factor_adders
Definition: depth_odometry_factor_adder.h:31
factor_adders::FactorAdder::AddFactors
virtual int AddFactors(const localization_common::Time oldest_allowed_time, const localization_common::Time newest_allowed_time, gtsam::NonlinearFactorGraph &factors)=0
localization_common::Time
double Time
Definition: time.h:23