Cam Design with V0.21 PartDesign and Assembly4 V0.12.4--Update#3 Tangent Spline Constraints

Show off your FreeCAD projects here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
ppemawm
Veteran
Posts: 1240
Joined: Fri May 17, 2013 3:54 pm
Location: New York NY USA

Cam Design with V0.21 PartDesign and Assembly4 V0.12.4--Update#3 Tangent Spline Constraints

Post by ppemawm »

In the past I have simulated cam and follower or lifter action in an assembly with an eccentric circle or an ellipse because each will accept tangent constraints. There is no solution for an arbitrary cam profile AFAIK except in this post https://forum.freecadweb.org/viewtopic. ... 82#p592082 which is only proper for a special case of a sufficiently wide flat faced follower. So, with my trusty engineering reference from university days entitled Theory of Machines by Joseph E. Shigley, 1961, I completed a study of how to design cams using FreeCAD's current capabilities.

The study included five different cam profiles and five types of followers all with the same follower rise-return-dwell profile as a function of the cam angle of rotation as shown in the following image. The cams were designed using Sketcher and PartDesign then assembled and animated with Assembly4. Variables and Expressions were used to calculate the follower lift positions and as assembly constraints.

These are the five cams and followers in the design study.  The followers or lifters, as they are known in the automotive world, include a knife edge, centered roller, flat-face, offset roller, and an oscillating lever.
These are the five cams and followers in the design study. The followers or lifters, as they are known in the automotive world, include a knife edge, centered roller, flat-face, offset roller, and an oscillating lever.
Screenshot 2022-10-25 101745.jpg (222.33 KiB) Viewed 4902 times
phpBB [video]

CAM_Design_1.0.FCStd
This video is taken from Assembly4 Save feature of its animator which allows you to easily create an .mp4 file as a function of the variables.
(504.24 KiB) Downloaded 83 times
My design study file is attached for reference. Please note that I experimented with different ways of creating B-splines as at the time I was not that familiar with them since they were rarely used in my previous projects. The B-splines are approximate since they are created by "eye" but well within normal manufacturing tolerances. When tangent constraints are finally available the splines will be more accurate and easier to apply with this method.

I will be describing the method used for each cam in additional posts for those interested in the detail.

Code: Select all

OS: Windows 10 Version 2009
Word size of FreeCAD: 64-bit
Version: 0.21.30492 (Git)
Build type: Release
Branch: master
Hash: b4578fb3eae842eb510a1bc055d07d369a67ce94
Python 3.10.6, Qt 5.15.4, Coin 4.0.0, Vtk 9.1.0, OCC 7.6.3
Locale: English/United States (en_US)
Installed mods: 
  * Assembly4 0.12.4
  * fasteners 0.4.15
  * freecad.gears 1.0.0
Last edited by ppemawm on Fri Jan 13, 2023 5:55 pm, edited 3 times in total.
"It is a poor workman who blames his tools..." ;)
User avatar
ppemawm
Veteran
Posts: 1240
Joined: Fri May 17, 2013 3:54 pm
Location: New York NY USA

Re: Cam Design with V0.21 PartDesign and Assembly4 V0.12.4--Knife Edge Follower

Post by ppemawm »

The first cam design is for a knife edge follower which is not very practical except for low speed use. But it serves as a simple example to develop the method since the cam profile is exactly the same as the follower profile as can be seen in the following images.

Cam design begins with a definition of the follower profile as a function of the cam rotational angle.  A typical one shown in the inset of this image is for a 3-4-5th polynomial which yields smooth velocity and acceleration characteristics to minimize noise and vibration.  The rise and return are symmetrical and the dwell is 90 deg in this example.  Beta is the duration of the rise.<br /><br />The polynomial is used to calculate the motion of the follower for specific angles of rotation which is then transferred to the layout sketch using Variables from the Assembly4 Model.<br /><br />The sketch provides the cam profile coordinates which can be used to generate a Draft B-Spline (through points) from which a pad can be made.
Cam design begins with a definition of the follower profile as a function of the cam rotational angle. A typical one shown in the inset of this image is for a 3-4-5th polynomial which yields smooth velocity and acceleration characteristics to minimize noise and vibration. The rise and return are symmetrical and the dwell is 90 deg in this example. Beta is the duration of the rise.

