This has been asked for C++ (http://answers.ros.org/question/9562/how-do-i-test-the-ros-version-in-c-code/) but it would be good to know what the correct way to do this is in Python.
There is a python script called rosversion which does this in a bit of an awkward way IMO. It does it by checking whether the "ROS_DISTRO" environment variable exists and, if not, it parses an XML file (roscore.xml). This seems quite complicated and it only gives you the release name (cturtle, electric, fuerte, etc.).
Is there a way to get access to those nice looking DEFINES like in the C++ code? Even having just the functionality of the rosversion script somewhere in an official ROS Python API function would be better than nothing (just getting the release name).
Originally posted by StFS on ROS Answers with karma: 182 on 2012-06-13
Post score: 3