npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

poppy-robot-core

v12.0.1

Published

Remotely drive/query Poppy/Poppy Ergo Jr robots.

Downloads

155

Readme

Poppy Robot Core

NPM version JavaScript Style Guide Language grade: JavaScript Maintainability

This module is dedicated to remotely drive/query robots of the Poppy project family.

Below a script example and its execution:

const { createPoppy, createScript } = require('poppy-robot-core')

const script = createScript()
  .select('all') // Select all motors
  .speed(150) // Set their speeds
  .stiff() // Make them programmatically "drivable"
  .goto(0, 5, true) // Then move them to '0' degree in 5s, awaiting the end of movement
  .select('m1') // Select 'm1'
  .goto('150', 1) // And send instruction to move it to 150 degrees in 1s without awaiting the end of the movement
  .select('m6') // Select motor 'm6'
  .rotate(90, 0.5, true) // And rotate it by +90 degrees in half of second.
  .rotate(-90, 0.5) //...

createPoppy().then(async poppy => {
  await poppy.exec(script)
  // Other nice stuff with the poppy instance, next to this script execution
  ...  
})

Next an example of querying registers:

const { createPoppy } = require('poppy-robot-core')

createPoppy().then(poppy => poppy.query({
  motors: ['m1', 'm2'],
  registers: ['present_position', 'goal_position']
})).then(console.log)
// will display
// {
//   m1: {present_position: 10, goal_position: 80},
//   m2: {present_position: 0, goal_position: -90},
// }

It has been done aiming to easily and automatically connect to any kind of/configuration of robot driven by the pypot library (a live discovering of the targeted robot is performed in order to get its structure aka aliases and motors).

Note this module is based on the REST API exposed by the pypot library and then, depends on its release (see prerequisite).

Table of Contents

Prerequisite

This module requires the pypot REST API v4.0.0 aka Poppy software ^v4.0.0 installed on robot.

Install

npm i poppy-robot-core

Configuring Connection to Poppy

By default, the poppy robot core performs a live discovering of the target robot using default connection settings for a Poppy Ergo Jr aka setting are respectively set to 'poppy.local' and 8080 for host and port for the pypot REST API.

Users can easily set their own settings through optional arguments of the createPoppy factory.

const { createPoppy } = require('poppy-robot-core')

const config = {
  host: poppy1.local,
  port: 8081
}

const poppy = createPoppy(config)

Refer to the module API for further details or, in an easier way, users can use the poppy-robot-cli module that re-export api of this module and provides a set of additional functionalities for such purpose (flags automatically appended to the node command line to set hostname/port or using a config file to store them).

Writing Scripts

The poppy robot core module is provided with a script execution engine and then, users, can write their own scripts to test complex combination of actions.

Such scripts are written in javascript language but all technical 'difficulties' have been hidden as much as possible and then, it allows users writing their own scripts without any particular knowledges/skills on javascript.

A set of examples of scripts are available into a dedicated repository. In this case too, their javascript-technical matters have been reduced insofar as possible or explained when needed.

At last, users can refers to the Script API for further details.

Examples

A set of scripts are available into a dedicated repository.

API

See API.md for more details.

Known Limitations

  • This module have been only tested with the Poppy Ergo Jr (aka with a set of dynamixel XL-320). As it communicates with the robot via the REST API of the pypot library, it should work with any robots of the poppy family.

  • position/rotate functions of Script/ExtMotorRequest: Awaiting end of movement i.e. setting the 'wait' argument to 'true' is based on the velocity of dynamixel XL-320 in order to compute/estimate the movement duration. The value is 0.666 degree per second (see documentation).

Credits

License

The poppy-robot-core is MIT licensed. See LICENSE.