Вы находитесь на странице: 1из 16

# http://sharptechdesign.com/Tutorials/Mechanism_WF2/MDX_WF2_Less...

Lesson

Lesson Objective: In this lesson, we will look at some advanced servo motor functions, such as
table-driven motors.

Before we talk about some more of the advanced servo motor functions, we’ll take a moment to recap the
basics that we have learned about already. The first thing you have to decide when you are creating a

1 of 16 05-Apr-11 8:56 PM
http://sharptechdesign.com/Tutorials/Mechanism_WF2/MDX_WF2_Less...

servo motor (besides the name and the joint being used) is whether you are driving the motor based off of
position references, velocity or acceleration.

## Position Servo Motors

When defining position servo motors, you do not want to use Constant for the magnitude, otherwise, the
motor won’t do anything. The most commonly used magnitude for performing basic motion, such as opening
and closing the lid of an assembly, is to use the Ramp option.

When you use Ramp, you are defining a slope that determines magnitude over time. Therefore, if you are
trying to open a lid 90 degrees in 10 seconds, you would have values of A=0 and B=9 (90/10).

The key is to identify the starting value for magnitude and whether you are going in a positive direction or
negative. If you recall from the example where we created two servo motors to open and close a lid, the
first servo motor was starting from 0 degrees and going to -90 degrees over a 5 second time.

Therefore, our values were A=0 (starting position) and B=-18 (slope = -90/5). The second motor was
starting at -90 degrees and going in a positive direction back to 0 degrees over another 5 second time
interval. Therefore, its values were A=-90 (starting position) and B=18 (slope = 90/5).

The value for the slope is the total distance traveled divided by the total time you are trying to do it in.
Therefore, to go -120 degrees in 4 seconds, starting from 0 degrees, your “A” value would be 0, and your
slope would be -120/4 = -30.

## Multiple Servo Motors for Single Constraint

If you also recall from the same example of the lid and base assembly, we had to place a small time gap in
between the end time of the first servo motor, and the start of the second servo motor. The analysis motors
portion looked like the following:

## Servo Motor Start Time (sec) End Time (sec)

Open_Lid Start 5
Close_Lid 5.0001 End

The reason is because we placed two servo motors back-to-back in the time sequence that were affecting
the same pin constraint. We can overlap servo motors as long as they are not on the same constraint
(which also means we can do back-to-back with no time gap, as long as they are not on the same
constraint).

If we had a 15 second animation for this lid where the first servo motor opened the lid in 5 seconds, and
then the lid stayed open for 5 seconds, and then finally closed using the second servo motor the last 5
seconds, then we could have set our analysis motors using the following convention.

## Servo Motor Start Time (sec) End Time (sec)

Open_Lid Start 5
Close_Lid 10 End
Rotating Parts with Position Servo Motors

When you are trying to simulate a rotating part, such as the blades on our fan assembly, you have to decide
two things when setting up the servo motor.

The first is, “How long do you want your animation to be?” The second is, “How many times do you want
the object to go around in this time frame?”

If you are just going to perform a playback to view the results, you may only want it to go around one full
revolution (360 degrees) in the total animation time. If you plan on creating an MPEG movie of your
animation, you may want it to go around several times to get the idea across to your audience.

2 of 16 05-Apr-11 8:56 PM
http://sharptechdesign.com/Tutorials/Mechanism_WF2/MDX_WF2_Less...

The trade-off will be related to the number of frames in the animation you want to use. If you recall the
example where we created a motor to run at 1200 RPM, you needed to use a larger frame count to capture
different positions as it went around. Therefore, the more times you want it to go around, the larger the
frame count, and the longer the animation time will be.

To demonstrate this concept, we will go back to the Zero_Refs.asm assembly. Open up this assembly, go
to a default view, and enter into Mechanism Mode. Your assembly will look like the following.

Delete any existing Analyses and Servo Motors you may have in the model. We are now ready to discuss
table-driven servo motors.

We are going to re-create the motion of opening and closing this lid over a 10 second time frame, but we
are going to do this with one servo motor. You might be saying to yourself: “Hold on a minute. Earlier, you
told us that we can not reverse the direction (magnitude) of the servo motor in a single motor!” You are
correct. In the way that we have been developing servo motors using Ramp, you can not change the
direction of the magnitude with a single motor.

The same is not true with a Table servo motor. Go to your servo motor tool and create a new servo motor
called Lid_Motion. Select the existing pin constraint to use for the servo motor.

On the Profile tab, we are going to select Position and then use the Magnitude pull-down to select Table.
Our window should currently look like the following.

