Motion Control and Motor Drives

cancel
Showing results for 
Search instead for 
Did you mean: 

Elliptical Motion

I'm a relatively new Labview User trying to set up an experiment with LabVIEW motion that previously ran on a Galil Motion Controller. Basically, I have a two axis system and am trying to make what would be ellipses in 2D cartesian coordinates:

Labview 7.0 (I know, it's on the list of upgrades for the lab, but I don't know when it will actually get put through)
NI PXI-7350 Controller
NI MID-7652 Servo Motor Drive
2 servo motors

for my experiments, I need this system to follow a sinusoid in position with precise control over the period of the motion. All of my initial experiments will be done with the two axes 90 degrees out of phase, though some later ones may need to change that parameter. The amplitude of motion needs to be independent for each axis. I also need continuous position feedback from the encoders.

I started by generating my sinusoids in MATLAB and feeding them into the NI-Motion Assistant as a contoured move, but I couldn't figure out how to get precise control over the period of the movement (it was mostly just guess/check with the velocity in the move constraints). Furthermore, I can't seem to export the contoured move to a LabView VI. This is important to me bacause there needs to be an overall VI setting various parameters between the two sinusoids and handling the data acquisition. The actual motion needs to be something I can put into a subVI.

Once I gave up on Motion Assistant, I started looking through the FlexMotion example files, and eureka! there was an example on creating a 2D ellipse. If I could get this to work, it would probably fit my needs very well. The example did not work off the shelf, I change the wire into "Configure Vector Space.flx" at the y-axis connector from "Elliptical Tracking Axis #" to "y-axis". After doing that, if you set "Elliptical Tracking Axis #" to Axis 1, the y-axis will follow the x-axis, like I wanted. I can change the amplitudes of my sinusoids by changing the radius of the x-axis motion and the gear ratio between the two axes.

I thought that I could achieve the out of phase part of my requirements by starting one axis at an offset and then running the program, but I'm not sure that will work. Right now, the problem I am seeing is that the VI will not make a normal ellipse. That is, anything I try to run results in an ellipse that is slanted to the side (equivalent to a phase lag that is not a multiple of pi/2, if you look at the math). The most frustrating part is that if I back everything up and go back to the original example, starting with both axes at 0, my ellipse is still slanted (I have a phase lag that is unaccounted for in the code.)

I still think that doing electronic gearing between the two axes is the way to go for the motion profiles that I am trying to make, but I NEED to control the phase lag between the sinusoids (the angle of the ellipse) very precisely, and I cannot conduct my experiments with an unknown and unaccounted-for phase lag. It might make for an ultimately more flexible setup if I were to go back to contouring to a set of points, but I need to be able to precisely control the period of motion and also be able to save the motion into a subVI.

If anyone can help me on this issue, it would be much apppreciated, as my research project is on hold until I find a solution to this problem.
0 Kudos
Message 1 of 8
(4,929 Views)

Jordan,

How is the Motion Assistant failing to generate LabVIEW code?  Does the option to generate a LabVIEW Diagram show up under the Tools Menu?  The example would be a great way to hit the ground running with your project. Its strange that it seems to have a phase offset when you run the original example.  How are you determining the start position for you motors when running the program?  This may have something to do with the offset.  

Jason N 

0 Kudos
Message 2 of 8
(4,913 Views)
For a better idea of what it is I'm controlling, look here: http://web.mit.edu/squall/www/FFA/foil_animation_better.gif

Motion Assistant does generate code, the thing is that it only outputs the initial offset moves (straight lines) that I make before and after the contoured move, and it just skips over the contoured move.

With the gearing solution, I'm still very confused by the phase offset. Like I said, I need to have the two axes 90 degrees out of phase. What I decided to do for that was put the motors in that configuration before starting the arc move. For example, say I'm trying to make an ellipse with an X-radius of 4000 and a Y-radius of 8000:

a) power everything on
b) initialize the motor controller in MAX
c) open LabVIEW
d) run program
  1. move x-axis to 4000, y-axis to 0
  2. initialize gearing with 2:1 ratio
  3. start arc move with initial angle of 90 degrees, travel through N*360 degrees (where N is the number of cycles I want the ellipse to trace in)
  4. return to (0,0)
             (recording position & force data all the time)
e) change ellipse parameters and run another test

I've also hacked the 2D contoured spiral VI to run this. I can control the phase lag more accurately using this approach, and it seems more flexible in general (I can explore other patterns besides sinusoids). There are some new problems now, though.

