Skip to content

About

Develop applications and payloads for Spot using the unofficial Boston Dynamics Spot Node.js SDK.

Topics

Resources

Stars

6 stars

Watchers

3 watching

Forks

Repository files navigation

spot-sdk-js

npm version

The Node.js SDK of Spot, the robot of Boston Dynamics: an unofficial port of the official Python SDK.

It follows the Python SDK module by module (the behavior and the protobuf definitions of the Spot SDK 5.2.0): authentication, time sync, leases and E-Stop, power, robot commands, robot state, images, GraphNav, missions, autowalk, docking, data buffer and data acquisition, the services of payloads, Spot CAM, GPS, choreography, Orbit, BDDF files, a command line and TypeScript typings.

Documentation: guides and API reference in docs/ (npm run docs to browse them).

Install

npm install spot-sdk-js

Node.js 24 or later.

Example

const {
  LeaseClient,
  LeaseKeepAlive,
  RobotCommandBuilder,
  RobotCommandClient,
  blockingStand,
  createStandardSdk,
} = require('spot-sdk-js');

async function main() {
  const sdk = createStandardSdk('MyApp');
  const robot = sdk.createRobot('192.168.80.3');
  await robot.authenticate(process.env.BOSDYN_CLIENT_USERNAME, process.env.BOSDYN_CLIENT_PASSWORD);
  await (await robot.timeSync).waitForSync();

  const leaseClient = await robot.ensureClient(LeaseClient.defaultServiceName);
  const leaseKeepAlive = new LeaseKeepAlive(leaseClient, { mustAcquire: true, returnAtExit: true });
  await leaseKeepAlive.waitForInitialization();
  try {
    await robot.powerOn(20_000);
    const commandClient = await robot.ensureClient(RobotCommandClient.defaultServiceName);
    await blockingStand(commandClient, 10_000);
    await commandClient.robotCommand(RobotCommandBuilder.synchroSitCommand());
  } finally {
    await leaseKeepAlive.shutdown();
    robot.shutdown();
  }
}

main().catch(error => {
  console.error(error);
  process.exitCode = 1;
});

The robot needs an E-Stop to power on: the tablet, or the estop example. See Getting started for the details, and the examples.

Command line

npx spot-sdk-js --help
npx spot-sdk-js 192.168.80.3 id

Development

npm test               # the tests
npm run lint           # ESLint and Prettier
npm run build:typings  # the typings, from the JSDoc
npm run build:docs     # the typings, then the API reference of the documentation

See Development and the changelog.

License

This project is not affiliated with Boston Dynamics. See the LICENSE file.

About

Develop applications and payloads for Spot using the unofficial Boston Dynamics Spot Node.js SDK.

Topics

Resources

Stars

6 stars

Watchers

3 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages