- 26/03/2019 at 12:37 #13196
I would like to query the signal of another component with the “if” syntax,- not use the expression as counter as in the example.
Is it possible ?
Attachments:You must be logged in to view attached files.016/08/2019 at 14:14 #16359
I would like that too. Did you manage to do that? Is it possible? Thanks in advance.021/08/2019 at 10:24 #16437
Hello, About your question, I have the answer.
Just Remember, first need define our Variables in the section UserVariables, with correct type, and this variables no restart automatically021/08/2019 at 19:05 #16454
with WriteSignal you can use in one if and communicate with other works with waitsignal to start a new condition028/08/2019 at 15:45 #16597
Thanks for your answer! Can you please explain it more clearly? I still don’t understand how can I use these two commands to make If with them.028/08/2019 at 23:00 #16599
Apologies. There was a delay in approving the first post of Quintan.E.
The expression of the If task cannot refer to a signal in another component. There are workarounds.
- Use a WaitSignal task instead of an If task to query the signal value of another component.
- In the WaitSignal task SignalValue property, use a question mark (?) to make a conditional argument. That is, do something based on the signal value.
- If you do not want the WaitSignal to listen for an event/trigger before evaluating the signal, set the WaitTrigger property of the WaitSignal task to false.
Refer to WaitSignal task in the Works Task Reference Guide, found on this forum.
The May 3, 2019 version of that guide has the task description on page 128.
There appears to be interest in the ability to reference signal values in expressions for conditional tasks. Possibly a new feature or expression function for Works, e.g. If:signal(Works Process#2,SensorBooleanSignal):True?False. However, the WaitSignal task can do the job, and I think someone might have already modified an If task to do what you want. I do know others would like the ability to read robot IO, so let’s see where this goes.030/08/2019 at 14:25 #16638
Hi zesty! Thanks for the tip! Unfortunately I didn’t have much succes with the WaitSignal, because I needed multiple conditional WaitSignals, but in value there can be only True?False, so signals from different components lead to same result. (or i did something wrong)
Fortunately, I finally managed to make custom task for it. In the layout is custom Works Process with IfSignal task in it. Inputs are Component name, Signal name, Then and Else. If the signal value is True, “Then” executes, otherwise it executes “Else”. It should be working.
Attachments:You must be logged in to view attached files.030/08/2019 at 21:26 #16640
I understand now. Yes, a WaitSignal task evaluates signal from one component. The conditional values can be numerous based on the signal type. With Boolean, true or false, but with strings and integers you have a bit more freedom. Good that you were able to make a custom task, and even better that you provided us with the example 🙂0
You must be logged in to reply to this topic.