Code Monkey home page Code Monkey logo

Comments (14)

pjkundert avatar pjkundert commented on July 20, 2024

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 [email protected] 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
#19, or mute the thread
https://github.com/notifications/unsubscribe/AARwbK5Ehx9slTlCejBuUjyDV-CBnF-yks5qP_vdgaJpZM4I_Ryx
.

-pjk

from cpppo.

zfxw0206 avatar zfxw0206 commented on July 20, 2024

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}]"?

from cpppo.

datasim avatar datasim commented on July 20, 2024

No, pass link 0, port 1 in the route_path argument to
client.parse_operations.

On Monday, June 27, 2016, zfxw0206 [email protected] 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
#19 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/AGEWsWFsJvZXAuE4kxS2DaItGhILNelrks5qQBR0gaJpZM4I_Ryx
.

-pjk

from cpppo.

zfxw0206 avatar zfxw0206 commented on July 20, 2024

I did not see the route_path set in client.parse_operations. Do I need to add it?

from cpppo.

datasim avatar datasim commented on July 20, 2024

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 [email protected] 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
#19 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/AGEWsYbzyUshHIe68Tfj-vFi-MkTuXN7ks5qQDuIgaJpZM4I_Ryx
.

-pjk

from cpppo.

zfxw0206 avatar zfxw0206 commented on July 20, 2024

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!

from cpppo.

datasim avatar datasim commented on July 20, 2024

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 [email protected] 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
#19 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/AGEWsRbZVrtRiG_56ssUJ_2R3mG6V8Pbks5qQR4DgaJpZM4I_Ryx
.

-pjk

from cpppo.

zfxw0206 avatar zfxw0206 commented on July 20, 2024

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!

from cpppo.

datasim avatar datasim commented on July 20, 2024

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 [email protected] 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_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: > 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!


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#19 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/AGEWsaUI4Ol2Ap33WGq6kO9aftZxOVT9ks5qQYINgaJpZM4I_Ryx
.

from cpppo.

zfxw0206 avatar zfxw0206 commented on July 20, 2024

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?

from cpppo.

datasim avatar datasim commented on July 20, 2024

I'm almost certain that it should be link:0, port:4.

-pjk

On Tue, Jun 28, 2016 at 3:03 PM, zfxw0206 [email protected] 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
#19 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/AGEWsWHB8xwC6j02YZUM_kQQlrmbxfgTks5qQYwWgaJpZM4I_Ryx
.

from cpppo.

zfxw0206 avatar zfxw0206 commented on July 20, 2024

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!

from cpppo.

datasim avatar datasim commented on July 20, 2024

I would recommend adding some -v options to increase verbosity; the logging
should display the route_path used.

On Wednesday, June 29, 2016, zfxw0206 [email protected] 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
#19 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/AGEWsXYNgBmAso6AUWJ2gk7stOzbooMqks5qQn4CgaJpZM4I_Ryx
.

-pjk

from cpppo.

zfxw0206 avatar zfxw0206 commented on July 20, 2024

I did something wrong yesterday. Now I am using '[{"link": 4, "port": 1}]', it is working. Thank you very much!

from cpppo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.