Replacing the Trajectory Block

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Replacing the Trajectory Block

673 Views
derekcook
Senior Contributor I

Hello, 

I am wanting to replace the Trajectory Block with my own trajectory block, and feed my outputs directly into the position block. I saw another post on the community about this, and tried to follow Adam's instructions he gave, however I am a bit confused. 

I used the software oscilloscope so that I could make the output of my trajectory block match the output of the TRAJPOS block so that the position block does not have any issues. I am a little confused on the units for the output of the position reference from the trajectory block - trajpos.output.refPos_mrev. When I bring up the software oscilloscope I see this is from -10 -> 10 mrevs. This directly corresponds to the enc.output.rotorAngle_Mrevs. 

In the GUI, I commanded the motor to go 1000 revolutions and tracked the trajpos.output.refPos_mrev and I see this just goes from -10 to 10 until 1000 revolutions has been completed. 

pastedImage_1.png

How does the position block know to go 1000 revolutions? Does it use the time the TRAJPOS block calculates the trajectory will take? We were planning placing 1000 revolutions into the position block, but it does not look like this is how the position block works. 

It may be better to have a call about this if possible, then I can update this post. We have a couple of other questions as well. 

Thanks, 

Derek

Labels (1)
0 Kudos
2 Replies

521 Views
linestream-adam
Senior Contributor I

Derek,

The Position Trajectory Generator is executing our windowed position system described in this post:

Alternative method to Trajectory in Position control mode 

The windowed system is used so that there are not overflow and precision issues related to fixed-point math. So every position signal in mechanical revolutions [mrev] is windowed to always be between -10 and 10. All KMS position components use this convention.

The position controller doesn't "know" to go to 1000 revolutions. The trajectory generator handles taking the position step of 1000 revolutions and generating the incremental references to tell the position controller where to go. The trajectory generator handles the window and the position controller knows that if my feedback says 10 but the profile generator says -9, the position error (reference - feedback) is 1 revolution.

So if you replace the trajectory generator with your own design, it is important that it conforms to this windowed position system, else you will run into a lot of issues. Also as mentioned in the other post, you will see performance degradation unless you generate the velocity and acceleration references as well.

0 Kudos

521 Views
derekcook
Senior Contributor I

Hey Adam, 

I went through the process of replacing the trajectory block, and ended up replacing the position block as well. My custom trajectory block did not handle the windowed position. It instead give a position between -1000 and 1000 revolutions. This position can also be updated at any 2ms tick without completing a trajectory. We found it more difficult to handle the windowed position than create a custom position block, so that was the route we took. The project is always in Speed mode with our custom position block regulating speed to maintain a position. 

Thanks for your help, 

Derek

0 Kudos