Motion Control and Motor Drives

cancel
Showing results for 
Search instead for 
Did you mean: 

Motion Assistant API bug

Setup:
Motion Assistant 1.2 and NI-Motion 6.1.4

Calling NIMAGetPositionProfile with certain combination of data and motion profile cause an access violation error.
Attached is a small C code that reproduce this error. This error also occur with Motion Assistan 1.3/NI-Motion 7.
0 Kudos
Message 1 of 7
(4,182 Views)
Hello,
 
Did this error occur when you developed the script in Motion Assistant or did this behavior only occur after you built your C file?  What values are you using to generate an error?  Did those values generate errors in Motion Assistant? 
 
Could you provide more information about the error itself?  What was the exact text of the error message?
 
Regards,
Scott R.
Applications Engineer
National Instruments
Scott Romine
Course Development Engineer
National Instruments
0 Kudos
Message 2 of 7
(4,167 Views)

Hi,

I didn’t developed any script in Motion Assistant. I'm not using Motion Assistant application, just C code using the C Motion Assistant API. This error occur when the C code is run and its occur exactly when  NIMAGetPositionProfile is called with certain values for position and velocity profile are used.
The C source code that I attached reproduces this error. There, you will find the position values and velocity profile. This code is based in the one that comes with Motion Assistant (National Instruments\Motion Assistant\API\Examples\C\ContourMove.c).

The exact text of the message when the program is compiled and run with Visual Studio .Net2003 in debug mode is:
- (in a dialog box) Unhandled exception at 0x7c901230 in TstMA.exe: User breakpoint. Break Continue Ignore.

If you click "Continue" you will get:
- First-chance exception at 0x7c96df51 in TstMA.exe: 0xC0000005: Access violation reading location 0xccccccc4.
So, it isn't an error code returned by NIMAGetPositionProfile.

This error normaly occurs when some code try to access an invalid memory position. In this case this code is NIMAGetPositionProfile with that combination of values. It will be nice if NIMAGetPositionProfile returned an error code (which it does for a others invalid conditions) when some values for position and move constraints couldn’t be achieved instead of crashing the hole application.

0 Kudos
Message 3 of 7
(4,163 Views)
Hello,
 
I have tried running your code on this end and saw the error.  You mentioned earlier that only certain parameters caused these errors.  What parameters did you change to cause this error and what were those values set to when the code ran without error?
 
Regards,
Scott R.
Applications Engineer
National Instruments
Scott Romine
Course Development Engineer
National Instruments
0 Kudos
Message 4 of 7
(4,148 Views)

Hello,

One set of parameters are those in example code. This same code will run without causing an error in a call to NIMAGetPositionProfile if you change velSpec.vini from 30.986665725708008 to 0.0, or you can maintain velSpec.vini with 30.986665725708008 and change the data points.
For example:
    f64 xPoints[] = {8.2000000000000171, 8.2000000000000171*10};
    f64 yPoints[] = {12.424999999999997, 13.474999999999994*10};

For most of the time NIMAGetPositionProfile works. I think the error is related to high (initial or cruise) velocities on short distances.



0 Kudos
Message 5 of 7
(4,143 Views)
Hello,
 
I apologize for the delay in getting back in touch with you.  What was the highest Vini value that you were able to use without generating an error over the short move that you executed?  When you used
 
f64 xPoints[] = {8.2000000000000171, 8.2000000000000171*10};
f64 yPoints[] = {12.424999999999997, 13.474999999999994*10};
 
Did any value for Vini work other than 0?
 
Was there a reason that you were using the Motion Assistant API instead of the standard NI Motion functions? 
 
Regards,
Scott R.
Applications Engineer
National Instruments
Scott Romine
Course Development Engineer
National Instruments
0 Kudos
Message 6 of 7
(4,109 Views)

Hello,

 

In the case you mentioned:

f64 xPoints[] = {8.2000000000000171, 8.2000000000000171*10};
f64 yPoints[] = {12.424999999999997, 13.474999999999994*10};

It will work if values gather then 0, but I don’t know the highest value that could be used.

Whit

f64 xPoints[] = {8.2000000000000171, 8.2000000000000171};
f64 yPoints[] = {12.424999999999997, 13.474999999999994};

vini could be between 0 up to 28. With 29 you will begin getting the error.

 

The reason that I’m using Motion Assistant API is that I don’t know any function in NI Motion that could generate data points for contouring move. My original data (XY coordinates) doesn’t represent a motion profile, just the geometry. So I use the API to generate the data points accordingly to move constraints requirements.


Regards.

0 Kudos
Message 7 of 7
(4,106 Views)