5 ms·
Also, singletons are great in robotics control software. It removes a lot of complexity if you have one singleton corresponding to one device.
by ryanthejuggler 12y ago
Also, singletons are great in robotics control software. It removes a lot of complexity if you have one singleton corresponding to one device.
- wnoise 12y agoWhat happens if you add a second camera? The actor/CSP model makes each device a separate process, which can be hooked together with processing nodes works wonderfully.
- meepmorp 12y ago> What happens if you add a second camera? You call it TheSecondCamera, duh.
- sp332 12y agoTheCameraArray[1]
- ryanthejuggler 12y agoIf there's the potential for multiples then I'll have a CameraManager (TheCameraManager) that finds out what's connected to the system and provides enumeration and access. I'll generally try to make the cameras look like a singleton and hide the Camera class. Sort of like a factory, except you'll only ever get N instances of your Camera class for N cameras.