Motion Control and Motor Drives

cancel
Showing results for 
Search instead for 
Did you mean: 

Blend functions fail for three simple trapezoidal profiles

Solved!
Go to solution

I'm attempting to learn to use the NI Motion Assistant LabVIEW functions to create my own profiles, but I'm struggling to get Blending to work.

 

In the attached VI I take three simple trapezoidal profiles and attempt to blend them. The code is based on the provided example "Blended move.vi" which blends two profiles together.


As you can see, the three trapezoidal profiles are individually fine (white, red, green), but when passed into the blending functions there's a sudden backstep in the time value during the second profile, causing a terrible problem in the blended profile. I can't seem to prevent this from occuring.

 

I'm using LabVIEW 2012 with the latest NI SoftMotion Premium 2012 and NI Motion Assistant 2.8.

 

Is this a bug?

 

blend_fail.png

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 1 of 12
(8,694 Views)
Solution
Accepted by topic author Thoric

Hi Thoric,

 

National Instruments motion control is so advanced that stepping back in time is no big deal. I hope you enjoy the feature.

 

In all seriousness, though, this is a bug and, depending on your end goal, may have a suitable workaround.

 

Goal #1: You want to perform an online blended move with NI motion. If this is the case, you can construct your blended move in the Motion Assistant environment (which can handle 3 blended moves) and then generate LabVIEW code once you have the trajectory you want. This will generate NI-Motion code for the 3 (or more) blended moves. You will not get an array of velocities, positions, and accelerations, but you will be able to send the proper commands to the NI Motion board and it will use the trajectory you specified.

 

Goal #2: You want the arrays of velocities, positions, and accelerations. If you only care about the actual arrays of setpoints, you can use SoftMotion instead. I have attached an example that you will run on My Computer. It currently allows you to blend three single axis moves together, but it could be expanded to do more. Let me know if you have any questions about the example (and please excuse its messiness!).

 

Thanks,

Message 2 of 12
(8,640 Views)

Hi Paul,

 

I find it astonishing that this bug has prevailed for so long (I've back tested to the 2009 release and it's there too), so no-one tested blending of more than two profiles in the Blending functions before? Smiley Surprised

 

Thanks for the options. I need the profile arrays, as these will be sent to an FPGA for generating a pulse train signal that is interpreted by a third-party servo amplifier. There's no option to change the hardware in this, so that's how it has to be. Therefore, "goal#2" seems to be my only option.

 

Did I say I need all this to work on a Real-Time CompactRIO? Before I start playing with your example, please can you confirm that this is possible. From a brief glance I see quite a lot of code in there, including a timed loop synchronised to the Scan Engine. I can't have that as my Scan Engine is set to a relatively low rate and is entirely unrelated (presumably) to generation of these profiles.

 

Also, I was originally interested in the S-curve profiles. The trapezoidal ones I could probably do for myself with some simple calculations, but the S-curves are more complex and therefore I was attempting to use NI's profile generation tools. Can the example create s-curve blended profiles?

 

I await your response with earnest,

 

Thanks

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 3 of 12
(8,632 Views)

OK, so I've played with your example a little bit and I see the following problems:

 

1. The code uses a Scan Engine sync'd Timed Loop to generate the profile points, so it takes as long to create the profiles as it will to execute them. I need code that generates profiles without delay as the code will be creating different profiles, depending on the parameters provided each time, and the execution must begin immediately.

 

2. The end result shows an increase beyond maximum velocity (set to 1,400 in this snapshot) just before the deceleration of the second profile:

bump.jpg

 

3. The gradients are very steppy (which I did not get from the Motion Assistant > Blend Move functions)

steppy.jpg

 

 

 

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 4 of 12
(8,630 Views)

Hello Thoric, Paul...

 

I fiddled with blending a little bit, as did Paul, and the velocity bumps seem to be an unfortunate aspect of our method of blending.

 

The stairstepping goes away if you run at a slower cycle rate (at least it did on my tests)... 10ms makes it happy.

 

You probably don't want to leverage the online solution anyway, though, for this.

 

We do have an offline trajectory generator that creates a single stop-to-stop motion profile.  If you get a little clever about identifying the deceleration segment of the profile (e.g. the velocity decreases), you could probably manually add these together into a form of homebrew blending.

 

Edwin!

Message 5 of 12
(8,594 Views)

Attached is a sample project (in LabVIEW 2012 sp1 which should open in LabVIEW 2012) that uses offline trajectory generation to create two movement profiles, uses different scanning VIs to find the end of the acceleration phase or the start of the deceleration phase, and another VI to blend the two velocity profiles together.

 

Extending this to more than two profiles is an exercise for the reader, as is adding in the tons of special case error testing logic.

 

To blend the positions together is similar to blending velocities.  Or you can just integrate velocity to create a new position profile.

 

Hope this helps as a starting point.

 

Edwin!

 

Message 6 of 12
(8,587 Views)

Hi Edwin,

 

Thanks for the email and the attachment, sorry for the late response - I'm quite distracted currently.

 

Yes, the approach you've outlined is roughly what I guess I need to do, so thank you for the head start.

Checking the total travelled distance, that appears to be good too, so there's no slippage here.

 

Thank you, I will work with this to create my own pseudo-blends.

 

Note: I've marked the reply that states this is a bug as the solution to this thread because that answers my original question, and will probably be most helpful to others who encounter this same problem.

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 7 of 12
(8,558 Views)

Edwin,

 

I have a new issue. I tested your example in LabVIEW 2012 with the equivalent NI Motion toolkit (8.4). However, my actual project work is in LabVIEW 2009 and cannot be upgraded, alongside which I have installed the equivalent NI Motion (8.1). I'm attempting to create equivalent code to your example in this older release and I cannot find equivalent functionality to the NI Motion functions you have used. There appear to be some that are similar, but I certainly can't find a 'Solve Profile' method to call anywhere.

 

Asking LV2012 to Save for Previous results in a project that cannot be loaded in 2009 due to missing dependencies, including obscure items such as "nimc.destroyDataItemsInstance.vi", hence my reason for re-creating the code by hand.

 

Any chance you can help re-create your example in 2009 for me?

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 8 of 12
(8,510 Views)

OK, so I checked the compatibility tables, and NI Motion 8.4 is compatible with LV2009 so I'm downloading NI Motion 8.4 now to install on my LV2009 machine Smiley Happy

Hopefully I'll then be able to use the back-converted lvproj.

 

Spoiler
Why am I not using my Distribution Suite to install it I hear you ask? Well, when you put the 2012 Distribution disc in and select NI Motion from the list, it insists on installing LV 2012 too! Smiley Mad

 

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 9 of 12
(8,508 Views)

Aaarghh! So installing NI Motion 8.4 on LabVIEW 2009 doesn't actually install the same functions that it does on LV2012?? A full install of NI Motion 8.4 and Motion Assistant 2.8 and I still have missing dependencies, and the NI SoftMotion functions palette still looks very different to that in LV 2012 with the same toolkit. Am I missing something here!? Smiley Sad

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 10 of 12
(8,506 Views)