[Bug 479] New: Some filters will break real-time

For more infomation about this bug, visit
Summary: Some filters will break real-time
Product: BFL
Version: trunk
Platform: All
OS/Version: All
Status: NEW
Severity: blocker
Priority: P1
Component: core
AssignedTo: bfl [..] ...
ReportedBy: klaas [dot] gadeyne [..] ...
CC: bfl [..] ...
Estimated Hours: 0.0

HistogramFilter::SysUpdate(SystemModel* const sysmodel, const int& u)
{
[...]
vector old_prob = ( (DiscretePdf*)_post )->ProbabilitiesGet();
vector new_prob(num_states);
[...]
}

If I'm not mistaken, this will lead to allocations on the heap and make the
historgram filter unsuited for use in real-time applications.
I noticed similar code in the MeasUpdate function of HistogramFilter and the
KalmanFilter code also seems to suffer from a similar issue:

void
KalmanFilter::CalculateSysUpdate(ColumnVector J, Matrix F, SymmetricMatrix Q)
{
[...]
Matrix temp = F * (Matrix)_post->CovarianceGet() * F.transpose() +
(Matrix)Q;
SymmetricMatrix Sigma_new(_post->DimensionGet());
[...]
}

Idem dito for the IEKF code and the SRIEKF. Particle Filter code seems to be
fine. I guess people@PMA should have noticed this when using this filters
under LXRT?

Damned, I should have noticed this long ago :-(

[Bug 479] Some filters will break real-time

https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=479

--- Comment #56 from Tinne De Laet <tinne [dot] delaet [..] ...> 2009-05-20 15:11:14 ---
Created an attachment (id=426)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=426)
solves error reported in Comment #55

[Bug 479] Some filters will break real-time

https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=479

--- Comment #57 from Tinne De Laet <tinne [dot] delaet [..] ...> 2009-05-20 15:13:55 ---
(In reply to comment #56)
> Created an attachment (id=426)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=426) [details]
> solves error reported in Comment #55

Patch (attachment (id=426) ) applied in revision 30165

svn commit
Sending matrix/matrix_LTI.h
Transmitting file data .
Committed revision 30165.

[Bug 479] Some filters will break real-time

https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=479

--- Comment #55 from Klaas Gadeyne <klaas [dot] gadeyne [..] ...> 2009-05-07 16:58:53 ---
(In reply to comment #54)
> Patch #376 applied in revision 29884 :
> svn commit
> Sending src/pdf/gaussian.cpp
> Sending src/pdf/gaussian.h
> Sending src/wrappers/matrix/matrix_BOOST.cpp
> Sending src/wrappers/matrix/matrix_BOOST.h
> Sending src/wrappers/matrix/matrix_LTI.cpp
> Sending src/wrappers/matrix/matrix_LTI.h
> Sending src/wrappers/matrix/matrix_NEWMAT.cpp
> Sending src/wrappers/matrix/matrix_NEWMAT.h
> Sending src/wrappers/matrix/matrix_wrapper.h
> Transmitting file data .........
> Committed revision 29884.

This last patch seems to break the LTI matrix wrapper, see
<http://lists.mech.kuleuven.be/pipermail/bfl/2009-May/001156.html>

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=479>

--- Comment #54 from Tinne De Laet <tinne [dot] delaet [..] ...> 2009-01-30 16:29:38 ---
Patch #376 applied in revision 29884 :
svn commit
Sending src/pdf/gaussian.cpp
Sending src/pdf/gaussian.h
Sending src/wrappers/matrix/matrix_BOOST.cpp
Sending src/wrappers/matrix/matrix_BOOST.h
Sending src/wrappers/matrix/matrix_LTI.cpp
Sending src/wrappers/matrix/matrix_LTI.h
Sending src/wrappers/matrix/matrix_NEWMAT.cpp
Sending src/wrappers/matrix/matrix_NEWMAT.h
Sending src/wrappers/matrix/matrix_wrapper.h
Transmitting file data .........
Committed revision 29884.

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=479>

--- Comment #53 from Tinne De Laet <tinne [dot] delaet [..] ...> 2009-01-30 16:27:01 ---
Created an attachment (id=376)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=376)
Removes an extra allocation from gaussian and therefore adds a multiply
function to the matrixwrapper

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

