-
Notifications
You must be signed in to change notification settings - Fork 197
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
How to import an OD-file correctly? #550
Comments
There is no mechanism in this library to automatically start such communication based on the DCF contents. You will need to call these methods separately, while giving them the configured values from the parsed OD object:
For any of this to work, you should be using a Sending TPDOs automatically on SYNC reception is not supported out of the box I think. You'll need to subscribe to the SYNC message with a callback and then trigger the PDO's You're welcome to improve the |
Thank you for your fast answer @acolomb . When i try the start_heartbeat command the compiler says "'LocalNode' object has no attribute 'od'". Furthermore it says the PDO object has no attribute 'transmit'. |
Sorry, that should be Whatever your application should do later on (keep a main-loop running or similar), you'll need to integrate with that anyways. So better design your code that responds with PDO content to fit your application, and treat the canopen library as only handling the actual encoding and transmission. |
Hello again, In addition I would like to change a value of an object in the od-file. I couldn't find any commands for this in this library. Is it still possible? Thank you for your help! |
Well there is no automatic connection between the OD values and the local TPDO mappings, as far as I know. You need to update the mapped variables'
You want to update the EDS / DCF file from the Python code? You can always import it, change some values in the resulting In general, please do take a look at the API docs, as most available functionality is described there. Once you get your head wrapped around how the various service classes interact with the OD, it's pretty straightforward. |
Hello,
i imported an DCF-File as OD-file and connected it with a node. This DCF-File includes a predefined heartbeat and a predefined PDO, which should be send on sync-messages. This works perfectly in the simulation (CANoe) but not at all on my Raspberry Pi 5. I can't see hearbeat, bootup message or any PDO.
As I understand it, the node should automatically send the contained messages, isn't it? So how should i implement the OD-file correctly to run these messages automatically?
Here is my current code:
`import canopen
import os
import time
os.system('sudo ip link set can1 type can bitrate 125000')
os.system('sudo ifconfig can1 up')
network = canopen.Network()
node = network.add_node(10, '/home/canuser2/Dokumente/PythonFile/EDS Files/D010.DCF')
network.connect(channel='can1', bustype = 'socketcan', bitrate=125000)
network.check()
`
And this is the used dcf file (converted to txt due to upload problems):
D010.txt
The text was updated successfully, but these errors were encountered: