Jump to content
OMRON Forums

Generating Normal to a Contour


JeffLowe

Recommended Posts

I need to generate a normal angle to a contour. I am looking at using Motor[0] with a user written servo. The Motor[0] position will then be used by a came table for other functions.

 

double user_pid_ctrl(struct MotorData *Mptr)

{

double normalangle;

if (abs(Motor[XMOTOR].DesVel)>0 || abs(Motor[YMOTOR].DesVel)>0)

{ normalangle=atan2d(Motor[XMOTOR].DesVel,Motor[YMOTOR].DesVel); }

else { normalangle = 200; }// not a valid angle use for table suppression.

return 0;

}

 

Would it be appropriate to write the angle directly to Motor[0].pos, or should it go through an encoder table entry, or perhaps some other register?

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

This should be OK to do. In Script, the write is blocked if the "motor" is enabled, but this routine is in C so you don't even need to worry about that. Of course, the motor must be activated for your value to get copied into Motor[0].ActPos, and not closed-loop if you then want the value to be copied into Motor[0].DesPos.
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

×
×
  • Create New...