3 of 16 05-Apr-11 8:56 PM
http://sharptechdesign.com/Tutorials/Mechanism_WF2/MDX_WF2_Less...

Out in the middle of the window, there are two icons. The top one ( ) is used to add rows to our table.
The second one is used to delete selected rows from the table. We will add 5 rows to the table, therefore,
click on the Add Row icon 5 times. Your window will now look like the following.

When entering the values in the table, you must think of it in absolute terms. Therefore, we know that at
Time=0, we will be at 0 degrees. At Time=2.5 seconds, we will be at -45 degrees. At Time=5 seconds
(halfway into our animation), the magnitude should be -90 degrees. As it gets to Time=7.5 seconds, we are
closing the lid, so our position should be -45 degrees again, and finally at Time=10 seconds (the end of the
animation), the lid is closed again at a magnitude of 0 degrees.

This is exactly how we will enter this data into the rows, as shown below.

4 of 16 05-Apr-11 8:56 PM
http://sharptechdesign.com/Tutorials/Mechanism_WF2/MDX_WF2_Less...

Just below the table, we have some options for importing or exporting table data into this window without
having to type it.

Just below that, we have some Interpolation options. Linear Fit produces a line graph between the points
we entered, therefore, if we graph magnitude versus time (Position) for our table data, we would see the
following figure.

Even though we are not able to graph velocity versus time for the Linear Fit option, we can assume that the
velocity will be constant as it opens, and equal (but negative) when closing.

5 of 16 05-Apr-11 8:56 PM
http://sharptechdesign.com/Tutorials/Mechanism_WF2/MDX_WF2_Less...

If we were to select the Spline Fit, option, it graphs a spline through the points, making a different Position
graph, as shown below.

For the Spline Fit option, we can graph velocity as a function of time, and we can see what it is doing,
based on the next figure.

This will cause the motor to speed up and slow down over the entire range of motion. For our first analysis,
we will select the Linear Fit option and then click on OK to finish defining this servo motor. Close out of the
servo motors window.

Go to the analysis tool, and create a new analysis, called Lid_Animation. Change the starting configuration

6 of 16 05-Apr-11 8:56 PM
http://sharptechdesign.com/Tutorials/Mechanism_WF2/MDX_WF2_Less...

## to use the Closed snapshot, as shown below.

We will leave the timing and frame options in their default values. Click on Run to view this analysis. The lid
should open and then close using a constant velocity. Click on OK to finish out of the definition of this
analysis, followed by Close to get out of the Analyses window.

Go to the playback tool and create an MPEG movie called Lid_Linear.mpg. Now, go back and edit the
servo motor that we just created and change the option from Linear Fit to Spline Fit. Click on OK to finish
this, followed by Close. Then, go back and re-run the analysis (you will click on Yes to overwrite the
existing results file).

Go to the playback tool and create another MPEG movie called Lid_Spline.mpg. Play both movies from
your working directory. Notice any difference? There isn’t one. This is because it is always assuming a
smooth fit when it runs the analysis, and the spline fit option actually is more realistic for what it is doing.

Save and close this assembly without saving the results file. If you would like to see a side-by-side
comparison of these two options, play the Lid_Comparison.mpg file located in your training directory.

There are additional magnitude settings to choose from. So far, we have learned about Constant (for
Velocity or Acceleration profiles only), Ramp and Table. The others are outlined below, but only the Cosine
function will be demonstrated, as it somewhat relates to similar analyses that we have performed.

## Magnitude Description Required Settings

Type
Cosine Use if you want to assign a cosine wave value to the motor q = A*cos(360*x/T + B) + C
profile.
A = Amplitude
B = Phase
C = Offset
T = Period

7 of 16 05-Apr-11 8:56 PM
http://sharptechdesign.com/Tutorials/Mechanism_WF2/MDX_WF2_Less...

SCCA Sine-Constant-Cosine-Acceleration – Use to simulate a cam See Next Section entitled SCCA
profile output. Can only be used with Acceleration profile
and Servo Motors (not Force Motors).
Cycloidal Use to simulate a cam profile output. q = L*x/T – L*sin(2*pi*x/T)/2*Pi

L = Total Rise
T = Period
Parabolic Can be used to simulate a trajectory for a motor q = A*x + 1/2*B(x2)

A = Linear Coefficient
Polynomial Use for generic motor profiles 2 3
Q = A + B*x + C*x + D*x

## A = Constant term coefficient