The polynomial is used to calculate the motion of the follower for specific angles of rotation which is then transferred to the layout sketch using Variables from the Assembly4 Model.

The sketch provides the cam profile coordinates which can be used to generate a Draft B-Spline (through points) from which a pad can be made.
Picture1.jpg (806.99 KiB) Viewed 4861 times
This sketch shows how the B-spline was generated using the cam coordinates.  The X and Y dimensions of the coordinates were obtained using the PartDesign (PD) Measure tools and then recorded in the table of coordinates for the spline.  The spline can be first created by eye using the visible first sketch and then corrected in the table format.<br /><br />The draft spline can be converted to a PD sketch for a pad.  In retrospect I should have created the spline for the full profile of rise and return since there is a slight discontinuity due to the mirror of the symmetric pad.
This sketch shows how the B-spline was generated using the cam coordinates. The X and Y dimensions of the coordinates were obtained using the PartDesign (PD) Measure tools and then recorded in the table of coordinates for the spline. The spline can be first created by eye using the visible first sketch and then corrected in the table format.

The draft spline can be converted to a PD sketch for a pad. In retrospect I should have created the spline for the full profile of rise and return since there is a slight discontinuity due to the mirror of the symmetric pad.
Screenshot 2022-10-25 105757.jpg (260.87 KiB) Viewed 4861 times
The Variables object from the Assembly4 workbench can be used for input, calculations, and constraints for the assembly and animation.  The cc_cam_angle is the primary variable for the animation.  The spline is not parametric so any changes in the input dimensions will require recreating the spline.
The Variables object from the Assembly4 workbench can be used for input, calculations, and constraints for the assembly and animation. The cc_cam_angle is the primary variable for the animation. The spline is not parametric so any changes in the input dimensions will require recreating the spline.
Screenshot 2022-10-25 111419.jpg (319.23 KiB) Viewed 4861 times
The position of the knife edge is defined by the g_lift variable which was calculated from the polynomial as a function of the cc_cam_angle.  This position is the Attachment Offset in Assembly4 as shown in the follower link property view.<br /><br />Conditional Expressions in the previous image are used to insure that the correct calculated profile is applied to the correct range of rotation angles.
The position of the knife edge is defined by the g_lift variable which was calculated from the polynomial as a function of the cc_cam_angle. This position is the Attachment Offset in Assembly4 as shown in the follower link property view.

Conditional Expressions in the previous image are used to insure that the correct calculated profile is applied to the correct range of rotation angles.
Screenshot 2022-10-25 110923.jpg (269.48 KiB) Viewed 4861 times
phpBB [video]


This video was created with the Assembly4 animator. Notice that the knife edge follows the 360 deg cam profile well within engineering tolerances.
Last edited by ppemawm on Wed Oct 26, 2022 6:02 pm, edited 1 time in total.
"It is a poor workman who blames his tools..." ;)
User avatar
jpg87
Posts: 809
Joined: Thu Mar 16, 2017 7:16 am
Location: Limoges - France
Contact:

Re: Cam Design with V0.21 PartDesign and Assembly4 V0.12.4

Post by jpg87 »

Wow super interesting!
Thank you for sharing this kind of study.
My website : http://help-freecad-jpg87.fr updated 2023/11/06
chrisb
Veteran
Posts: 53945
Joined: Tue Mar 17, 2015 9:14 am

Re: Cam Design with V0.21 PartDesign and Assembly4 V0.12.4

Post by chrisb »

Impressive - as always. Thanks for sharing.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
ppemawm
Veteran
Posts: 1240
Joined: Fri May 17, 2013 3:54 pm
Location: New York NY USA

Re: Cam Design with V0.21 PartDesign and Assembly4 V0.12.4--Centered Roller Follower

Post by ppemawm »

