Last active
December 11, 2019 13:54
-
-
Save linknum23/cc04d6c91bc3001a1485e1ef0fa60aac to your computer and use it in GitHub Desktop.
Roslaunch combine dictionary lookups from list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<launch> | |
<!-- List of things to lookup in dict, in our case sensors --> | |
<arg name="sensors" value="s1,s2" /> | |
<!-- Actual python dictionary. In our case this maps sensors to topics --> | |
<arg name="sensor_topics" value="{ | |
's1':'t1', | |
's2':'t2', | |
's3':'t3' | |
}" /> | |
<!-- Make a space seperated string of the lookups (topics) from the sensor list --> | |
<!-- This should set tout to 't1 t2' --> | |
<!-- NOTE: map() is used instead of list comprehensions because roslaunch fails to parse them --> | |
<!-- NOTE: the sensors and sensor_topics args are mapped in automagically so args('sensors') is not neeeded --> | |
<param name="tout" value="$(eval ' '.join(map(eval(sensor_topics).get, sensors.split(','))))" /> | |
</launch> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment