I am using Visual Components for a project, and i am programming the robot with a python script. I got the program running how i like, but i have one problem left to solve.
I have set up S7 connectivity with a Siemens plc, and connected the variables i need. However i can’t get it working with the python script. I use the: robot.SignalMapIn.input(Here i put input port) == True, but it doesn’t proceed the program execution, although i i can see in the connected variables section, that the variable is true. The outputs gets to plc, and is working great. There i use the: robot.SignalMapOut.output(port,True)
I i have tried using both if and while statements to wait for the input, what am i doing wrong?
Signal maps are just holders for signal behaviors and don’t hold values by themselves.
You need to get the signal behavior (vcSignal) that is connected to the signal map port you want and then use the vcSignal.Signal() method to trigger the signal with given value.
PS: The signal behaviors used with signal maps might not be visible in the Modeling tab, but are accessible through API. The “Signals” editor UI and Connectivity feature create such hidden signals when you connect something to a signal map port that doesn’t already have a signal.
PPS: This is a related topic: Data Transfer PLC to Inputs - #4 by Mathias
First of all, thanks for the answer.
I am very new to this, and not sure how to exactly write the commands you are talking about. Can you give me an example? Like how do i specifically write the command i need. And i dont know which ports you are talking about, is it the robot in/outputs to which i connect the PLC variables? I guess im just not sure how to write this in the correct way.
How do i use the vcSignal methos? can you show me an example? I’m stuck and cant get this working
This is some basic stuff that has been explained many times.
Please just go through some basic Python API tutorials from the VC Academy and read the reference manual pages for vcSignal and vcSignalMap.