This next cam was designed for a centered roller follower. The method is the same but it turns out the cam profile is slightly different since the roller and cam have to be tangent at all times. This requires a different spline.

The method is to layout the follower at specific angular positions in the direction opposite the rotation of the cam.  The calculated rise/return are the same as the previous example but with allowance for the roller radius because the follower profile is to be the same.<br /><br />It is necessary to layout the positions a full 360 deg since the cam's rise and return profiles will be slightly different to maintain tangency with the roller.
The method is to layout the follower at specific angular positions in the direction opposite the rotation of the cam. The calculated rise/return are the same as the previous example but with allowance for the roller radius because the follower profile is to be the same.

It is necessary to layout the positions a full 360 deg since the cam's rise and return profiles will be slightly different to maintain tangency with the roller.
Screenshot 2022-10-25 134138.jpg (321.58 KiB) Viewed 4816 times
Using the visible layout sketch as a guide, create a PD spline that is coincident and tangent to the dwell arc vertices and tangent to each of the follower roller positions.  I used a knot for every angular position but I am not familiar enough with splines to know if this is sufficient or over-kill.<br /><br />Adjust the control points until the spline is tangent to each roller.  Zoom is your helper here in order to get sufficient accuracy.  It takes a bit of fiddling since each time you move a control point the shape of the curve is affected nearby.
Using the visible layout sketch as a guide, create a PD spline that is coincident and tangent to the dwell arc vertices and tangent to each of the follower roller positions. I used a knot for every angular position but I am not familiar enough with splines to know if this is sufficient or over-kill.

Adjust the control points until the spline is tangent to each roller. Zoom is your helper here in order to get sufficient accuracy. It takes a bit of fiddling since each time you move a control point the shape of the curve is affected nearby.
Screenshot 2022-10-25 134321.jpg (277.57 KiB) Viewed 4816 times
The g_lift variable takes into account the roller radius and it is applied to the roller Assembly Attachment Offset to release the degree of freedom in the Y-direction as a function of the cam angle.<br /><br />The roller angular velocity varies with the cam angle but I chose 6x as an average for demonstration purposes.  It is opposite direction to the cam rotation by multiplying by -1.
The g_lift variable takes into account the roller radius and it is applied to the roller Assembly Attachment Offset to release the degree of freedom in the Y-direction as a function of the cam angle.

The roller angular velocity varies with the cam angle but I chose 6x as an average for demonstration purposes. It is opposite direction to the cam rotation by multiplying by -1.
Screenshot 2022-10-25 134650.jpg (300.61 KiB) Viewed 4816 times
phpBB [video]
"It is a poor workman who blames his tools..." ;)
User avatar
ppemawm
Veteran
Posts: 1240
Joined: Fri May 17, 2013 3:54 pm
Location: New York NY USA

Re: Cam Design with V0.21 PartDesign and Assembly4 V0.12.4--Offset Roller Follower

Post by ppemawm »

If you have to offset the roller the layout sketch gets a little more complicated but still fairly straightforward if you follow the same method of sketching the follower at each angular position.

To account for the offset, add another circle with the offset radius.  The follower positions are tangent to this circle at each angular position as shown in the image.<br /><br />Add vertical edges at position 0 with lengths taken from the variable Y's.  Strike arcs from the cam centerline to intercept the tangents extended from the inner offset circle.
To account for the offset, add another circle with the offset radius. The follower positions are tangent to this circle at each angular position as shown in the image.

