Closed zfxw0206 closed 8 years ago
You can supply a different route_path when you create the operation. It defaults to slot 1. Change that to port:0, slot:4. See the documentation at https://github.com/pjkundert/cpppo
On Monday, June 27, 2016, zfxw0206 notifications@github.com wrote:
I have a ControlLogix PLC, and want to realize the communication between ROS and this PLC. Previously, I was using slot 0 of PLC, it was fine, but now after changing to slot 4, I could not send the tag to PLC even though I can ping the PLC. Does anybody can help me? Thank you!
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pjkundert/cpppo/issues/19, or mute the thread https://github.com/notifications/unsubscribe/AARwbK5Ehx9slTlCejBuUjyDV-CBnF-yks5qP_vdgaJpZM4I_Ryx .
-pjk
I found the default route_path in " cpppo/server/enip/main.py" : route_path_default = [{'link': 0, 'port': 1}] Do you mean I should change it to "route_path_default = [{'link': 4, 'port': 0}]" or "route_path_default = [{'link': 0, 'port': 4}]"?
No, pass link 0, port 1 in the route_path argument to client.parse_operations.
On Monday, June 27, 2016, zfxw0206 notifications@github.com wrote:
I found the default route_path in " cpppo/server/enip/main.py" : route_path_default = [{'link': 0, 'port': 1}] Do you mean I should change it to route_path_default = [{'link': 4, 'port': 0}]?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pjkundert/cpppo/issues/19#issuecomment-228830574, or mute the thread https://github.com/notifications/unsubscribe/AGEWsWFsJvZXAuE4kxS2DaItGhILNelrks5qQBR0gaJpZM4I_Ryx .
-pjk
I did not see the route_path set in client.parse_operations. Do I need to add it?
I notice that I haven't updated the documentation! Sorry about that. I'll fix it.
Just pass route_path=... as a keyword parameter to client.parse_operations, with your custom value. It will use it (instead of the default) in the resultant sequence of operations.
On Monday, June 27, 2016, zfxw0206 notifications@github.com wrote:
I did not see the route_path set in client.parse_operations. Do I need to add it?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/pjkundert/cpppo/issues/19#issuecomment-228875783, or mute the thread https://github.com/notifications/unsubscribe/AGEWsYbzyUshHIe68Tfj-vFi-MkTuXN7ks5qQDuIgaJpZM4I_Ryx .
-pjk
client.parse_operations yield "opr" which is a dictionary. Do you mean add "route_path" in this dictionary? Can you give me more details about where to add "route_path" and how this parameter looks link? Is it "opr['route_path'] = {'link': 4, 'port': 0} (I am using slot 4)"? Thank you!
Just pass another keyword parameter when you call parse_operations( ..., route_path={'link': 4, 'port': 0} http://i%20am%20using%20slot%204/ )
It takes all remaining unrecognized keywords and adds then to each operation it yields.
On Tuesday, June 28, 2016, zfxw0206 notifications@github.com wrote:
client.parse_operations yield "opr" which is a dictionary. Do you mean add "route_path" in this dictionary? Can you give me more details about where to add "route_path" and how this parameter looks link? Is it "opr['route_path'] = {'link': 4, 'port': 0} http://I%20am%20using%20slot%204"? Thank you!
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/pjkundert/cpppo/issues/19#issuecomment-229044668, or mute the thread https://github.com/notifications/unsubscribe/AGEWsRbZVrtRiG_56ssUJ_2R3mG6V8Pbks5qQR4DgaJpZM4I_Ryx .
-pjk
I have a code named "write_to_plc", in this code, I didn't call parse_operations, but called "client.main". previously, my code is like this: result = client.main(["-a", plc_ip_address, combinedTag])
Now, I want to add "--route-path" like: result = client.main(["-a", plc_ip_address, combinedTag]["--route-path", [{'link': 4, 'port': 1}]])
Then, I got the following error: [ERROR] [WallTime: 1467144731.410220] bad callback: <bound method CallbackListener.ros_heartbeat_callback of <main.CallbackListener instance at 0x7faf9584f710>> Traceback (most recent call last): result = client.main(["-a", plc_ip_address, combinedTag]["--route-path", [{'link': 4, 'port': 1}]]) TypeError: list indices must be integers, not tuple
Can I set the route path in "client.main"? If I can, how to fix this error? Thank you!
Ah, if you are using cpppo.server.enip client.main, then you need to supply the --route-path as valid JSON. Only double-quoted dictionary keys are allowed. So, change your code to ... [ "--route-path", '[{"link": 4, "port": 1}]' ]
I assumed you were using the client API directly, and therefore calling client.parse_operations directly in your code.
-pjk
On Tue, Jun 28, 2016 at 2:20 PM, zfxw0206 notifications@github.com wrote:
I have a code named "write_to_plc", in this code, I didn't call parse_operations, but called "client.main". previously, my code is like this: _result = client.main(["-a", plc_ipaddress, combinedTag])
Now, I want to add "--route-path" like: _result = client.main(["-a", plc_ipaddress, combinedTag]["--route-path", [{'link': 4, 'port': 1}]])
Then, I got the following error:
_[ERROR] [WallTime: 1467144731.410220] bad callback: > Traceback (most recent call last): result = client.main(["-a", plc_ipaddress, combinedTag]["--route-path", [{'link': 4, 'port': 1}]]) TypeError: list indices must be integers, not tuple
Can I set the route path in "client.main"? If I can, how to fix this error? Thank you!
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/pjkundert/cpppo/issues/19#issuecomment-229170410, or mute the thread https://github.com/notifications/unsubscribe/AGEWsaUI4Ol2Ap33WGq6kO9aftZxOVT9ks5qQYINgaJpZM4I_Ryx .
I changed the route path to '[{"link": 4, "port": 1}]', but it still doesn't work. Except for setting route path, is there other option to write to plc when the plc uses slot 4?
I'm almost certain that it should be link:0, port:4.
-pjk
On Tue, Jun 28, 2016 at 3:03 PM, zfxw0206 notifications@github.com wrote:
I changed the route path to '[{"link": 4, "port": 1}]', but it still doesn't work. Except for setting route path, is there other option to write to plc when the plc uses slot 4?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/pjkundert/cpppo/issues/19#issuecomment-229182702, or mute the thread https://github.com/notifications/unsubscribe/AGEWsWHB8xwC6j02YZUM_kQQlrmbxfgTks5qQYwWgaJpZM4I_Ryx .
Because I am calling client.main and client.main calls parse_operations, I want to print route path in client.main to check if I set it successfully. I add the print after line 1518 of client.py , but it prints nothing. Can you tell me a way to display the route path, then I can check it. Thank you!
I would recommend adding some -v options to increase verbosity; the logging should display the route_path used.
On Wednesday, June 29, 2016, zfxw0206 notifications@github.com wrote:
Because I am calling client.main and client.main calls parse_operations, I want to print route path in client.main to check if I set it successfully. I add the print after line 1518 of client.py , but it print nothing. Can you tell me a way to display the route path, then I can check it. Thank you!
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/pjkundert/cpppo/issues/19#issuecomment-229369134, or mute the thread https://github.com/notifications/unsubscribe/AGEWsXYNgBmAso6AUWJ2gk7stOzbooMqks5qQn4CgaJpZM4I_Ryx .
-pjk
I did something wrong yesterday. Now I am using '[{"link": 4, "port": 1}]', it is working. Thank you very much!
I have a ControlLogix PLC, and want to realize the communication between ROS and this PLC. Previously, I was using slot 0 of PLC, it was fine, but now after changing to slot 4, I could not send the tag to PLC even though I can ping the PLC. Does anybody can help me? Thank you!