--- Comment #52 from Klaas Gadeyne <klaas [dot] gadeyne [..] ...> 2008-01-26 00:30:51 ---
(In reply to comment #47)
> (In reply to comment #21)
> > Created an attachment (id=200)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=200) [details] [details]
> > Patch to solve allocation issues for rauchtungstriebel
> >
>
> Patch (attachment (id=200) [details]) applied in revision 28875:
>
> Sending rauchtungstriebel.cpp
> Sending rauchtungstriebel.h
> Transmitting file data ..
> Committed revision 28875.

Patch seems ok (even a posteriori) :-). I think all of them are reviewed and
applied now?

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

--- Comment #51 from Tinne De Laet <tinne [dot] delaet [..] ...> 2008-01-23 17:47:33 ---

(In reply to comment #38)
> Created an attachment (id=227)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=227) [details]
> Patch to solve allocation issues for iteratedextendedKalmanFilter - bis
>
> This patch also adds a map to the iteratedExtendedKalmanFilter to allocate
> memory needed during the measurement update (see comment #24, #25, #26)
>

Patch (attachment (id=227)) applied in revision:

Sending filter/iteratedextendedkalmanfilter.cpp
Sending filter/iteratedextendedkalmanfilter.h
Transmitting file data ..
Committed revision 28879

Tinne

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

--- Comment #50 from Tinne De Laet <tinne [dot] delaet [..] ...> 2008-01-23 17:44:29 ---
(In reply to comment #37)
> Created an attachment (id=226)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=226) [details]
> Patch to solve allocation issues for extendedKalmanFilter - bis
>
> This patch also adds a map to the extendedKalmanFilter to allocate memory
> needed during the measurement updat (see comment #24, #25, #26)

Patch applied in revision 28878

Sending extendedkalmanfilter.cpp
Sending extendedkalmanfilter.h
Transmitting file data ..
Committed revision 28878.

Tinne

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

--- Comment #49 from Tinne De Laet <tinne [dot] delaet [..] ...> 2008-01-23 17:39:22 ---
> (In reply to comment #12)
> > Created an attachment (id=193)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=193) [details] [details] [details]
> > Patch to solve allocation issues for particlefilt(In reply to comment #26)
> Created an attachment (id=207)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=207) [details]
> Patch to solve allocation issues for kalmanfilter - bis
[..]

Patch (attachment (id=207)) applied in revision 28877:

Sending kalmanfilter.cpp
Sending kalmanfilter.h
Transmitting file data ..
Committed revision 28877.

Tinne

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

--- Comment #48 from Tinne De Laet <tinne [dot] delaet [..] ...> 2008-01-23 17:19:15 ---
(In reply to comment #28)
> Created an attachment (id=215)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=215) [details]
> Solves issue explained in bug #497, this time with a patch an not just the
> mcpdf
>

Patch (attachment (id=215)) applied in revision 28876

Sending mcpdf.cpp
Sending mcpdf.h
Transmitting file data ..
Committed revision 28876.

Tinne

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

--- Comment #47 from Tinne De Laet <tinne [dot] delaet [..] ...> 2008-01-23 15:26:08 ---
(In reply to comment #21)
> Created an attachment (id=200)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=200) [details]
> Patch to solve allocation issues for rauchtungstriebel
>

Patch (attachment (id=200)) applied in revision 28875:

Sending rauchtungstriebel.cpp
Sending rauchtungstriebel.h
Transmitting file data ..
Committed revision 28875.

Tinne

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

Tinne De Laet <tinne [dot] delaet [..] ...> changed:

What |Removed |Added
--------------------------------------------------------------------------
Attachment #199 is|0 |1
obsolete| |

--- Comment #45 from Tinne De Laet <tinne [dot] delaet [..] ...> 2008-01-23 11:42:02 ---
Created an attachment (id=228)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=228)
Patch to solve allocation issues for uniform - bis

(In reply to comment #24)
> > Created an attachment (id=199)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=199) [details] [details]
> > Patch to solve allocation issues for uniform

> this patch is ok, but it seems that there is an unused (and unnecessary)
> variable _rit defined in the header file.

> some minor remark (I've seen this in a couple of the patches). Don't add
> doxygen style comment for the helper variables (they should be hidden for
> the user)

Your suggestions are applied in the new patch.

tinne

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

--- Comment #46 from Tinne De Laet <tinne [dot] delaet [..] ...> 2008-01-23 11:43:28 ---
(In reply to comment #45)
> Created an attachment (id=228)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=228) [details]
> Patch to solve allocation issues for uniform - bis
the user)
>
> Your suggestions are applied in the new patch.

Patch (attachment (id=228)) applied in revision 28874:

Sending uniform.cpp
Sending uniform.h
Transmitting file data ..
Committed revision 28874.

Tinne

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

--- Comment #42 from Tinne De Laet <tinne [dot] delaet [..] ...> 2008-01-23 11:23:25 ---
(In reply to comment #29)
> (In reply to comment #17)
> > Created an attachment (id=195)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=195) [details] [details]
> > Patch to solve allocation issues for discreteconditionalpdf
>
> patch ok, although these constructions
> - int DiscreteConditionalPdf::IndexGet(int input,
> - std::vector condargs) const
> + int DiscreteConditionalPdf::IndexGet(const int& input,
> + const std::vector& condargs) const
>
> are somewhat unnecessary, since the copy will be on the stack.
>

Patch (attachment (id=195)) applied in revision 28871:

Sending pdf/discreteconditionalpdf.cpp
Sending pdf/discreteconditionalpdf.h
Transmitting file data ..
Committed revision 28871.

Tinne

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

--- Comment #44 from Tinne De Laet <tinne [dot] delaet [..] ...> 2008-01-23 11:36:29 ---
(In reply to comment #33)
> (In reply to comment #19)
> > Created an attachment (id=197)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=197) [details] [details]
> > Patch to solve allocation issues for linearanalyticconditionalgaussian
>
> patch seems ok (again :-)
>
Patch (attachment (id=197)) applied in revision 28873:

Sending linearanalyticconditionalgaussian.cpp
Sending linearanalyticconditionalgaussian.h
Transmitting file data ..
Committed revision 28873.

Tinne

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

--- Comment #43 from Tinne De Laet <tinne [dot] delaet [..] ...> 2008-01-23 11:29:15 ---
(In reply to comment #23)
> Created an attachment (id=205)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=205) [details]
> Patch to solve allocation issues for gaussian - bis
>

Patch (attachment (id=205)) applied in revision

Sending gaussian.cpp
Sending gaussian.h
Transmitting file data ..
Committed revision 28872.

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

--- Comment #41 from Tinne De Laet <tinne [dot] delaet [..] ...> 2008-01-23 11:12:55 ---
(In reply to comment #32)
> (In reply to comment #16)
> > Created an attachment (id=194)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=194) [details] [details]
> > Patch to solve allocation issues for conditionalgaussian
>
> Patch seems ok
>

Patch (attachment (id=194)) applied in revision 28870.

Sending conditionalgaussian.cpp
Sending conditionalgaussian.h
Transmitting file data ..
Committed revision 28870.

Tinne

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

--- Comment #40 from Tinne De Laet <tinne [dot] delaet [..] ...> 2008-01-23 11:01:50 ---

> (In reply to comment #12)
> > Created an attachment (id=193)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=193) [details] [details]
> > Patch to solve allocation issues for particlefilter
>
> apart from some whitespace cluttering, patch seems ok.

Patch (attachment (id=193)) applied in revision 28869:

Sending particlefilter.cpp
Sending particlefilter.h
Transmitting file data ..
Committed revision 28869

Tinne

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

--- Comment #39 from Tinne De Laet <tinne [dot] delaet [..] ...> 2008-01-23 10:52:18 ---
(In reply to comment #30)
> (In reply to comment #11)
> > Created an attachment (id=191)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=191) [details] [details]
> > Patch to solve allocation issues for histogramfilter
>
> Patch ok
>

Patch (attachement #191) applied in revision 28868.

Sending histogramfilter.cpp
Sending histogramfilter.h
Transmitting file data ..
Committed revision 28868.

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

Tinne De Laet <tinne [dot] delaet [..] ...> changed:

What |Removed |Added
--------------------------------------------------------------------------
Attachment #189 is|0 |1
obsolete| |

--- Comment #38 from Tinne De Laet <tinne [dot] delaet [..] ...> 2008-01-23 09:49:02 ---
Created an attachment (id=227)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=227)
Patch to solve allocation issues for iteratedextendedKalmanFilter - bis

This patch also adds a map to the iteratedExtendedKalmanFilter to allocate
memory needed during the measurement update (see comment #24, #25, #26)

Tinne

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

Tinne De Laet <tinne [dot] delaet [..] ...> changed:

What |Removed |Added
--------------------------------------------------------------------------
Attachment #188 is|0 |1
obsolete| |

--- Comment #37 from Tinne De Laet <tinne [dot] delaet [..] ...> 2008-01-23 08:44:00 ---
Created an attachment (id=226)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=226)
Patch to solve allocation issues for extendedKalmanFilter - bis

This patch also adds a map to the extendedKalmanFilter to allocate memory
needed during the measurement updat (see comment #24, #25, #26)

Tinne

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

--- Comment #36 from Tinne De Laet <tinne [dot] delaet [..] ...> 2008-01-21 09:06:36 ---
(In reply to comment #35)
> Created an attachment (id=219)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=219) [details]
> Patch to solve allocation issues for EKparticlefilter - bis2
>
> Final patch for EKparticlefilter. (?)
>
Patch applied in revision 28848:

Sending filter/EKparticlefilter.cpp
Sending filter/EKparticlefilter.h
Transmitting file data ..
Committed revision 28848.

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

Tinne De Laet <tinne [dot] delaet [..] ...> changed:

What |Removed |Added
--------------------------------------------------------------------------
Attachment #184 is|0 |1
obsolete| |

--- Comment #35 from Tinne De Laet <tinne [dot] delaet [..] ...> 2008-01-21 09:05:26 ---
Created an attachment (id=219)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=219)
Patch to solve allocation issues for EKparticlefilter - bis2

Final patch for EKparticlefilter. (?)

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

--- Comment #34 from Klaas Gadeyne <klaas [dot] gadeyne [..] ...> 2008-01-19 18:41:42 ---
(In reply to comment #20)
> Created an attachment (id=199)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=199) [details]
> Patch to solve allocation issues for uniform

this patch is ok, but it seems that there is an unused (and unnecessary)
variable _rit defined in the header file.

some minor remark (I've seen this in a couple of the patches). Don't add
doxygen style comment for the helper variables (they should be hidden for the
user)

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

--- Comment #33 from Klaas Gadeyne <klaas [dot] gadeyne [..] ...> 2008-01-19 18:33:43 ---
(In reply to comment #19)
> Created an attachment (id=197)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=197) [details]
> Patch to solve allocation issues for linearanalyticconditionalgaussian

patch seems ok (again :-)

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

--- Comment #32 from Klaas Gadeyne <klaas [dot] gadeyne [..] ...> 2008-01-19 18:26:40 ---
(In reply to comment #16)
> Created an attachment (id=194)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=194) [details]
> Patch to solve allocation issues for conditionalgaussian

Patch seems ok

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

--- Comment #31 from Klaas Gadeyne <klaas [dot] gadeyne [..] ...> 2008-01-19 18:05:18 ---
(In reply to comment #12)
> Created an attachment (id=193)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=193) [details]
> Patch to solve allocation issues for particlefilter

apart from some whitespace cluttering, patch seems ok.

Klaas

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

--- Comment #30 from Klaas Gadeyne <klaas [dot] gadeyne [..] ...> 2008-01-19 17:52:37 ---
(In reply to comment #11)
> Created an attachment (id=191)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=191) [details]
> Patch to solve allocation issues for histogramfilter

Patch ok

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

--- Comment #29 from Klaas Gadeyne <klaas [dot] gadeyne [..] ...> 2008-01-19 17:46:14 ---
(In reply to comment #17)
> Created an attachment (id=195)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=195) [details]
> Patch to solve allocation issues for discreteconditionalpdf

patch ok, although these constructions
- int DiscreteConditionalPdf::IndexGet(int input,
- std::vector condargs) const
+ int DiscreteConditionalPdf::IndexGet(const int& input,
+ const std::vector& condargs) const

are somewhat unnecessary, since the copy will be on the stack.

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

Tinne De Laet <tinne [dot] delaet [..] ...> changed:

What |Removed |Added
--------------------------------------------------------------------------
Attachment #212 is|0 |1
obsolete| |

--- Comment #28 from Tinne De Laet <tinne [dot] delaet [..] ...> 2008-01-18 19:30:53 ---
Created an attachment (id=215)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=215)
Solves issue explained in bug #497, this time with a patch an not just the
mcpdf

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

Tinne De Laet <tinne [dot] delaet [..] ...> changed:

What |Removed |Added
--------------------------------------------------------------------------
Attachment #204 is|0 |1
obsolete| |

--- Comment #27 from Tinne De Laet <tinne [dot] delaet [..] ...> 2008-01-18 16:37:47 ---
Created an attachment (id=212)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=212)
Solves issue explained in bug #497

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

Tinne De Laet <tinne [dot] delaet [..] ...> changed:

What |Removed |Added
--------------------------------------------------------------------------
Attachment #187 is|0 |1
obsolete| |

--- Comment #26 from Tinne De Laet <tinne [dot] delaet [..] ...> 2008-01-16 14:28:34 ---
Created an attachment (id=207)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=207)
Patch to solve allocation issues for kalmanfilter - bis

(In reply to comment #24 and #25)

> The calculatesysupdate and calculatemeasupdate functions should use references
> for passing the matrix arguments, otherwise the local copies will also result
> in allocations.
> So I think you need function references like
>
> void CalculateMeasUpdate(const ColumnVector & z, const ColumnVector & Z, const
> Matrix & H, const SymmetricMatrix & R)
>
> etc.

Ok.

> Concerning the workaround: suppose you have a system with measurements from 2
> sources which generate measurements approximately randomly, in that case, you
> will allocate each time.
>
> What about turning _S and _K as a vectors of ColumnVectors/Matrices, which you
> can initialize using an allocateMeasModel function?

> While trying to do a 5 minute implementation of the above, I discovered we
> would need something like stl::hash_set() in order to implement this efficient
> (i.e. make the lookup of which vectors to use very fast)
I used a map to implement the behavior you suggested.
Furthermore I made a struct of variables which need to be allocated during the
call of MeasUpdate.

Tinne

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

--- Comment #25 from Klaas Gadeyne <klaas [dot] gadeyne [..] ...> 2008-01-13 19:57:50 ---
(In reply to comment #24)
> (In reply to comment #6)
> > Created an attachment (id=187)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=187) [details] [details]
> > Patch to solve allocation issues for kalmanfilter
> >
> > ...
> > notice the work-around-solution for initializing some of the variables needed
> > in measupdate.
>
> The calculatesysupdate and calculatemeasupdate functions should use references
> for passing the matrix arguments, otherwise the local copies will also result
> in allocations.
> So I think you need function references like
>
> void CalculateMeasUpdate(const ColumnVector & z, const ColumnVector & Z, const
> Matrix & H, const SymmetricMatrix & R)
>
> etc.
>
> Concerning the workaround: suppose you have a system with measurements from 2
> sources which generate measurements approximately randomly, in that case, you
> will allocate each time.
>
> What about turning _S and _K as a vectors of ColumnVectors/Matrices, which you
> can initialize using an allocateMeasModel function?

While trying to do a 5 minute implementation of the above, I discovered we
would need something like stl::hash_set() in order to implement this efficient
(i.e. make the lookup of which vectors to use very fast)

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

--- Comment #24 from Klaas Gadeyne <klaas [dot] gadeyne [..] ...> 2008-01-11 20:04:56 ---
(In reply to comment #6)
> Created an attachment (id=187)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=187) [details]
> Patch to solve allocation issues for kalmanfilter
>
> ...
> notice the work-around-solution for initializing some of the variables needed
> in measupdate.

The calculatesysupdate and calculatemeasupdate functions should use references
for passing the matrix arguments, otherwise the local copies will also result
in allocations.
So I think you need function references like

void CalculateMeasUpdate(const ColumnVector & z, const ColumnVector & Z, const
Matrix & H, const SymmetricMatrix & R)

etc.

Concerning the workaround: suppose you have a system with measurements from 2
sources which generate measurements approximately randomly, in that case, you
will allocate each time.

What about turning _S and _K as a vectors of ColumnVectors/Matrices, which you
can initialize using an allocateMeasModel function?

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

Tinne De Laet <tinne [dot] delaet [..] ...> changed:

What |Removed |Added
--------------------------------------------------------------------------
Attachment #196 is|0 |1
obsolete| |

--- Comment #23 from Tinne De Laet <tinne [dot] delaet [..] ...> 2008-01-11 16:31:31 ---
Created an attachment (id=205)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=205)
Patch to solve allocation issues for gaussian - bis

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

--- Comment #22 from Tinne De Laet <tinne [dot] delaet [..] ...> 2008-01-11 14:48:30 ---
Created an attachment (id=204)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=204)
Patch to solve allocation issues for mcpdf

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

--- Comment #21 from Tinne De Laet <tinne [dot] delaet [..] ...> 2008-01-11 10:20:48 ---
Created an attachment (id=200)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=200)
Patch to solve allocation issues for rauchtungstriebel

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

--- Comment #20 from Tinne De Laet <tinne [dot] delaet [..] ...> 2008-01-11 10:20:10 ---
Created an attachment (id=199)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=199)
Patch to solve allocation issues for uniform

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

--- Comment #19 from Tinne De Laet <tinne [dot] delaet [..] ...> 2008-01-10 18:47:29 ---
Created an attachment (id=197)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=197)
Patch to solve allocation issues for linearanalyticconditionalgaussian

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

