Starting a node in code which is not part of a package
I would like to write code for a class which includes a function which calls ros::init to start a ros process. Is it possible to do this in code which is not contained in a package?
My class works with sensor data and I would like it to be possible to read data from in a variety of methods depending on which function is chosen. For example, there may be a function which employs the sensor driver API and reads via network connection, or else there may be a function which is a wrapper to an external library which provides data read from the sensor in a different way.
I would like to give a function the ability to get data from ROS by starting a node which contains a subscriber to the appropriate sensor topic. However, since I do not want the class to be part of a ROS package (so that it is portable) I am wondering if it is possible to do do this?
I imagine that in operation, the function will have to be able to attempt to start the process using ros::init, but may fail if no master process actually exists at that time. Is this idea possible?