Skip to content

Commit

Permalink
[FIX] Throw an error when the size of the state does not match the si…
Browse files Browse the repository at this point in the history
…ze of the standard deviation vector
  • Loading branch information
LAGNEAU Romain committed Sep 4, 2024
1 parent f29cc46 commit c5d852d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions modules/core/include/visp3/core/vpParticleFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,9 @@ void vpParticleFilter<MeasurementsType>::init(const vpColVector &x0, const vpPro
const vpResamplingConditionFunction &checkResamplingFunc, const vpResamplingFunction &resamplingFunc,
const vpFilterFunction &filterFunc, const vpStateAddFunction &addFunc)
{
if (x0.size() != m_noiseGenerators[0].size()) {
throw(vpException(vpException::dimensionError, "X0 does not have the same size than the vector of stdevs used to build the object"));

Check warning on line 477 in modules/core/include/visp3/core/vpParticleFilter.h

View check run for this annotation

Codecov / codecov/patch

modules/core/include/visp3/core/vpParticleFilter.h#L477

Added line #L477 was not covered by tests
}
m_f = f;
m_stateFilterFunc = filterFunc;
m_likelihood = l;
Expand All @@ -492,6 +495,9 @@ void vpParticleFilter<MeasurementsType>::init(const vpColVector &x0, const vpCom
const vpResamplingConditionFunction &checkResamplingFunc, const vpResamplingFunction &resamplingFunc,
const vpFilterFunction &filterFunc, const vpStateAddFunction &addFunc)
{
if (x0.size() != m_noiseGenerators[0].size()) {
throw(vpException(vpException::dimensionError, "X0 does not have the same size than the vector of stdevs used to build the object"));
}
m_bx = bx;
m_stateFilterFunc = filterFunc;
m_likelihood = l;
Expand Down

0 comments on commit c5d852d

Please sign in to comment.