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

Buffer/Queue Cell #204

Open
stwirth opened this issue May 25, 2012 · 8 comments
Open

Buffer/Queue Cell #204

stwirth opened this issue May 25, 2012 · 8 comments

Comments

@stwirth
Copy link

stwirth commented May 25, 2012

In many applications some sensor input has to be buffered for further processing, i.e. an algorithm needs not only the current but also N past sensor values for processing. An example would be a median/mean/etc. filter of a fixed width.
Is there some functionality in ecto for that? If not, I am willing to write a cell that does that:
Input: any type
Params: number of values to buffer
Output: N outputs of same type as input, dependent on the number of values given as param.
This cell would gather N inputs before writing anything to the output. The output could be a vector as well, what do you suggest?

@straszheim
Copy link
Member

Maybe just construct a cell that outputs a circular buffer of type T. You'd
need to instantiate it for your T. As I recall there is a circular buffer
in boost somewhere. A circular buffer of tendrils would be possible but a
hassle to work with if you cared what was in them...
On May 25, 2012 1:57 PM, "Stephan" <
[email protected]>
wrote:

In many applications some sensor input has to be buffered for further
processing, i.e. an algorithm needs not only the current but also N past
sensor values for processing. An example would be a median/mean/etc. filter
of a fixed width.
Is there some functionality in ecto for that? If not, I am willing to
write a cell that does that:
Input: any type
Params: number of values to buffer
Output: N outputs of same type as input, dependent on the number of values
given as param.
This cell would gather N inputs before writing anything to the output. The
output could be a vector as well, what do you suggest?


Reply to this email directly or view it on GitHub:
#204

@straszheim
Copy link
Member

Hm, or a std::deque.
On May 25, 2012 3:52 PM, "Troy Straszheim" [email protected]
wrote:

Maybe just construct a cell that outputs a circular buffer of type T.
You'd need to instantiate it for your T. As I recall there is a circular
buffer in boost somewhere. A circular buffer of tendrils would be possible
but a hassle to work with if you cared what was in them...
On May 25, 2012 1:57 PM, "Stephan" <
[email protected]>
wrote:

In many applications some sensor input has to be buffered for further
processing, i.e. an algorithm needs not only the current but also N past
sensor values for processing. An example would be a median/mean/etc. filter
of a fixed width.
Is there some functionality in ecto for that? If not, I am willing to
write a cell that does that:
Input: any type
Params: number of values to buffer
Output: N outputs of same type as input, dependent on the number of
values given as param.
This cell would gather N inputs before writing anything to the output.
The output could be a vector as well, what do you suggest?


Reply to this email directly or view it on GitHub:
#204

@stwirth
Copy link
Author

stwirth commented May 25, 2012

If i just want to pass a "delayed" value, not the whole buffer: is it possible to write the cell independent of the type of input/output? Just like the passthrough cell but with a buffer in between.

@straszheim
Copy link
Member

Sure, deque of tendrils ought to do it

On Fri, May 25, 2012 at 5:02 PM, Stephan <
[email protected]

wrote:

If i just want to pass a "delayed" value, not the whole buffer: is it
possible to write the cell independent of the type of input/output? Just
like the passthrough cell but with a buffer in between.


Reply to this email directly or view it on GitHub:
#204 (comment)

Troy Straszheim
Cofounder, CEO
Industrial Perception, Inc.

@stwirth
Copy link
Author

stwirth commented May 25, 2012

Could you please have a look at my implementation and tell me what's wrong?
https://github.com/stwirth/ecto/compare/delay_cell
The second test of test_delay.py does not work as expected, the output of the adder is always 0.

@straszheim
Copy link
Member

On Fri, May 25, 2012 at 5:58 PM, Stephan <
[email protected]

wrote:

Could you please have a look at my implementation and tell me what's wrong?
https://github.com/stwirth/ecto/compare/delay_cell
The second test of test_delay.py does not work as expected, the output of
the adder is always 0.


Reply to this email directly or view it on GitHub:
#204 (comment)

It looks like the ecto bits are correct. You might use std::deque and
push_front/pop_back to be sure you're using the datastructure the right
way. Print its contents and all that.

Troy Straszheim
Cofounder, CEO
Industrial Perception, Inc.

@stwirth
Copy link
Author

stwirth commented May 25, 2012

Thanks! I forgot to return ecto::OK. What is the right way to return from process() when the outputs are not touched? return ecto::BREAK, return ecto::CONTINUE? When I always return ecto::OK, the first N outputs of my Delay cell are None values which the subsequent cells (like Add) do not like. I thought process would not be called on cells whose inputs are not set.

@vrabaud
Copy link
Member

vrabaud commented May 25, 2012

Well, that makes sense but we usually just deal with that by stacking
things into member variables.
(cf
https://github.com/wg-perception/tod/blob/master/src/training/ModelStacker.cpp
)

If you feel like writing a cell, please ! Maybe it should take a vector or
N outputs ? (or list maybe to make it more efficient)

On Fri, May 25, 2012 at 6:57 AM, Stephan <
[email protected]

wrote:

In many applications some sensor input has to be buffered for further
processing, i.e. an algorithm needs not only the current but also N past
sensor values for processing. An example would be a median/mean/etc. filter
of a fixed width.
Is there some functionality in ecto for that? If not, I am willing to
write a cell that does that:
Input: any type
Params: number of values to buffer
Output: N outputs of same type as input, dependent on the number of values
given as param.
This cell would gather N inputs before writing anything to the output. The
output could be a vector as well, what do you suggest?


Reply to this email directly or view it on GitHub:
#204

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants