Client side command line and scripting tooling for the Poppy (Ergo Jr)

english
software
ergo-jr
Tags: #<Tag:0x00007f5ceaca6798> #<Tag:0x00007f5ceaca6400> #<Tag:0x00007f5ceaca5398>

#1

Hi all,

Starting with the Poppy Ergo Jr and not really comfortable with any UI approach about programming, in particular through web browser (Snap, not to mention names), I have developped a new client side tool intended to simply and programmatically drive the Poppy Ergo Jr.

It allows:

  • First, querying and sending basic set of instructions to the motor registries and then, to perform unary ‘action’ on motors such as move, speed settings, simply typing in a command line terminal,
  • On a second hand, combining these basic instructions in order to test more complex motions writing some simple scripts from any text editor, and then to be able to “execute” them to the robot.

It acts as a pure client side which only requires to be installed on your local computer (the poppy ergo jr is seen as a black box.)

As example, in command line mode, typing in a terminal:

poppy exec rotate -m m1 m2 -v -30

will rotate by 30 degrees the motors m1 and m2.

And here a script example:

let script = P.createScript()
    .select('all') // Select all motors
    .compliant(false) // Make them "drivable"
    .speed(150) // Set their speed
    .position(0) // and move all motors to position 'O' degree.
    .select('m1','m2') // Next select only the motors 'm1' and 'm2'...
    .rotate(30) // and apply them a rotation by +30 degrees.
;

From a technical point of view, this project has been developped in node.js/javascript and it is intended to run whatever the OS i.e. Windows, Linux and MacOS. It communicates with the robot through the REST API served by the pypot http server.

As I think the maturity of this project is good i.e. stable and exploitable by other users
as well as it could be useful, I have published it on github at the following URL:

https://github.com/nbarikipoulos/poppy-robot-client

It is provided with:

  • An exhaustive documentation which:
    • Aims to drive the users although ones without any skill in node.js/javascript (it embeds all details about installation, use, etc for newbees),
    • Describes all the implemented features,
  • some examples about scriptings, introducing some good practices (or I hope so ;).

Interested people could consult the full documentation on github.

I Hope it could be useful to others and any feedbacks are welcome.

Enjoy,
N.


Controle des moteurs avec invite de commande
#2

Oooh, it sounds really great, a real JS biding to the API. It could also be used to build other web tools morea easily.
Thank you very much !


#3

Poppy says:


#4

Hi,

First, thanks for all theses greetings, I feel a bite confuse and glade that it could be useful :slight_smile:


About using this library as basis for “webtooling” or others, note this project could be easily divided in 2 independents npm modules:

  • A core part about poppy-like robot (located in the lib and config folders),
  • The CLI part, dedicated to the front-end in terminal.

As, from a software ‘architecture’ point of view, it should be done :), I could/would probably do it.

About the notion of “webtooling”, if your aim is to use it at a js library in browser, it should be possible: as the core ‘part’ in almost in vanillaJS and only depends on the axios module (for requests) which is available as both a node module and an independent js library integrable in browser. It just asks to wrap the code to be able to ‘transform’ it from a commonJS module to a simple js library. I have no experience on it, and developing for browser side always sounds painful for me due to the ECMAScript compatibility and others… Yes I love both es6 and back-end side. And when I think about it, there is some code I am using (await/async) which are ECMAScript 2017 features then browser compatibility is not ensured/have to be checked.

To conclude, note splitting the project in two sub-modules does not sound “useful” from my side, let me know if it could be useful for U.


Next to your first remarks, I aim to simplify/describe the use of this work with another poppy family robot/configuration.
About it, there is 3 points (or I think so):

  • Of course, exposing in nicer way the fact to be able to provide our own robot “descriptor” json (it nowadays done only for the Poppy Ergo Jr),
  • Discovering the robot configuration,
  • May be to introduce the notion of group of motor (aka alias in poppy terminology) which one was not really useful with the Ergo Jr (only 6 motors to manage).

Points 1 and 2 could be done easily (and must be done). Everything is nowadays ready, but playing with it is a bite rough as no jsdoc are provided and this first release was dedicated to “simple” Poppy Ergo Jr users i.e. configuring the robot context is not exposed how it should be i.e. in a clear, simple and nice way.

About point 3:

  • Introducing alias could allow selecting group of motor instead of the nowadays provided “binary” approach ‘all’ or a bunch of motors listed by users,
  • From a “philosophical” point of view (sic), this notion of alias exists and then something is missing is my code to fit/describe the poppy and then, it should be present.

N.


#5

Hi,

I have published a new release of this project that is mainly dedicated to open it to another configuration than Poppy Ergo Jr, the 2.0.0 version.
It mainly allows:

  • Live discovering of the robot configuration, i.e. to discover the motor list,
  • Saving it, and then to use it…

Note a jsdoc is now provided.

Users can read the release note on github for further details.

I have only tested it with my (poor) Poppy Ergo Jr but it should work with any configuration driven by the pypot library…

… or I hope so. Feel free to send me a Torso or Poppy to test it :smiley:

N.