B = Linear term coefficient
D = Cubic term coefficient
User Defined Use to specify any kind of complex profile defined by See Section entitled User Defined
multiple expression segments

Cosine

We are going to demonstrate the cosine servo motor magnitude by going back to the Frame_Rate.asm
assembly.

Open up this assembly, go to Mechanism Mode and delete any analyses and servo motors that exist. Then,
create a new servo motor called Cosine. For the profile, select Position and Cosine from the available
fields.

We are going to enter values for the different options based on making the arrow start at 0 degrees, travel
an entire 180 degrees clockwise and then back to 0. Therefore, we will enter the following values: A=90
degrees, B=0, C=-90 (to start at 0) and T=10 seconds, as shown below.

Click on the graph icon to see how this will affect our position, as shown in the next figure.

8 of 16 05-Apr-11 8:56 PM
http://sharptechdesign.com/Tutorials/Mechanism_WF2/MDX_WF2_Less...

We can see that we will start at zero degrees at Time=0. We will then travel -180 degrees (clockwise
direction) and then come back to 0 at Time=10. Click on OK, followed by Close and then go to the analysis
tool.

Create a new analysis called Arrow_Cosine, and start the analysis at the Starting_Position snapshot.
Leave all other fields in their default values, as shown below.

Run this analysis, and you will see that it goes through the entire 180 degree motion clockwise before
returning back to the zero degree mark. You could use this Magnitude option to open and close the lid with
one servo motor, instead of using a table-driven motor.

To see the result of this analysis, open up the Arrow_Cosine.mpg movie in your training folder.

Save and close this assembly without saving the results file.

9 of 16 05-Apr-11 8:56 PM
http://sharptechdesign.com/Tutorials/Mechanism_WF2/MDX_WF2_Less...

This is a separate topic, only because there was not enough room in the previous table to define the
constants and equations for this type of Magnitude. As mentioned before, this type of motion profile is only
available for the Acceleration option with Servo Motors.

## · A = Fraction of normalized time for increasing acceleration

· B = Fraction of normalized time for constant acceleration
· C = Fraction of normalized time for decreasing acceleration

Where:

A+ B+ C= 1

## The values of A and B must be entered, as well as the following.

· H = Amplitude
· T = Period

The overall value for SCCA is calculated based on the conditions shown in the following table.

## for 0 <= t < A y= H*sin[(t*pi)/(2*A)]

for a <= t < (A + B) y= H
for (A + B) <= t < (A + B + 2*C) y= H*cos[(t – A – B)*pi/(2*C)]
for (A + B + 2*C) <= t < (A + 2*B + 2*C) y= -H
for (A + 2*B + 2*C) <= t <= 2*(A + B + C) y= -H*cos[(t – A – 2*B – 2*C)*pi/(2*A)]

t = t_a * 2/T

Where:

## · t_a = Actual Time

· T = Period of the SCCA profile

A User Defined function enables you to specify Magnitude as a set of expressions and domain constraints.
These expressions are a function of time. When you enter into this Magnitude you can add rows (just like
we did for the Table option), where you can enter expressions as a function of t (NOTE: “t” must be in
lowercase).

There are two types of rows you can create, Expressions and Domains. For “Expressions”, a default
expression as a function of t appears and you can edit it. For “Domains”, you enter time domains. For
example, to enter a time range from Time=0 to Time=5, you would type:

0<t<5

There are other options to this Magnitude, and it is outlined well in the online help system.

EXAMPLE: Suppose you want to create a servo motor that starts an object off at 0 degrees at Time=0.
Between Time=0 and Time=5, we want to rotate the object 90 degrees. Then, it holds at 90 degrees for
another 5 seconds. At T=10 seconds, the object starts to rotate back to the starting position, and ends up
at 0 degrees at T=15 seconds.

10 of 16 05-Apr-11 8:56 PM
http://sharptechdesign.com/Tutorials/Mechanism_WF2/MDX_WF2_Less...

If we try to do this with a Table-Driven motor, we might have the following servo motor definition.

## Plotting a Linear Fit graph gives us the following.

This looks okay, but what does the Spline Fit graph look like? The following figure shows us.

11 of 16 05-Apr-11 8:56 PM
http://sharptechdesign.com/Tutorials/Mechanism_WF2/MDX_WF2_Less...

From this graph, we can see that it never really stops for 5 seconds, instead it just gradually approaches the
top of the graph. The other thing we notice is that it goes well beyond 90 degrees. It has to do this to
make a smooth curve (spline).

