I have a ROS node written in Python that captures messages and writes them to disk (e.g. using pickle
). I want to use these files later, in another Python script, outside of ROS, but I need to import the message classes.
Is that possible?
Thanks!
Unfortunately I don't think it's possible to just import the message files outside of any ROS dependencies. For example, if you look inside one of the generated message class files:
---/your_catkin_ws/devel/lib/python2.7/dist-packages/your_package/msg/_Message.py
You will see that it depends at least on genpy and other message types contained in your message. Base messages are the same (in /opt/ros/indigo/lib/python2.7/dist-packages/std_msgs/msg
).
While you could try to copy the minimum amount of dependencies until It Finally Works(!), it's a little un-elegant and probably going to be a brittle solution.
I believe the best solution is to convert your message to a generic non-ROS type, then store it in your pickle (so essentially what you've been doing already).