Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there way to check the content of the pdo mapping #116

Open
tomhira opened this issue Aug 21, 2023 · 3 comments
Open

Is there way to check the content of the pdo mapping #116

tomhira opened this issue Aug 21, 2023 · 3 comments

Comments

@tomhira
Copy link

tomhira commented Aug 21, 2023

Hello bnjmnp.
Is there way to check the content of the pdo mapping?
I have trouble to know why only 3 out of 4, are mapped.
I can see it with twincat3, but also I would like to check in pysoem.

@bnjmnp
Copy link
Owner

bnjmnp commented Aug 21, 2023

You could read out the assign objects 0x1C12 and 0x1C13, and from there the listed PDO mapping objects using SDO read. I found an SOEM C code example that does that: SOEM/test/linux/slaveinfo/slaveinfo.c#L332C5-L332C15, though this could be simplified a bit.
Maybe there is a better way of getting current mapping, because the mapping is already read out when doing config_map() and might be available somehow, I need to check.

@tomhira
Copy link
Author

tomhira commented Aug 22, 2023

Hello bnjmnp. Thanks always.
I got the read as follows:
1C12:0x0 0x01
1C12:0x1 0x1600
1C13:0x0 0x01
1C13:0x1 0x1a00
I am seeing how mapping is done in twincat also,
so this is same with twincat, and ok.

Other codes for check are:
class RfgOutputPdo(ctypes.Structure):
pack = 1
fields = [
('field1', ctypes.c_bool),
('field2', ctypes.c_bool),
('field3', ctypes.c_uint32),
('field4', ctypes.c_float)
]

++++++++++++++++++++++++++++++
rfg_output_data = RfgOutputPdo()
rfg_output_data.field1 = 1
rfg_output_data.field2 = 2
rfg_output_data.field3 = 3
rfg_output_data.field4 = 4
++++++++++++++++++++++++++++++

Why I am asking is:
Somehow, field 4 is never reflected or updated with this:
class RfgOutputPdo(ctypes.Structure):
pack = 1
fields = [
('field1', ctypes.c_bool),
('field2', ctypes.c_bool),
('field3', ctypes.c_uint32),
('field4', ctypes.c_float)
]
but field4 is reflected if I do:
class RfgOutputPdo(ctypes.Structure):
pack = 1
fields = [
('field1', ctypes.c_bool),
('field2', ctypes.c_bool),
#('field3', ctypes.c_uint32),
('field4', ctypes.c_float)
]
or
class RfgOutputPdo(ctypes.Structure):
pack = 1
fields = [
('field1', ctypes.c_bool),
('field2', ctypes.c_bool),
('field4', ctypes.c_float)
('field3', ctypes.c_uint32),
]

Does anybody experienced this kind of behavior?

@tomhira
Copy link
Author

tomhira commented Aug 22, 2023

Upon furthur trial, I found that the following make field3 and field4 reflected and updated, but field 2 cannot be updated:
class RfgOutputPdo(ctypes.Structure):
pack = 1
fields = [
('field1', ctypes.c_bool),
('field3', ctypes.c_uint8),
('filed4', ctypes.c_float),
('field2', ctypes.c_bool)
]

For 0x1600 0x01 is field1
0x02 is field2
0x03 is no assign
0x04 is field3
0x05 is field4
and 0x7000 0x01 is field1
0x02 is field2
0x7004 0x01 is field3
0x7005 0x01 is field4
I cannot figure out why the field2 is not updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants