Run 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
Usage:
const robotics = require('robotics-dev');
robotics.connect(); //robotics.connect({url: 'ws://192.168.0.47:3001', robot: '3bbb40c5-3823-42d2-94ff-58a12bc6893e'});
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.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('-------------------');
});
See examples directory for demos.