--- Comment #18 from Tinne De Laet <tinne [dot] delaet [..] ...> 2008-01-10 18:46:56 ---
Created an attachment (id=196)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=196)
Patch to solve allocation issues for gaussian

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

--- Comment #16 from Tinne De Laet <tinne [dot] delaet [..] ...> 2008-01-10 18:45:56 ---
Created an attachment (id=194)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=194)
Patch to solve allocation issues for conditionalgaussian

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

--- Comment #17 from Tinne De Laet <tinne [dot] delaet [..] ...> 2008-01-10 18:46:24 ---
Created an attachment (id=195)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=195)
Patch to solve allocation issues for discreteconditionalpdf

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

--- Comment #15 from Tinne De Laet <tinne [dot] delaet [..] ...> 2008-01-10 18:43:58 ---
Any suggestions how to get the sampleFrom(list ) in discretepdf realtime?
The rescaling of the uniform samples is causing my difficulties.

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

--- Comment #14 from Klaas Gadeyne <klaas [dot] gadeyne [..] ...> 2008-01-10 17:50:40 ---
(In reply to comment #13)
> A small question:
>
> To obtain real-timeness
> I think I should change some things to the function sampleFrom (pdf.h ...)
> 84 virtual bool SampleFrom (vector >& list_samples,
> 85 const unsigned int num_samples,
> 86 int method = DEFAULT,
> 87 void * args = NULL) const;
> In the implementation in for instance gaussian.cpp, the list_samples is first
> resized to num_samples which breaks the real-timeness.
> Could I add a precondition (and an assert) to make sure that the list_samples
> already has the correct size?

If I understand it correctly, the resize operation only breaks realtime if

list_samples.size() != num_samples

If not, the resize() operation does not break real-time.
So the user of this function _can_ have real-time evaluation if he wants to.
IMO, what should be done is adding a warning to the API documentation of Pdf
about this.

This should allow people creating BFL filters meant for real-time use obtaining
real-time behavior, but it should not hinder people that are not interested in
real-time behavior of writing simple applications like

gaussian g(mu,sigma)
vector > v;
g.samplefrom(v,100);

The BFL logger (which does currently not exist, and whom [?] I'd like to share
with the other Orocos subprojects (hence, reusing the RTT logger) could then
print a warning about the real-timeness.

Klaas

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

Tinne De Laet <tinne [dot] delaet [..] ...> changed:

What |Removed |Added
--------------------------------------------------------------------------
CC| |tinne [dot] delaet [..] ...en.b
| |e

--- Comment #13 from Tinne De Laet <tinne [dot] delaet [..] ...> 2008-01-10 17:34:05 ---
A small question:

To obtain real-timeness
I think I should change some things to the function sampleFrom (pdf.h ...)
84 virtual bool SampleFrom (vector >& list_samples,
85 const unsigned int num_samples,
86 int method = DEFAULT,
87 void * args = NULL) const;
In the implementation in for instance gaussian.cpp, the list_samples is first
resized to num_samples which breaks the real-timeness.
Could I add a precondition (and an assert) to make sure that the list_samples
already has the correct size?
Or do you see another, more suitable, solution.

Tinne

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

--- Comment #12 from Tinne De Laet <tinne [dot] delaet [..] ...> 2008-01-10 14:59:17 ---
Created an attachment (id=193)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=193)
Patch to solve allocation issues for particlefilter

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

--- Comment #11 from Tinne De Laet <tinne [dot] delaet [..] ...> 2008-01-10 14:22:11 ---
Created an attachment (id=191)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=191)
Patch to solve allocation issues for histogramfilter

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

