Help obtaining real-time encoder readings

Hi everyone,

I began using the ODrive system today to create a joystitck to move objects in a custom simulation. I have set up the ODrive and gotten the encoder (AS5047P) readings to work with read odrv0.axis1.encoder.pos_cpr and, as below, with liveplotter.

How can I read the encoder readings (odrv0.axis1.encoder.pos_cpr) in real-time in the form of a variable? For example, I need the variable used in the following liveplotter command:
start_liveplotter(lambda:[odrv0.axis1.encoder.pos_cpr])
to be accessed from a script or program.

If I can do the above, can I use shared memory so I can use a program in another language to access said variable real-time?

Thank you!

I think the liveplotter just continuously queries that value? I’m not positive though, @madcowswe would know more.

Once you get it into python you can do anything python can :slight_smile:

Yeah, just connect to the odrive in your python script rather than with odrivetool. See the demo python script.