- Posts: 12160
- Thank you received: 0
PathPilot Lathe with 6 place turret
In the last code you passed, this variable appears to be used to do that but a time delay is not set.
But, in the example, the zero value means no wait is programmed. I suspect you may get a result if you add a delay (which will be a count of servo-threads that you want to wait for).
Please Log in to join the conversation.
- brianTruck
- Topic Author
- Offline
- Premium Member
-
- Posts: 99
- Thank you received: 0
Here is my new code based off what I think your telling me.I think I keep the real time moving.
case 1:
turn on turret and increment a variable for short delay so that opto's clear current tool
case 2:
when any opto goes to zero move onto case 3
case 3:
increment a variable for a short delay to let optos center
case 4:
check for tool if wrong tool go back to case 2
sleeptime allways -starts zero
delay_count -starts at zero
times -gets set from HAL or defaults to 500
optodelay -gets set from HAL
Turrets starts and keeps running no matter how short or long I set optodelay,
Attachment not found
Thanks'
Brian
Please Log in to join the conversation.
So if the if statement is not executed, you just drop down into
Is that what you want? Normally break is the last command in a case statement.
Please Log in to join the conversation.
- brianTruck
- Topic Author
- Offline
- Premium Member
-
- Posts: 99
- Thank you received: 0
What I'm trying to do is to keep looking at all 3 opto sensors(stay at case 2) , once any of the 3 have been set off (normally on) move on to case 3. I always thought that "break" sends the computer back out to look at the switch.
So do I need a break under the if ?
case 2:
if(opto1 || opto2 || opto3)
{
progress_level = 3;
break;
}
break;
Thanks'
Brian
Please Log in to join the conversation.
Or, if you prefer, this is equivalent
Please Log in to join the conversation.
The break in fhe if satement is not required as the second break is always reached. What I'm seeing is that with your earlier code is that you were not staying on level 2 as execution of the level 3 code was occurring when progress_level was still 2. This looked like a bug.brianTruck wrote: Thanks'
What I'm trying to do is to keep looking at all 3 opto sensors(stay at case 2) , once any of the 3 have been set off (normally on) move on to case 3. I always thought that "break" sends the computer back out to look at the switch.
So do I need a break under the if ?
case 2:
if(opto1 || opto2 || opto3)
{
progress_level = 3;
break;
}
break;
Thanks'
Brian
Break does not reevaluate the swirtch statement but breaks out of it and reads the next statement after the terminating } of the switch. Andy shows an example where the break is omitted so the next case is executed. This means level 3 is executed on the same thread instance as level 2 changes rather than the next one so slightly more efficientt.
Please Log in to join the conversation.
- brianTruck
- Topic Author
- Offline
- Premium Member
-
- Posts: 99
- Thank you received: 0
Thanks' Guys
Here is the code that works, stops right on the money, It still might need some tweaking,but its way better than it was.
Attachment not found
Thanks' again,
Brian
Please Log in to join the conversation.
- brianTruck
- Topic Author
- Offline
- Premium Member
-
- Posts: 99
- Thank you received: 0
Thanks'
Brian
Please Log in to join the conversation.
linuxcnc.org/docs/html/remap/remap.html
Please Log in to join the conversation.
- brianTruck
- Topic Author
- Offline
- Premium Member
-
- Posts: 99
- Thank you received: 0
I did some quick reading and it said I could set the M6 position in the .ini file by
TOOL_CHANGE_POSITION = 0 0 0
Now when I run my M6 I get a "joint1 fallowing error" ,I think joint1 is the turret.
Thanks'
Brian
Please Log in to join the conversation.