I can't control the frequency of motion (speed) directly. I have to put points into a buffer and request an interval between the points for the contouring to set its own speed. This isn't too bad, I can manipulate the timing to get it to operate at 1Hz or slower. Funny things happen when I try to go any faster. (i.e. the motor twitches once and does nothing afterward, or once it seemed to overflow the control signal and started moving out of control.) I suspect that I might be able to get it running better if I tune the motor PID a little more, so I'm going to try that.

I also don't have the nice feature where I can ramp up the motor speed in an s-curve anymore. I'm going to try to apply that in the contour point generation VI that I have, which shouldn't prove too difficult.

The thing that bothers me most about this setup is that the speed control fails at EXACTLY 1 Hz, which makes me think it's still something in software, and not just motor tuning. I will post the code when I get back to lab, if anyone can take a look at it and tell me what they think the problem is (or any other pointers) that would be great. I eventually need to get the setup running up to 1.6 Hz or faster to collect all the data I need.

It'll be in this folder:
http://web.mit.edu/squall/www/FFA/contourVI
0 Kudos
Message 3 of 8
(4,881 Views)

Jordan,

When you say that problems occur at 1 Hz, do you mean a flapping rate of 1 Hz or do you mean resetting the rate every 1 second?  I don't see anything in the code that would cause any obvious problems at certain frequencies.  Does the "Requested Interval" input have any affect on this?  Also, what type of feedback, if any, do you have on your motors?  This may allow you to control the phase offset more accurately while you change the flapping rate in real time.

 

Chris

Applications Engineer

National Instruments

0 Kudos
Message 4 of 8
(4,858 Views)
Sorry for the delay, I've been away at a conference for about a week, and I was prepping for it beforehand.

The problem occurs at a flapping rate of exactly 1 Hz. Like you said, there doesn't appear to be anything in the code that would cause this, I suspect that it might be something to do with the limitations of the flexmotion control module, but I would expect faster responses to be possible. I'm going to start playing with it again today/tomorrow, and I'll let you know if I find a solution.

The "requested interval" value is actually one of the ways I can change the flapping rate. To my understanding, the flexmotion controller takes in the contour points for position, and tries to make the motion smooth between them, with the requested interval as the time between the points. That's the only way I could fins to control the speed of a contoured move.

The motors both have optical encoders on them. In addition, I have hollow-shaft potentiometers that measure true position (since there is some backlash in the motion due to gearing), but those are read by a DAQ routine and only used in calculating my force rotations for my measurments. The encoders have been the primary feedback since I started this thread, and the phase offset problems were there even with them. Using electronic gearing, the response always seems to have the same phase lag, and I cannot control it. That's why I switched back to a contoured input once I found a way that I could do it.

On a slightly separate note, does anyone know how the parameters of an s-curve control sequence are defined? I want to change the contour point input so that the motors ramp up slowly to vull velocity and then decelerate again. I can do this by changing the generated points before they are fed to flexmotion, but I would like to set it up so the VI is consistent with accepted quantities. e.g. if somebody were to input a specific number for the 'jerk' on my VI, it should be consistent with the motion that would be generated if that person was using any other system.
0 Kudos
Message 5 of 8
(4,801 Views)

Jordan,

Are you using the Load S-Curve Time function to set the parameters?  Here is a knowledgebase that explains more about this VI:

http://digital.ni.com/public.nsf/websearch/84D4B6FA66A0E86D86256A95005771D9?OpenDocument

-Chris

Applications Engineer

National Instruments

0 Kudos
Message 6 of 8
(4,771 Views)
As I understand it, I can't use that vi when I'm doing a contoured move. The jerk/acceleration/velocity data need to be in the array that I'm feeding into the buffer contour.

I reworked the way my subVI was generating the array to control the speed better. The overall function is identical, but it got rid of that weird behavior at 1Hz somehow.

Now I just need to figure out a way to run that array through another VI to slow down the transitions at the beginning and end of the movement. Since I can't just use the s-curve vi, I'm still wondering what to do on this. It's not entirely essential, so it's taken the backburner since I have a lot of other problems corpping up in the lab right now, but any advice would still be very appreciated.
0 Kudos
Message 7 of 8
(4,723 Views)
I think you should try and use the Motion Assistant again for your contour move. With a contour move, the basic trajectory move constraints (maximum velocity, acceleration and deceleration) have no effect.  NI Motion Assistant can re-map a user-defined trajectory based on user-defined move constraints.  When you add a contour step in the Motion Assistant, you can select a S-Curve profile on the move constraints tab.
 
Christopher W.
0 Kudos
Message 8 of 8
(4,704 Views)