Motion Control and Motor Drives

cancel
Showing results for 
Search instead for 
Did you mean: 

Joystick with softmotion

Please have patience with this long post!! 
     I have created a biaxial mechanical testing device using cRIO 9012 with four 9505 servo drives.  My application allows the user to define either straight line moves at a given velocity or contoured moves for conditioning etc.  I have also have an analog joystick to allow the user to "jog" the actuators to facilitate loading specimens.  Everything works at this point except for the joystick.  I use threshholding to determine when the joystick has left the neutral position, and a move is desired.  The direction of the move is also based on the analog value of the joystick.  Once a desired move has been detected, a straight line move is started with the target position set based on the direction desired (+ movement setpoint is say 50 mm - movement set point is say 10mm).  If the joystick reenters the neutral position before the actuator reaches the setpoint, the move is stopped ( have tried both stop immediatly and decelerate to stop).  If the joystick is moved from neutral the process is repeated. 
   This all functions properly, except that the trajectory generator will sporatically jump to the setpoint if the joystick is used repeatedly.  For example:  The user can command a - movement begining at 50mm and stop at say 35 mm.  The user may then move from 35 to 40, then from 35 to 20 and upon returning the joystick to the neutral position, the trajectory generator will change the position to 10 mm.   
   So, there seems to be something in the trajectory generator that does not like repeated starts and stops without reaching the setpoint.  Is this true?  What can I do to overcome this problem. 
Bscout
0 Kudos
Message 1 of 12
(5,386 Views)
Bscout,

I currently don't have access to my PC at work so I can't verify if everything that Im going to suggest is absolutely correct, but here are some ideas.

In general I would suggest controlling axes in velocity mode when using a joystick. From a user's point of view is an axis that moves with a velocity that is proportional to a joystick position a quite natural experience. The NI-Motion API that is used with NI's plugin motion control boards (73xx) provides a feature that is called velocity override. With this feature you can scale the loaded velocity between 0 and 100% without the need of starting and stopping the move inbetween.
As the NI-SoftMotion API is widely derrived from the NI-Motion API, I guess that this feature should be also available in the NI-SoftMotion API.

Please let me know if you can't find this feature or if there is a technical reason that wouldn't allow you to use the approach that I have suggested.

Best regards,

Jochen Klier
National Instruments
0 Kudos
Message 2 of 12
(5,373 Views)
I do indeed use the velocity override function.  I had not thought about setting the velocity to zero percent to stop the move.  This approach *may* work.  the difference would be that when the joystick enters the neutral position, I simply set the velocity to zero.  How will the trajectory generator act if the direction is changed without stopping first?  can I simply change the target position without initiating a start (profile not complete).
0 Kudos
Message 3 of 12
(5,371 Views)
Yes, I see the problem. As you can't change the direction by scaling the velocity this might be an issue. Unfortunately I can't try anything here, so please be patient until Monday (if nobody else has an idea).

Thanks and best regards,

Jochen
0 Kudos
Message 4 of 12
(5,369 Views)
I haven't been able to find a consistent method to tackle this application, but what about this approach?
  • Joystick is moved to positive direction: Load velocity and positive target position, start the move and scale the velocity with velocity override proportionally to the joystick position.
  • If the joystick is moved to negative direction now, stop the move, wait until the profile is complete, load a new (negative) target position and start the move. Again scale it with velocity override.
  • Probably you may want to define a small deadzone around the joystick's zero position, where the axis' velocity is scaled to 0%.
This approach is not really elegant but it should work properly, as the delay will be only a few ms when changing the direction. As changing the direction involves stopping the axis anyway, this approach shouldn't have negative impact on the application's performance and on the user experience.

I hope this helps,

Jochen
0 Kudos
Message 5 of 12
(5,347 Views)
Jochen,
What you have described is essentially what I have tried, except that I didn't set the velocity override to 0%, but rather stopped the move.  Myapproach works fine, except that I get sporadic behavior when repeatedly starting and stopping the move.  The commanded position will occasionally "jerk" to the target position.  One problem with setting velocity to 0% is that the profile is not complete, and therefore any "normal" moves (moves where the user enters in the desired parameters and the move excecutes to completion) will not execute.  Profile complete is used to prohibit the user from "overriding"  the initial move with subsequent calls without cancelling the move.  If I could only figure out why the trajectory "jerks" everything would work fine.
bscout
0 Kudos
Message 6 of 12
(5,345 Views)
Bscout,

could you please provide version information about LabVIEW und NI Softmotion?

Thanks,

Jochen
0 Kudos
Message 7 of 12
(5,342 Views)

Sorry, that should have been in the first post.  Labview 8.2.1, SoftMotion 2.0.0.3000 (according to MAX)

Bscout

0 Kudos
Message 8 of 12
(5,341 Views)
Bscout,

it looks like this is a known issue in NI SoftMotion 2.0. The error occurrs, when a start operation is still in progress when calling another start  method. In 2.0 this can result in a data corruption in the trajectory generator.

I have tried to reproduce the behavior in 2.5. Instead of corrupting the data, in this version the start method outputs an error when another start operation is still in progress. You can handle this error in your vi and call the start method repetitively until the start method executes successfully.
In 2.0 you could try to increase the wait time between repetitive starts. A wait time of 15 to 20 ms should be sufficient.

I hope this helps,

Jochen

0 Kudos
Message 9 of 12
(5,322 Views)
Jochen,
Thank you for your help.  The loop only runs at 100 ms but I suspect that I may have a problem in my logic somewhere causing multiple starts.  I will go through my subvis and check for that condition.
Bscout
0 Kudos
Message 10 of 12
(5,315 Views)