If you remember from our example with the lid, we saw no difference between the animations created by
the linear fit and spline fit options. Therefore, we will need to alter our table to include more points. We
might add intermediate points between our original values, and our servo motor profile now looks like the
following.

The Spline Fit graph for this table now looks like the following.

12 of 16 05-Apr-11 8:56 PM
http://sharptechdesign.com/Tutorials/Mechanism_WF2/MDX_WF2_Less...

This graph looks better, but it is still exceeding 90 degrees and not holding steady at 90 degrees for the 5
second in the middle of our animation. We can continue to add more points, but it will be easier to make a
User-Defined profile.

Therefore, we change the option from Table to User Defined, and add three rows. In the Domain column,
we enter the three time domains as follows.

## Domain 1: 0 <= t < 5 (time goes from 0 (including zero) to 4.99999999999999)

Domain 2: 5 <= t <= 10 (time goes from 5 to 10 (including 5 and 10))
Domain 3: 10 < t <= 15 (time goes from 10.00000000000000001 to 15 (including 15))

As you start to type, your “t” may appear as a “T” (uppercase). If you accept this, Pro/E will give you a
warning about a bad expression. You must make sure that the “t” is lowercase.

## Our window will currently look like the following:

In the Expressions column, we need to write three functions to describe what is happening in these
different time domains.

Domain 1:

In this domain, time is going from 0 to 5 (approximately), and it covers a range of 90 degrees. Therefore
the slope of this function is 18. Our equation y = 18t + b is what we will use to determine the function for y

13 of 16 05-Apr-11 8:56 PM
http://sharptechdesign.com/Tutorials/Mechanism_WF2/MDX_WF2_Less...

(magnitude). At t=0, y=0. At t=1, y=18. At t=2, y=36. At t=5, y=90. Therefore, b=0, based on these
observations.

## This leaves us with the following expression for y:

Y = 18 * t

Therefore, the expression that we will enter in this first row is 18*t. If you want to enter into an Expression
Definition Wizard, pick on the little icon on the right side of the window that looks like a pencil writing on
paper. It will bring up the following window.

We can already see the “t” in the field, just add “18*” in front of it, or click on the icons at the top for
additional assistance. NOTE: You can also define your time domains here as well.

Domain 2:

In this domain, we are holding at 90 degrees. Therefore, the slope(m) is 0. Our expression Y = mt + b
therefore becomes just Y=b. Therefore, we will enter 90 for the expression field for this row.

Domain 3:

In this domain, we are starting from 90 degrees and going back to 0. The problem with this one is that we
are starting from t=10 and ending at t=15. We know that the slope(m) is -18, so we can solve for b by the
following:

At t=10, y=90

90 = -18(10) + b
90 = -180 + b
270 = b

Therefore, our expression for this domain is y = -18 * t + 270. In the field provided, we will enter -18*t +
270.

Our servo motor window would now look like the following.

14 of 16 05-Apr-11 8:56 PM
http://sharptechdesign.com/Tutorials/Mechanism_WF2/MDX_WF2_Less...

We can only create one graph type, and it will look like the next figure.

This looks exactly like our first Linear Fit graph, but it is accurate to what the analysis will follow.

There are several different ways to approach the same problem using the different Magnitude options. We
learned about the Table and Cosine approach in this lesson as an alternative to Ramp when trying to
create a motion that will change magnitude in the middle of its animation.

Try using a User Defined profile if you must hold for a certain length of time. Just be aware that everything
is based on the current time value (t).

15 of 16 05-Apr-11 8:56 PM
http://sharptechdesign.com/Tutorials/Mechanism_WF2/MDX_WF2_Less...

We are going to create an animation for the Robot assembly called Robot_Motion that will start the robot
when all joint axes are at their zero values, and then follow the convention laid out in the following table.

Use the next figure as a reference to know which joints we are referring to.

## Joint Magnitude Range Time Frame (seconds)

1 0º to -45º Start to 5
2 0º to -90º 5 to 10
3 0º to 90º 5 to 10
4 0º to -90º 5 to 10
5 0º to 90º 10 to 15
6 0º to 720º 15 to 25
1 -45º to 0º 25 to 30
2 -90º to 0º 25 to 30
3 90º to 0º 25 to 30
4 -90º to 0º 25 to 30
5 90º to 0º 25 to 30

Once you are done, save an MPEG movie (in the actual time of 30 seconds) called Robot_Motion.mpg.

NOTE: You can use whatever Magnitude option you want to try to achieve this result.

Save and close your assembly once you are completely done.

16 of 16 05-Apr-11 8:56 PM