If your controller does not need to run in hard realtime, you can use ROS topics to communicate between the controller and the hardware nodes. This means your hardware will have to expose a topic-based API, and the controller will receive messages from sensors, and send messages to actuators. If you care about speed and performance, nodelets are a good option because they eliminate the serialize/deserialize steps in the ROS communication. For most people, running the non-hard-realtime communication over ROS is good enough.
If your controller needs to run in hard realtime, things are much more complicated. First of all you'll need a hard realtime operating system (e.g. Xenomai patch on the Linux kernel). Then, since ROS communication is not realtime safe, you can't use any ROS topics, services, etc in hard realtime. For PR2-like torque controlled arms this problem is solved by the PR2 controller manager, which creates a limited environment where you can run multiple realtime controllers, without using ROS for communication. To control other types of hardware, you'll need to either write your own version of the PR2 mechanism control, or use a framework that supports hard realtime communication (e.g. RTT). I'd strongly recommend the latter if you really care about hard realtime.