C++ is also strongly typed but there are ways to support various datastructures.  <div><br></div><div>An example of exactly what you're talking about can be seen in the MeanFilter in the filters package.  <a href="http://www.ros.org/doc/api/filters/html/mean_8h_source.html" target="_blank">http://www.ros.org/doc/api/filters/html/mean_8h_source.html</a> It can take the mean of any datatype which defines the standard arithmatic operators += and /=. <br>

</div><div><br></div><div>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.  </div>

<div><br></div><div>Tully</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Nov 13, 2012 at 3:46 PM, Brian Gerkey <span dir="ltr"><<a href="mailto:gerkey@osrfoundation.org" target="_blank">gerkey@osrfoundation.org</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Tue, Nov 13, 2012 at 2:55 PM, Edwards, Shaun M. <<a href="mailto:sedwards@swri.org">sedwards@swri.org</a>> wrote:<br>


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