Jump to content
OMRON Forums

About how to call CfromScript() function


dzrong

Recommended Posts

Hello Everyone,

Is't posible to call CfromScript() function like this way in forward and inverse program?So i can change the CfromScript when program is running.

cmd"#1..8p"

0 0 0 0 0 nan 0 0

Why i can't get the Motor6 position when using CfromScript() like this?

 

// Define the same state values as defined in usrcode.c
#define Forward_Kinematics_State 0
#define Inverse_Kinematics_State 1
#define KinematicsType1 1
#define KinematicsType2 2
// Define storage flags for the error code returns
&1
csglobal ForwardKin1ErrCode,ForwardKin2ErrCode,InvKin1ErrCode,InvKin2ErrCode;


open forward (1)

if(p1000 == 1) 
{
ForwardKin1ErrCode = CfromScript(1,Forward_Kinematics_State,KinematicsType2,0,0,0,0);
}
else //
{
ForwardKin1ErrCode = CfromScript(1,Forward_Kinematics_State,KinematicsType1,0,0,0,0);
}
close

 

Thanks

usrcode.c

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

dzrong,

 

The answer to your first question is "yes". You can switch between different modes in kinematic routines, even in inverse kinematics, however, you are responsible for ensuring "continuity" in the motor/axis calculated positions or else you will see a jump where the motors try to get from one position to another.

 

The second one on "nan" issue, I suspect a calculation / programming problem since all the other positions are being calculate properly. I would check for a division by zero or similar error in your forward routine.

 

Regards,

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

×
×
  • Create New...