Globoidal CAM in OpenSCAD

I am trying to make a parametric Globoidal CAM model in OpenSCAD but I've become a little stick on how to make it. My initial idea was to make a profile of the turret (Output wheel), extrude / twist it to make a model which represents the path of the turret, then difference this from a cylinder to make the cam.

What you are describing would be called a sweep in SolidWorks, and maybe other systems. However, if you are planning to do this with a 2d profile, it won't work. Modeling cams is a subject that turns up from time to time in CAD forums because sweeping the 2d profile will not result in the same shape the end mill or your cam follower will follow.

What you need to do is create a multitude of copies of your cam follower, each twisted appropriately for its position. Difference those copies from your cam. Solidworks has a function for the kind of feature you are trying to make ("solid sweep"), and what I have described is how the function basically works under the hood.