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

node-jimu

v0.1.1

Published

This is a quick and dirty lib to control the Ubtech robots. I bought an Astrobot kit to teach some coding concepts to my daughter, and despite that the mobile app is great I wanted to have the possibility to work with it from a mac or PC. Spoofing the Blu

Downloads

12

Readme

NODE-JIMU

This is a quick and dirty lib to control the Ubtech robots. I bought an Astrobot kit to teach some coding concepts to my daughter, and despite that the mobile app is great I wanted to have the possibility to work with it from a mac or PC. Spoofing the Bluetooth communication from the app with the robot I was able to figure out some parts of the communication protocol.

Disclaimer: I have no affiliation with Ubtech and the intention of this lib is to get even more from these awesome robotics kits.

Compatibilty

For now this code is to control the astrobot model

Installation

yarn add node-jimu or npm install node-jimu

Usage

import { Communication, Commands, delay } from "node-jimu";

const comm = new Communication("My_Jimu_CA15"); // name of the robot as seen in jimu app
const robot: Commands = new Commands(comm);

comm.connect(async () => {
  // // enable predefined animation for the eyes: red, green, blue, animation (0 - 15), eye (1, 2 or 3 for both)
  await robot.setEyesAnimation(253, 158, 254, 1, 3, 1);

  // set servo positions central, left arm, right arm, speed
  await robot.setPosition(205, 120, 120, 20);
  await delay(4000);

  // enable predefined animation for the eyes: red, green, blue, animation (0 - 15), eye (1, 2 or 3 for both)
  await robot.setEyesAnimation(253, 158, 254, 6, 3, 3);

  // set servo positions central, left arm, right arm, speed
  await robot.setPosition(190, 120, 120, 10);
  await delay(2000);

  // set eyes color red, green, blue, eye (1, 2 or 3 for both), time
  await robot.setEyes(0xff, 0x04, 0x04, 3, 60);
  await delay(2000);

  // set position again
  await robot.setPosition(220, 140, 100, 44);
  await delay(1000);

  // set wheels speed (sadly, it seems like you only can do it individually )
  await robot.setSpeed(1, 2, 0x92);
  await robot.setSpeed(2, 1, 0x92);

  await delay(2000);

  // full stop!
  await robot.stop();

  await delay(100);
  // disconnect
  comm.disconnect();

  // close
  process.exit(0);
});

Reading data

import { Communication, Commands, delay } from "node-jimu";

const comm = new Communication("My_Jimu_CA15"); // name of the robot as seen in jimu app
const robot: Commands = new Commands(comm);
comm.setDebug(true);

comm.connect(async () => {
  try {
    // get servo positions
    const p = await robot.getPosition();
    console.log("position", p);

    // get sensors data
    const s = await robot.getSensors();
    console.log("sensors", s);
  } catch (error) {
    console.log(error);
  }

  // disconnect
  comm.disconnect();

  // close
  process.exit(0);
});