cancel
Showing results for 
Search instead for 
Did you mean: 

Profile of the trapezoidal move - position control using FOC

msingh
Senior

Can someone help me understand the profile of the trapezoidal move? for example if I would like to make a movement of 10 radiance in 10 seconds using the MC_ProgramPositionCommandMotor1 how much of the 10 seconds will be acceleration, constant velocity and deceleration? and can this profile be changed? Ideally i would like to achieve 1/6 accelleration 4/6 constant velocity and 1/6 deceleration, is this even possible? is there somewhere in the code where I can specify this?

1 ACCEPTED SOLUTION

Accepted Solutions

The code you need to modify is the function TC_MoveCommand in trajectory_ctrl.c. This function currently divides the movement into 9 steps, 3 acceleration, 3 cruise and 3 deceleration. It shouldn't be too difficult to change this to meet your 1-4-1 requirement.

View solution in original post

8 REPLIES 8
GMA
ST Employee

Hello,

There is a Position Control Application note:

https://www.st.com/resource/en/application_note/an5464-position-control-of-a-threephase-permanent-magnet-motor-using-xcubemcsdk-or-xcubemcsdkful-stmicroelectronics.pdf

Best regards.

GMA

If you agree with the answer, please accept it by clicking on 'Accept as solution'.
Best regards.
GMA
msingh
Senior

Dear @GMA​,

Thanks for your reply, I've had a look at this document however I am struggling to find the answer to my question. I have based my question considering the attached graph, if time at D is 10 seconds what would be the time at B and C?

Thanks in advance

Kind Regards

Manpreet Singh

GMA
ST Employee

Hello,

Page 7/22:

  • total duration DeltaT =  fDuration parameter = 9A then A=fDuration/9 with B=3A
  • cruise= l =Deltat/3

Best regards.

GMA

If you agree with the answer, please accept it by clicking on 'Accept as solution'.
Best regards.
GMA

The code you need to modify is the function TC_MoveCommand in trajectory_ctrl.c. This function currently divides the movement into 9 steps, 3 acceleration, 3 cruise and 3 deceleration. It shouldn't be too difficult to change this to meet your 1-4-1 requirement.

Thanks for your reply this is definitely helpful.

Hi, it looks like it is not as straightforward as we thought, I have made the change as below and I am indeed seeing this change taking effect if I monitor the speed of the motor however the position reached is not as requested by the function. I am using Motor pilot to plot the graphs and below is the result of some tests I have done. Do you think I need to make any additional changes to the code? I have tried to scale the requested position by the error but still no luck to achieve the requested position, I have also tried tuning the PIDs again but didn't help.

0693W00000WJFQ5QAP.png

Hi, not quite what I was thinking :) I think you should have reduced the number of pHandle->SubStep to an array of 6 (1+4+1) and the SubStepDuration should be the total duration divided by 6 (instead of 9).

Having said that, I've just looked at the trajectory code, and it may be a bit more complicated than that.

You would have to experiment a little there.