Add vertical edges at position 0 with lengths taken from the variable Y's. Strike arcs from the cam centerline to intercept the tangents extended from the inner offset circle.
Screenshot 2022-10-25 115922.jpg (351.74 KiB) Viewed 4796 times
Create the spline as in the previous example tangent to each roller position.  I used a shapebinder for guidance for some weird reason rather the layout sketch at the time.  Maybe I liked the color combination better.
Create the spline as in the previous example tangent to each roller position. I used a shapebinder for guidance for some weird reason rather the layout sketch at the time. Maybe I liked the color combination better.
Screenshot 2022-10-25 120657.jpg (269.88 KiB) Viewed 4796 times
The polynomial lift equation is the same as before but has to be adjusted for the vertical distance from the offset circle.  You can get this dimension from the layout sketch.
The polynomial lift equation is the same as before but has to be adjusted for the vertical distance from the offset circle. You can get this dimension from the layout sketch.
Screenshot 2022-10-25 121228.jpg (295.66 KiB) Viewed 4796 times
phpBB [video]
"It is a poor workman who blames his tools..." ;)
User avatar
ppemawm
Veteran
Posts: 1240
Joined: Fri May 17, 2013 3:54 pm
Location: New York NY USA

Re: Cam Design with V0.21 PartDesign and Assembly4 V0.12.4--Flat Faced Follower

Post by ppemawm »

The next example is for a flat faced follower. The same method may be used.

The polynomial rise/return radial  dimensions are laid in the same as in the first knife edge cam at each angular location as before.  For a flat face, however, construct perpendiculars to the radial lines at the calculated dimensions.  Make the perpendiculars long enough to intersect each other.  <br /><br />The actual dimension of the flat face will be determined after the cam is constructed and assembled with the follower.
The polynomial rise/return radial dimensions are laid in the same as in the first knife edge cam at each angular location as before. For a flat face, however, construct perpendiculars to the radial lines at the calculated dimensions. Make the perpendiculars long enough to intersect each other.

The actual dimension of the flat face will be determined after the cam is constructed and assembled with the follower.
Screenshot 2022-10-25 112304.jpg (370.71 KiB) Viewed 4785 times
Using the visible layout sketch as a guide, create a spline as in the other examples and adjust each knot until the spline is tangent to all of the perpendiculars.
Using the visible layout sketch as a guide, create a spline as in the other examples and adjust each knot until the spline is tangent to all of the perpendiculars.
Screenshot 2022-10-25 113437.jpg (277.83 KiB) Viewed 4785 times
If you step through the cam-angles you will be able to determine the minimum width of the flat face.  It may or may not be symmetrical about the cam axis depending upon the rise/return profiles.
If you step through the cam-angles you will be able to determine the minimum width of the flat face. It may or may not be symmetrical about the cam axis depending upon the rise/return profiles.
Screenshot 2022-10-25 114019.jpg (327.42 KiB) Viewed 4785 times
phpBB [video]

.
Note how the cam contact slides back and forth across the face of the follower. The follower needs to be wide enough to not ride on its edges.
"It is a poor workman who blames his tools..." ;)
User avatar
ppemawm
Veteran
Posts: 1240
Joined: Fri May 17, 2013 3:54 pm
Location: New York NY USA

Re: Cam Design with V0.21 PartDesign and Assembly4 V0.12.4--Oscillating Follower

Post by ppemawm »

Yes, you guessed it. You can use the same method but by now it should be a lot easier.

The layout sketch is constructed in a similar manner as before but you have to add a circle that passes through the pivot point of the follower lever.  You can use a regular polygon to conveniently divide the circle into angular positions as shown in the image.<br /><br />Add edges around the outer circle equal in length to the lever which intercept the arcs struck from the vertical lift dimensions at its corresponding angular locations.  Add circles at each intersection representing the end of the lever that contacts the cam.<br /><br />The circles serve as a guide for the spline tangents shown in the next image.
The layout sketch is constructed in a similar manner as before but you have to add a circle that passes through the pivot point of the follower lever. You can use a regular polygon to conveniently divide the circle into angular positions as shown in the image.

Add edges around the outer circle equal in length to the lever which intercept the arcs struck from the vertical lift dimensions at its corresponding angular locations. Add circles at each intersection representing the end of the lever that contacts the cam.

