Accessing requested state from ASCII protocol

I am trying to build a remotely operated odrive application which I was hoping to use only the ASCII protocol serial comms to perform all the tasks I need. I would like to be able to do these things over the serial ASCII

-perform a motor calibration
-enter closed loop control
-enter idle state

My current prototype uses a combination of odrivetool and ASCII protocol all called from within the same python program, it works great but I would like to do everything over a wireless serial connection.

I have tried:

def go_live():
ser.write(b’w odrv0.axis0.requested_state 8’)

def go_idle():
ser.write(b’w odrv0.axis0.requested_state 1’)

but it doesn’t do anything. In the documentation it says most settings are available through ascii if they have a numerical argument, but I am having no luck with this.

Could I do this another way? Do I have to put something with a python interpreter next to the odrive to run odrivetool on my remote machine?

Here are the notes on axis states

First post, Thanks!

realised i didn’t have a \n at the end of the string, still doesn’t work though!

You may want to check the Arduino library to see how it’s done there? Because that looks to me like it should work

I’m doing it in C with this code:
printf(“w axis%u.requested_state %u\n”,axis, requested_state);

Syntax is obviously different, but notice that I’m not putting “odrv0.” in front of it.

-Denny

Thanks Desterline, I took off the odrv0 and it worked perfectly!

1 Like