Kinematics Iflag Following Error
- smarcom
- Offline
- New Member
Less
More
- Posts: 7
- Thank you received: 0
25 Feb 2023 22:33 #265361
by smarcom
Kinematics Iflag Following Error was created by smarcom
I have a scara robot controlled by linuxcnc. We frequently disable the machine, move it to a position by hand, then reenable it and zero the machine at that position. We have absolute encoders on both arms so we don't rehome at the enable. Since the scara arm can always choose between two different arm positions, we set a flag when the machine is enabled so that it sticks to the one it was placed in at the enable.
In the forward kinematics, we have the following code to determine the flag when enable is pressed. If the second arm is at a positive angle, it stays on that side, and vise versa.
In the inverse kinematics, the code decides which pose the arm will be in based on this code:
The issue is that when you first press enable, the machine throws a following error if you have changed the pose of the arm from one side to the other. If you then press enable again it works normally on both sides. This shows that the flag does work as intended. If you have not changed the side the arm is on, the machine enables fine on the first press.
Our theory is that the motion.machine-enabled pin is changed between when the forward and inverse kinematics are called, making the flag out of date when the inverse kinematics are run. The question is when the motion.machine-enabled pin is changed, and if there are any other thoughts on this question.
Let me know if that does not make sense, and I can hopefully answer any questions .
In the forward kinematics, we have the following code to determine the flag when enable is pressed. If the second arm is at a positive angle, it stays on that side, and vise versa.
a0 = joint[0] * ( PM_PI / 180 );
a1 = joint[1] * ( PM_PI / 180 );
a2 = joint[2];
if(*(haldata -> enabled) != previous_enable_state){
if(a1 < 0){
*(iflags) =1;
}
else{
*(iflags) =0;
}
previous_enable_state = *(haldata -> enabled);
}
In the inverse kinematics, the code decides which pose the arm will be in based on this code:
if (*(iflags)){
q1 = -q1;
}
The issue is that when you first press enable, the machine throws a following error if you have changed the pose of the arm from one side to the other. If you then press enable again it works normally on both sides. This shows that the flag does work as intended. If you have not changed the side the arm is on, the machine enables fine on the first press.
Our theory is that the motion.machine-enabled pin is changed between when the forward and inverse kinematics are called, making the flag out of date when the inverse kinematics are run. The question is when the motion.machine-enabled pin is changed, and if there are any other thoughts on this question.
Let me know if that does not make sense, and I can hopefully answer any questions .
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
Less
More
- Posts: 23162
- Thank you received: 4860
27 Feb 2023 00:03 #265453
by andypugh
Replied by andypugh on topic Kinematics Iflag Following Error
I would expect machine-is-enabled to be set during the first stage of the motion sequence, when it reads the inputs.
Please Log in or Create an account to join the conversation.
Time to create page: 0.081 seconds