robotics-dev

1.0.8 • Public • Published

ROBOTICS.DEV App Builder

Run ROS2 AI robotics apps anywhere!

This Robotics SDK automatically connects to Robotics.dev and uses sockets to send and receive ROS2 messages between robots and cloud and/or edge servers. If the robot id is passed on the connect event, the SDK tries to establish a peer-to-peer session with the robot directly bypassing the cloud/edge server creating improved latency.

npm install robotics-dev

Cloud Usage:

//import robotics from 'robotics-dev';
const robotics = require('robotics-dev');
robotics.connect(); //robotics.connect({url: 'ws://192.168.0.47:3001'});

robotId = "3bbb40c5-...-58a12bc6893e"

robotics.twist(robotId, twist: {
    "linear": {"x": 0.20, "y": 0.0, "z": 0.0},
    "angular": {"x": 0.0, "y": 0.0, "z": 0.0}
})

robotics.speak(robotId, "beep boop"); // robot must have espeak installed (sudo apt install espeak)

robotics.subscribe(robotId, (imageData) => {
    console.log('Received image data:');
    console.log('- Base64 length:', imageData.base64.length);
    console.log('- First 100 chars:', imageData.base64.substring(0, 100));
    console.log('- Timestamp:', new Date().toISOString());
    console.log('-------------------');
});

Peer-to-Peer Usage:

//import robotics from 'robotics-dev';
const robotics = require('robotics-dev');
const robotId = "3bbb40c5-...-58a12bc6893e"

robotics.connect({robot: robotId}, (ros) => {
  var dataObj = JSON.parse(ros)
  console.log('Received p2p ROS2 data:', dataObj);
  if(dataObj.topic === "/camera2d"){
    // console.log("Base64 image: ", dataObj.data.data);
    robotics.speak(robotId, "beep boop"); // robot must have espeak installed (sudo apt install espeak)
    robotics.twist(robotId, twist: {
        "linear": {"x": 0.20, "y": 0.0, "z": 0.0},
        "angular": {"x": 0.0, "y": 0.0, "z": 0.0}
    })    
  }
});

See examples directory for demos.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.844latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.844
1.0.738
1.0.651
1.0.516
1.0.38
1.0.26
1.0.15
1.0.04

Package Sidebar

Install

npm i robotics-dev

Homepage

robotics.dev

Weekly Downloads

172

Version

1.0.8

License

MIT

Unpacked Size

10 kB

Total Files

7

Last publish

Collaborators

  • chrismatthieu