Questions about requesting my Ergo Jr through the REST API

Hi all,

I am using the rest API exposed by the pypot http server in order to query my Ergo Jr.

I have the following problems depending of the compliant state of the motors:

  • When is set to ‘false’, I noticed the following problems:
    • For the register ‘present_position’, my requests are performed without any problem but it takes time before to have a up-to-date enough value for this register,
    • For the register ‘present_temperature’, it is really “weird” and it implies very quickly and almost all the time the “fall” of the pypot http server: all requests fails and I must shutdown my raspberry.
  • When is set to ‘true’, I get without any problem the value of all the registers.

Note it does not seems to depends of the frequency of my requests (a few registers queried every 0,3 second per motor; increasing the period does not change anything), the only repeatable parameter seems to imply the compliant state.

My question is to know if I have a problem with my Ergo (should I perform a reset of something, or do once again the initialization step of the motors) or is it a limitation of the (cheap) motors of my Ergo??

Thank U in advance,

hello @Nikolaos,

it’s strange… can you send us your code so i can test it on my own robot.



Thanks for your help. Note everything is done with node.js…
here my code to perform request (4.8 KB)
U just have to edit the request.js and set the ip (do not use poppy.local here, it is not resolved.)

My modus operandi:
this code launch a lot of requests and is based on the axios module (and some wrappers but it is minimilastic)

1.1/ First, to ensure my code is ok and I’m not flooding the server:

  • I launch 2 instances of it (simply typing node .) and then do a lot of stuff “driving” programmatically the motoor i.e. sending requests to set registers next to set their compliant state to true => all is ok
    idem using the poppy-robot-core module => the axios and the poppy-robot-core packages do not seem to be responsible of this issue, or I think so.

If U check my code, I do not query temperature at this point.

1.2/ On a second hand, I uncomment the last line of request.js => we query temperature and perform the same operations as in point 1/ with only one instance of my code => quckly enough, the server does not respond and fall down :frowning:

2/ For the present_position “lag” about register value, It was simple to notice with the www poppy-robot-ui (but here we’ve a lot of things : axios, the poppy-robot-core module, vuejs, webpack to generate lib for browser, etc…) so it is not relevant to identify the problem (point 1/ is better).
Of course, I have the same behavior than point 1/

Another point, when performing a request on the ‘present_temperature’ register, we can observe a lag, small but this request (or at least obtaining the result) takes “times”.



So I probably (surely) was the issue: in post request:

  • I do not set headers to { ‘content-type’: ‘application/json’ },
  • I was sending all kind of values as string.

So It looks like it was working almost fine but I think I was bit by bit corrupting the registers until to reach a point of no return…

Fixing these two points seems to solve my problem.

Sorry that I have bother U with my wrong issues.


sorry because i didn’t have time these last days to test your code, i just overflying it … at first sight, everything seemed ok… I am happy that you could solved it alone!

thank you for your return

Hi once again

So this time I’ve got the solution and it will conclude this post (or I hope so).

Requesting the rest api was based on this documentation but it was not enough, especially about the type of data for post request to set register.

To conclude what’s happened:

  • For the compliant state posted data: I have replaced the data type from a boolean value to an integer set to 0/1,
  • For all posted numerical values (speed, position), I type have been changed from float to integer.

All is ok and all dysfunctionement disapears (that will do pig…)

Note the rest api exposed on 8080 does not warn/raise any error whatever the kind of value send.

To ensure all is ok this time , I have switched to the api exposed by snap on port 6969 and perform the same operations using url described here

=> all is ok.



So as explained before, all is ok, or almost: I have just noticed the point described below, and this, whatever the rest api used (from snap or pypot, but is there a big difference i.e. are they use the same part of code excepted the manner to perform request or the structure of result?)

So, when motors are ‘stiff’, the “lag” about the value of the ‘present_position’ register still occurs when leds are activated. Switching off leds and everything back to the ‘normal’. (and it does not occurs when motors are in compliant state.)
Note my color values for led are supposed ok (when wrong, everythings fails and I have to hard reboot my Ergo.)

Anyway, as it is a minor issue, I consider that’s now working fine :slight_smile:


1 Like