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??
Thanks for your help. Note everything is done with node.js…
here my code to perform request test_request_poppy.zip (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
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”.
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!
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