christiansandberg / canopen

CANopen for Python
http://canopen.readthedocs.io/
MIT License
449 stars 197 forks source link

Help wanted: How to receive a message #237

Closed rakamafo closed 5 months ago

rakamafo commented 3 years ago

Hi Folks !

@christian: Thanks for the great Library !

My query is the same as issue #232., however I couldn't quite implement the solution. I am using the library to actuate a CANBUS integrated motor. the motor responds with a simple CAN protocol and 8 byte data as :

buf_tx = [0xA6, 0x00, 0x00, 0x03, 0x00 , 0xFF , 0x00, 0x00]
network.send_message( CAN_ID, buf, False)

the motor moves with those lines of code.

I need to read the response/ reply of the motor and store it in a buffer: something like/ equivalent to: network.receive_message( CAN_ID, buf_rx ) or buf_rx = network.receive_message(CAN_ID)

I'm unsure on how to implement network.notify() and network.subscriber(). Can you share a snippet on how to implement it ?

In general, I would like to know how to read or receive the 8 byte buffer/ messages on the bus.

I would appreciate some help. Thanks in advance Michael.

friederschueler commented 5 months ago

If the protocol is not CanOpen, then this is the wrong lib. You should use python-can directly? Closing this for inactivity.