Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoiseModelFactorN - fixed-number of variables >6 #947

Merged
merged 45 commits into from
Dec 23, 2022
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
81f1d93
NoiseModelFactorN - fixed-number of variables >6
gchenfc Dec 1, 2021
e037fa1
c++11 doesn't support std::size so use obj.size() instead
gchenfc Dec 1, 2021
d9c8ce2
alternate make_index_sequence impl if no boost::mp11
gchenfc Dec 3, 2021
2aecaf3
optional jacobian overloads backwards compatibility
gchenfc Dec 3, 2021
8fe7e48
backward compatibility unit tests for NoiseModelFactor4
gchenfc Dec 3, 2021
bee4eee
NoiseModelFactor4 implemented as derived class of NoiseModelFactorN
gchenfc Dec 3, 2021
ed07edb
converted all NoiseModelFactorX to inherit from NoiseModelFactorN
gchenfc Dec 3, 2021
ea7d769
documentation
gchenfc Dec 3, 2021
ba3cc85
avoid inheritance by conditionally defining backwards compatibility t…
gchenfc Dec 3, 2021
ddcca4c
switch template bool specialization order
gchenfc Dec 3, 2021
280acde
can't get "using NoiseModelFactorX = NoiseModelFactorN" to work
gchenfc Dec 3, 2021
89b4340
alternate option for typedef-ing X1, X2, ...
gchenfc Dec 8, 2021
5004c47
revert typedef X1, X2, ... to old version, and clean up a little
gchenfc Dec 8, 2021
018213e
switch `using NoiseModelFactorX = ...` to `#define ...`.
gchenfc Dec 9, 2021
84e873e
fix Windows CI issue: VALUE happens to have the same name in PriorFactor
gchenfc Dec 9, 2021
40e585b
review comments
gchenfc Dec 9, 2021
11fd861
update doxygen (review comment)
gchenfc Dec 9, 2021
3addc8d
Merge branch 'develop' into feature/NoiseModelFactorN
gchenfc Jan 30, 2022
c9dbb6e
create backwards compatibility unit test for NoiseModelFactor1
gchenfc Jan 30, 2022
bb33be5
revert some template stuff with inheritance for readability
gchenfc Jan 30, 2022
82e0d20
move boost::index_sequence stuff to utilities file
gchenfc Jan 30, 2022
d62033a
fix namespace collision with symbol_shorthand::X in unit test
gchenfc Jan 30, 2022
a2fb0e4
Revert "create backwards compatibility unit test for NoiseModelFactor1"
gchenfc Jan 31, 2022
1a427cd
Serialize test strings generated with Boost 1.65
gchenfc Jan 31, 2022
6653d66
fix test xml file path
gchenfc Jan 31, 2022
782a894
fix expected serialization string
gchenfc Apr 21, 2022
8ae8c7a
Merge branch 'develop' into feature/NoiseModelFactorN
gchenfc Apr 21, 2022
71767a4
serialization debugging (from stash)
gchenfc Jul 19, 2022
2ea97fb
Merge branch 'develop' into feature/NoiseModelFactorN_test
gchenfc Jul 19, 2022
00cf13b
update serialized string
gchenfc Jul 19, 2022
ea6e32d
bugfix on serialization
gchenfc Jul 19, 2022
8327685
remove debug statements
gchenfc Jul 20, 2022
fa196aa
turn off backwards compatibility test with quaternions or TBB since s…
gchenfc Jul 20, 2022
1127276
Merge branch 'develop' into feature/NoiseModelFactorN (for CI)
gchenfc Jul 21, 2022
322e555
address review comments
gchenfc Nov 16, 2022
94865c4
fix boost 1.65 patch bug
gchenfc Dec 19, 2022
63950b9
Revert "fix namespace collision with symbol_shorthand::X in unit test"
gchenfc Dec 19, 2022
0ebc6e8
Change `X<N>` to `ValueType<N>` and `VALUES` -> `ValueTypes`
gchenfc Dec 19, 2022
b24511f
address review comments
gchenfc Dec 19, 2022
e8ddbbe
Check type of CONTAINER constructor tparam
gchenfc Dec 20, 2022
040eb63
make SFINAE templates more readable
gchenfc Dec 22, 2022
d16d263
better docstrings w/ usage examples
gchenfc Dec 22, 2022
4b93970
Change backwards-compatibility defs to utilize new style
gchenfc Dec 22, 2022
19215af
update and fix unit tests
gchenfc Dec 22, 2022
2a7efc7
Merge branch 'develop' into feature/NoiseModelFactorN_replaceDeprecated
gchenfc Dec 22, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions gtsam/base/utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,41 @@ struct RedirectCout {
};

}

// boost::index_sequence was introduced in 1.66, so we'll manually define an
// implementation if user has 1.65. boost::index_sequence is used to get array
// indices that align with a parameter pack.
#if BOOST_VERSION >= 106600
#include <boost/mp11/integer_sequence.hpp>
#else
namespace boost {
namespace mp11 {
// Adapted from https://stackoverflow.com/a/32223343/9151520
template <size_t... Ints>
struct index_sequence {
using type = index_sequence;
using value_type = size_t;
static constexpr std::size_t size() noexcept { return sizeof...(Ints); }
};
namespace detail {
template <class Sequence1, class Sequence2>
struct _merge_and_renumber;

template <size_t... I1, size_t... I2>
struct _merge_and_renumber<index_sequence<I1...>, index_sequence<I2...> >
: index_sequence<I1..., (sizeof...(I1) + I2)...> {};
} // namespace detail
template <size_t N>
struct make_index_sequence
: detail::_merge_and_renumber<
typename make_index_sequence<N / 2>::type,
typename make_index_sequence<N - N / 2>::type> {};
template <>
struct make_index_sequence<0> : index_sequence<> {};
template <>
struct make_index_sequence<1> : index_sequence<0> {};
template <class... T>
using index_sequence_for = make_index_sequence<sizeof...(T)>;
} // namespace mp11
} // namespace boost
#endif
2 changes: 1 addition & 1 deletion gtsam/mainpage.dox
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ To use GTSAM to solve your own problems, you will often have to create new facto

-# The number of variables your factor involves is <b>unknown</b> at compile time - derive from NoiseModelFactor and implement NoiseModelFactor::unwhitenedError()
- This is a factor expressing the sum-of-squares error between a measurement \f$ z \f$ and a measurement prediction function \f$ h(x) \f$, on which the errors are expected to follow some distribution specified by a noise model (see noiseModel).
-# The number of variables your factor involves is <b>known</b> at compile time and is between 1 and 6 - derive from NoiseModelFactor1, NoiseModelFactor2, NoiseModelFactor3, NoiseModelFactor4, NoiseModelFactor5, or NoiseModelFactor6, and implement <b>\c evaluateError()</b>
-# The number of variables your factor involves is <b>known</b> at compile time, derive from NoiseModelFactorN<T1, T2, ...> (where T1, T2, ... are the types of the variables, e.g. double, Vector, Pose3) and implement <b>\c evaluateError()</b>.
- This factor expresses the same sum-of-squares error with a noise model, but makes the implementation task slightly easier than with %NoiseModelFactor.
-# Derive from NonlinearFactor
- This is more advanced and allows creating factors without an explicit noise model, or that linearize to HessianFactor instead of JacobianFactor.
Expand Down
Loading