A similar but more complete example is detailed in the ROSCON 2014 talk entitled ROS control: an overview (program with slides and video). Here you can see how the main function initializes a ros node, which you can then launch via rosrun/roslauch. Let us know if you still have questions along these lines.