We are in the process of integrating a tool for evaluating temporal logical formulas over the content of topics. The idea is that you write formulas such as "always f -> g" and the tool subscribes to the topics f and g, synchronizes these into states (f,g), and then evaluates the formula over this stream of states. The problem we are facing is how to create and use states consisting of an arbitrary number of variables whose types are not known at compile time. Ideally we would like to create states by taking an arbitrary number of topic names, synchronize them and publish the resulting states as a new topic. The formula evaluation node would then subscribe to this topic and iterate over the variables in each state to update its internal symbol table. We have previously implemented this in CORBA where we can use either an Any or a union of all the desired types to represent the value of a variable and a sequence of this type to represent states. How would the same thing be done in ROS, preferably in C++? Some approach vectors we have been contemplating are: 1. Use template magic. We could define templates and instantiate these for every possible combination of types we support. Cumbersome and doesn't scale. 2. Since almost all types are either bool, int or float we could represent every value with a float. This would probably be an acceptable solution if none of the topics contain structured values. However, we would like to write "pos.x > 5" in our formulas which should subscribe to the topic "pos" and extract the field "x" from it. This could potentially be solved by treating "pos.x" as a value of type float and generating the appropriate template code for extracting the value. However, we would then have to subscribe to (and synchronize) "pos" twice if we have a formula "pos.x > pos.y". 3. Create a new general message type which can represent any State in a flat structure. For example: message StateValue string type string name string value message State StateValue[] values For each type T create a function State flatten(string name, T value) which flattens the type into a sequence of state values. For example, assume we have a type Pos consisting of two floats x and y then the function should return [("float", name + ".x", value.x), ("float", name + ".y", value.y)]. This function can be generated from .msg-files or maybe even from XMLRPC directly. Create a method which takes a topic name, subscribes to it, flattens the output and publishes the flattened result: flatten_topic(string topic_name). This can probably be implemented using either a switch case over the topic type or looking at the XMLRPC directly. Create a synchronizer which takes a sequence of topic names as input, synchronizes all of them and provides the output as a single topic containing the flattened State of all the individual topics. This can be implemented in many different ways for example by using flatten_topic and the existing synchronizer. This approach should work and be rather general at least if the flatten function and flatten_topic are generated automatically. Any comments on the problem, our three approaches or alternative ways of solving the problem in ROS would be appreciated. Thank you! /Fredrik Heintz and Anders Hongslo, Linköping University, Sweden