--- Comment #10 from Klaas Gadeyne <klaas [dot] gadeyne [..] ...> 2008-01-10 14:17:56 ---
(In reply to comment #5)
> Created an attachment (id=184)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=184) [details]
> Patch to solve allocation issues for EKparticlefilter - bis

Patch seems ok (2 minor issues, (i) a small and minor indentation thingie, and
(ii) by adding the delete statement in the destructor, I guess your fixing
another bug, but "who cares" :-)

> Ack, I think the new patch also preallocates the matrices,... but using the
> assign function in stead of iterating over the list.

Excellent.

Apart from the above, I still think we have to figure out a way of
automagically detecting these kind of errors in the unit testing (or at least
somewhere else)
Now we actually _think_ the bug is fixed, and we need to investigate valgrind
traces in order to be sure, which is not a good thing.

Klaas

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

--- Comment #9 from Tinne De Laet <tinne [dot] delaet [..] ...> 2008-01-10 14:13:01 ---
Created an attachment (id=190)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=190)
Patch to solve allocation issues for SRitereatedExtendedKalmanFilter

... same remark as with kalmanfilter

[Bug 479] Some filters will break real-time

For more infomation about this bug, visit

--- Comment #8 from Tinne De Laet <tinne [dot] delaet [..] ...> 2008-01-10 14:11:40 ---
Created an attachment (id=189)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=189)
Patch to solve allocation issues for itereatedExtendedKalmanFilter

... same remark as with kalmanfilter