Go to the documentation of this file.
55 size_t K, std::function<
Key(
int)>
x =
X, std::function<
Key(
int)>
m =
M) {
61 for (
size_t k = 1; k <
K; k++) {
63 std::vector<GaussianFactor::shared_ptr>
components;
75 return std::make_shared<HybridGaussianFactorGraph>(std::move(hfg));
88 std::vector<Key> &input) {
91 std::vector<int> levels(input.size());
92 std::function<void(std::vector<Key>::iterator, std::vector<Key>::iterator,
94 bsg = [&bsg, &new_order, &levels, &input](
95 std::vector<Key>::iterator begin,
96 std::vector<Key>::iterator
end,
int lvl) {
98 std::vector<Key>::iterator pivot =
101 new_order.push_back(*pivot);
103 bsg(begin, pivot, lvl + 1);
104 bsg(pivot + 1,
end, lvl + 1);
106 new_order.push_back(*begin);
111 bsg(input.begin(), input.end(), 0);
114 return {new_order, levels};
138 Switching(
size_t K,
double between_sigma = 1.0,
double prior_sigma = 0.1,
140 std::string transitionProbabilityTable =
"1/2 3/2")
145 for (
size_t k = 0; k <
K - 1; k++) {
146 modes.emplace_back(
M(k), 2);
151 for (
size_t k = 0; k <
K; k++) {
163 for (
size_t k = 0; k <
K - 1; k++) {
170 auto measurement_noise = Isotropic::Sigma(1, prior_sigma);
171 for (
size_t k = 1; k <
K; k++) {
180 for (
size_t k = 0; k <
K; k++) {
190 size_t k,
double sigma = 1.0) {
193 std::make_shared<MotionModel>(
X(k),
X(k + 1), 0.0,
noise_model),
195 std::make_shared<MotionModel>(
X(k),
X(k + 1), 1.0,
noise_model);
196 return {still, moving};
206 std::string transitionProbabilityTable =
"1/2 3/2") {
209 for (
size_t k = 0; k <
K - 2; k++) {
210 auto parents = {
modes[k]};
212 transitionProbabilityTable);
std::shared_ptr< This > shared_ptr
shared_ptr to This
Linear Factor Graph where all factors are Gaussians.
static const Eigen::MatrixBase< Vector3 >::ConstantReturnType Z_3x1
Nonlinear hybrid factor graph that uses type erasure.
typedef and functions to augment Eigen's MatrixXd
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
std::pair< KeyVector, std::vector< int > > makeBinaryOrdering(std::vector< Key > &input)
Return the ordering as a binary tree such that all parent nodes are above their children.
DiscreteKeys is a set of keys that can be assembled using the & operator.
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
A set of GaussianFactors, indexed by a set of discrete keys.
HybridGaussianFactorGraph linearizedFactorGraph() const
Get the full linear factor graph.
HybridNonlinearFactorGraph nonlinearFactorGraph() const
Get all the nonlinear factors.
static const double sigma
ϕ(X(0)) .. ϕ(X(k),X(k+1)) .. ϕ(X(k);z_k) .. ϕ(M(0)) .. ϕ(M(K-3),M(K-2))
HybridGaussianFactorGraph linearUnaryFactors
HybridGaussianFactorGraph::shared_ptr makeSwitchingChain(size_t K, std::function< Key(int)> x=X, std::function< Key(int)> m=M)
Create a switching system chain. A switching system is a continuous system which depends on a discret...
Non-linear factor base classes.
static std::vector< NoiseModelFactor::shared_ptr > motionModels(size_t k, double sigma=1.0)
A set of nonlinear factors indexed by a set of discrete keys.
HybridNonlinearFactorGraph modeChain
Linearized Hybrid factor graph that uses type erasure.
Switching(size_t K, double between_sigma=1.0, double prior_sigma=0.1, std::vector< double > measurements={}, std::string transitionProbabilityTable="1/2 3/2")
Create with given number of time steps.
std::vector< double > measurements
HybridGaussianFactorGraph linearBinaryFactors
Values linearizationPoint
Implementation of a discrete-conditioned hybrid factor. Implements a joint discrete-continuous factor...
void insert(Key j, const Value &val)
std::shared_ptr< HybridGaussianFactorGraph > linearize(const Values &continuousValues) const
Linearize all the continuous factors in the HybridNonlinearFactorGraph.
static shared_ptr Sigma(size_t dim, double sigma, bool smart=true)
Double_ distance(const OrientedPlane3_ &p)
HybridNonlinearFactorGraph createModeChain(std::string transitionProbabilityTable="1/2 3/2")
Add "mode chain" to HybridNonlinearFactorGraph from M(0) to M(K-2). E.g. if K=4, we want M0,...
A factor with a quadratic error function - a Gaussian.
void reverse(const MatrixType &m)
std::vector< NoiseModelFactor::shared_ptr > components
static const EIGEN_DEPRECATED end_t end
HybridNonlinearFactorGraph binaryFactors
IsDerived< DERIVEDFACTOR > add(std::shared_ptr< DERIVEDFACTOR > factor)
add is a synonym for push_back.
NonlinearFactorGraph graph
std::uint64_t Key
Integer nonlinear key type.
HybridNonlinearFactorGraph unaryFactors
IsDerived< DERIVEDFACTOR > emplace_shared(Args &&... args)
Emplace a shared pointer to factor of given type.
Matrix< RealScalar, Dynamic, Dynamic > M
gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:36:54