MCPcopy Create free account
hub / github.com/TUC-ProAut/libRSF / InitGraph

Function InitGraph

applications/ICRA19_GNSS.cpp:44–75  ·  view source on GitHub ↗

@brief Build the factor Graph with initial values and a first set of measurements * * @param Graph reference to the factor graph object * @param Measurements reference to the dataset that contains the pseudo range measurements * @param Config reference to the factor graph config * @param Options solver option to estimate initial values * @param TimestampFirst first timestamp in the Dataset

Source from the content-addressed store, hash-verified

42 *
43 */
44void InitGraph(libRSF::FactorGraph &Graph,
45 libRSF::SensorDataSet &Measurements,
46 libRSF::FactorGraphConfig const &Config,
47 ceres::Solver::Options Options,
48 double TimestampFirst)
49{
50 /** build simple graph */
51 libRSF::FactorGraphConfig SimpleConfig = Config;
52 SimpleConfig.GNSS.ErrorModel.Type = libRSF::ErrorModelType::Gaussian;
53 libRSF::FactorGraph SimpleGraph;
54
55 SimpleGraph.addState(POSITION_STATE, libRSF::DataType::Point3, TimestampFirst);
56 SimpleGraph.addState(CLOCK_ERROR_STATE, libRSF::DataType::ClockError, TimestampFirst);
57 AddPseudorangeMeasurements(SimpleGraph, Measurements, SimpleConfig, TimestampFirst);
58
59 /** solve */
60 SimpleGraph.solve(Options);
61
62 /**add first state variables */
63 Graph.addState(POSITION_STATE, libRSF::DataType::Point3, TimestampFirst);
64 Graph.addState(CLOCK_ERROR_STATE, libRSF::DataType::ClockError, TimestampFirst);
65 Graph.addState(CLOCK_DRIFT_STATE, libRSF::DataType::ClockDrift, TimestampFirst);
66 Graph.addState(ORIENTATION_STATE, libRSF::DataType::Angle, TimestampFirst);
67
68 /** copy values to real graph */
69 Graph.getStateData().getElement(POSITION_STATE, TimestampFirst).setMean(SimpleGraph.getStateData().getElement(POSITION_STATE, TimestampFirst).getMean());
70 Graph.getStateData().getElement(CLOCK_ERROR_STATE, TimestampFirst).setMean(SimpleGraph.getStateData().getElement(CLOCK_ERROR_STATE, TimestampFirst).getMean());
71
72
73 /** add first set of measurements */
74 AddPseudorangeMeasurements(Graph, Measurements, Config, TimestampFirst);
75}
76
77
78/** @brief Adds a pseudorange measurement to the graph

Callers 1

CreateGraphAndSolveFunction · 0.70

Calls 6

addStateMethod · 0.80
solveMethod · 0.80
getElementMethod · 0.80
setMeanMethod · 0.45
getMeanMethod · 0.45

Tested by

no test coverage detected