Re: [ros-users] sensor_msgs Low Cost/Android review

Forside
Vedhæftede filer:
Indlæg som e-mail
+ (text/plain)
+ (text/html)
Slet denne besked
Besvar denne besked
Skribent: User discussions
Dato:  
Til: User discussions
Emne: Re: [ros-users] sensor_msgs Low Cost/Android review
C++ is also strongly typed but there are ways to support various
datastructures.

An example of exactly what you're talking about can be seen in the
MeanFilter in the filters package.
http://www.ros.org/doc/api/filters/html/mean_8h_source.html It can take the
mean of any datatype which defines the standard arithmatic operators += and
/=.

Probably the best way to solve the exact problem you're running into is to
write a plugin for the plotter to be able to do the arithmetic before
rendering as the plotting tool has already isolated just the value.

Tully


On Tue, Nov 13, 2012 at 3:46 PM, Brian Gerkey <>wrote:

> On Tue, Nov 13, 2012 at 2:55 PM, Edwards, Shaun M. <>
> wrote:
> > I understand why you would want messages to have semantic meaning, but I
> > think the thin node wrapper method is problematic from a coding and
> > usability standpoint. From a coding standpoint, each wrapper node would
> be
> > a near copy and paste. This is almost universally bad coding practice.
> > From a usability standpoint, it would require someone to code *something*
> > anytime they wanted to take an average of a reading. I had a recent
> > application where I wanted to plot averages and current readings at the
> same
> > time to determine options for reducing noise. I’d hate to have to
> program a
> > special node every time I wanted to perform the experiment.
> >
> > Perhaps there is a way (probably in python) to use some message
> > introspection to achieve a generic node. The node could simply look for
> > int/real types and then perform the filtering automatically. Perhaps a
> > parameter list could be used to specify the message members (as strings)
> > that should be filtered, intead. Such an approach may also work with
> > messages of multiple members (I’m thinking pose). What do you think?
>
> Attached is a simple rospy script that uses some of rostopic. It can
> subscribe to any topic that contains a field called 'data' that Python
> can do arithmetic with, and can handle mixing types. It'll do a naive
> moving-window average on the received values and publish the result as
> a std_msgs/Float64.
>
> To try it, start some publishers:
>
> rostopic pub -r 10 in1 std_msgs/Float64 1.0 &
> rostopic pub -r 10 in2 std_msgs/Float32 2.0 &
> rostopic pub -r 10 in3 std_msgs/Int64 42 &
>
> Then start the averager:
>
> python avg.py
>
> That's just a quick and dirty demo; lots more can be done in that
> direction.
>
>     brian.

>
> _______________________________________________
> ros-users mailing list
>
> https://code.ros.org/mailman/listinfo/ros-users
>
>



--
Tully Foote

(650) 475-2827