The circles serve as a guide for the spline tangents shown in the next image.
Screenshot 2022-10-25 135123.jpg (369.06 KiB) Viewed 4763 times
The spline procedure is left to the student.
The spline procedure is left to the student.
Screenshot 2022-10-25 135312.jpg (279.46 KiB) Viewed 4763 times
In order to assemble the lever to its pivot anchor it is necessary to release another degree of freedom so that it can rotate about the pivot.  You can do this in Assembly4 with the sketch solver by creating a sketch as shown in the image.  The sketch locates the fixed pin joint or lever pivot in the assembly and constrains the path of the follower.<br /><br />The variable in this sketch is the calculated follower lift.  Attach the LCS to the edge representing the lever centerline with tangent to edge mode at the pivot point.<br /><br />Assemble the lever to the parent assembly to the LCS created above.  As the lift changes with cam rotation the lever will rotate about its pivot and the follower will trace an arc fixed by the length of the lever.
In order to assemble the lever to its pivot anchor it is necessary to release another degree of freedom so that it can rotate about the pivot. You can do this in Assembly4 with the sketch solver by creating a sketch as shown in the image. The sketch locates the fixed pin joint or lever pivot in the assembly and constrains the path of the follower.

The variable in this sketch is the calculated follower lift. Attach the LCS to the edge representing the lever centerline with tangent to edge mode at the pivot point.

Assemble the lever to the parent assembly to the LCS created above. As the lift changes with cam rotation the lever will rotate about its pivot and the follower will trace an arc fixed by the length of the lever.
Screenshot 2022-10-25 141147.jpg (323.27 KiB) Viewed 4763 times
phpBB [video]
Cam profile design is dependent upon the follower design as the examples in this study reveal even though the follower rise/return profile are the same.  This image is an overlay of each cam's spline for comparison.
Cam profile design is dependent upon the follower design as the examples in this study reveal even though the follower rise/return profile are the same. This image is an overlay of each cam's spline for comparison.
Screenshot 2022-10-25 143046.jpg (275.71 KiB) Viewed 4763 times
The method used in this study has been around since at least the 1950's where cams were developed on the drafting board. Sketcher takes the drudgery away and leaves no erasure debris or fingerprint smudges to spoil the drawing.

Another excellent reference for more sophisticated lift profiles developed analytically may be found int Cams: Design, Dynamics, and Accuracy by Harold A. Rothbart dated 1956. You will also find design rules to limit vibration and wear for higher speed cams such as that used in high performance IC engines.
"It is a poor workman who blames his tools..." ;)
User avatar
jnxd
Posts: 951
Joined: Mon Mar 30, 2015 2:30 pm
Contact:

Re: Cam Design with V0.21 PartDesign and Assembly4 V0.12.4--Flat Faced Follower

Post by jnxd »

Hello @ppemawm. This was some amazing explanation. However, I believe my recent work on B-splines constraints would make your life a little easier. In fact, I was considering making cam design an example of its usage, but I guess you beat me to it.

The features are not yet merged in master, but you can get the build from here if you want. Would you be interested in testing this with your current work?

The knife-edge follower can be done within Sketcher itself now by directly constraining the distance from knots to the centre.
ppemawm wrote: Wed Oct 26, 2022 7:26 pm ...
Using the visible layout sketch as a guide, create a spline as in the other examples and adjust each knot until the spline is tangent to all of the perpendiculars.
...
Tangency at knots is also supported, so you don't have to do this again.
My latest (or last) project: B-spline Construction Project.
User avatar
ppemawm
Veteran
Posts: 1240
Joined: Fri May 17, 2013 3:54 pm
Location: New York NY USA

Re: Cam Design with V0.21 PartDesign and Assembly4 V0.12.4

Post by ppemawm »

Thank you for the kind comments/
jnxd wrote: Wed Oct 26, 2022 8:46 pm However, I believe my recent work on B-splines constraints would make your life a little easier.
Yes indeed. I have been following your progress with abated breath. Spline tangent and knot constraints are ideal for this kind of application.
jnxd wrote: Wed Oct 26, 2022 8:46 pm Would you be interested in testing this with your current work?
I will as soon as it is available. Or, feel free to adapt my file using the new spline tools.

Thanks for all your efforts.
"It is a poor workman who blames his tools..." ;)
Post Reply