Development Environments
The OLO SDK supports two primary development approaches, each optimized for different use cases:
SDK Playground - Browser-Based Development Environment
The SDK Playground is an integrated browser-based development environment that provides a complete robot programming experience without any local setup. It's designed for modular execution and rapid prototyping.
Key Features:
- Browser-Based - No local installation required, runs entirely in your browser
- Live Execution - Real-time code execution with immediate feedback
- Integrated AI Assistant - Built-in AI coding assistant with context awareness
- Live Video Streaming - Real-time robot camera feeds with WebRTC
- Script Management & Orchestration - Save, load, schedule, and orchestrate your robot programs
- Rich Output Panel - Comprehensive logging and debugging information
- Multi-Language Support - Both JavaScript and Python execution
Why SDK Playground?
Beyond interactive development, the SDK Playground enables production automation workflows:
- Script Composition - Scripts can call other scripts, enabling modular, reusable robot behaviors
- Global Variables - Cross-script state sharing via persistent key-value storage on the appliance
- External Triggering - Standalone clients can invoke saved scripts, integrating robots with external systems
- Scheduled Execution - Run scripts at specific times or intervals directly on the appliance
Develop interactively, save as reusable components, then orchestrate through scheduling or external triggers.
Asynchronous Programming in SDK Playground
The SDK Playground operates in an asynchronous execution environment, which means all API calls to the robot return JavaScript Promises that must be properly handled using await or .then() syntax. This asynchronous design is essential for robot programming because:
- Non-blocking Operations - Robot commands (movement, sensor readings, video streaming) take time to complete and shouldn't freeze the user interface
- Real-time Responsiveness - Multiple operations can run concurrently (e.g., streaming video while controlling movement)
- Cancellable Operations - Long-running operations can be interrupted using the stop button or abort signals
Key Concepts:
All API calls are asynchronous and return Promises:
// ✅ Correct - using await
const topics = await oloClient.core.listTopics();
console.log('Available topics:', topics);
// ✅ Also correct - using .then()
oloClient.core.listTopics().then(topics => {
console.log('Available topics:', topics);
});
// ❌ Wrong - missing await
const topics = oloClient.core.listTopics(); // This returns a Promise, not the actual data
console.log(topics); // Will log: Promise<pending>Sequential vs. Parallel Operations:
// Sequential execution - operations run one after another
await oloClient.core.moveFor({ linear: 0.5 }, 2000);
await oloClient.core.moveFor({ angular: 0.5 }, 2000);
// Parallel execution - operations run simultaneously
await Promise.all([
oloClient.video.startVideo('/camera/image_raw'),
oloClient.core.subscribe('/sensor_data', handleSensorData)
]);Error Handling with async/await:
try {
await oloClient.core.moveFor({ linear: 0.5 }, 5000, { abortSignal });
console.log('Movement completed successfully');
} catch (error) {
if (error.message === 'Aborted') {
console.log('Movement was cancelled by user');
} else {
console.error('Movement failed:', error);
}
}Abort Signals for Cancellable Operations:
The SDK Playground automatically provides an abortSignal that's connected to the stop button. This allows users to safely interrupt long-running operations:
// The abortSignal is automatically available in playground examples
await oloClient.core.moveFor({ linear: 0.5 }, 10000, { abortSignal });
// This movement can be stopped mid-execution using the stop buttonImportant Notes:
- All examples in the SDK Playground assume an async execution context and use
await - The playground handles the top-level async execution automatically - you don't need to wrap your code in an
async function - Python users: Use
awaitdirectly, NOTasyncio.run()- you're already inside an async context. Usingasyncio.run()will cause an error: "asyncio.run() cannot be called from a running event loop" - JavaScript users: Use
awaitdirectly without wrapping in an async IIFE - the playground handles this automatically - When copying code to standalone applications, ensure you're in an async context or use
.then()syntax - Always handle errors appropriately, especially for robot safety operations
Standalone Clients - External Development
Standalone clients use the downloadable OLO SDK (JavaScript or Python) to build custom applications in your own development environment. You handle authentication, robot discovery, and connection management programmatically.
Use Cases:
- Custom user interfaces and dashboards
- Integration with existing enterprise systems (ERP, WMS, MES)
- Automated pipelines and CI/CD workflows
- Triggering SDK Playground scripts from external events
- Applications requiring specific frameworks or dependencies
Standalone clients can work alongside the SDK Playground - use the Playground to develop and save robot behaviors, then invoke them from your standalone application.
Choosing the Right Approach
SDK Playground is the recommended starting point for most use cases:
- Rapid development without local installation
- AI-assisted coding and debugging
- Scripts run on the appliance for best performance
- Built-in orchestration: scheduling, script chaining, global variables
- External systems can trigger saved scripts via API
- Ideal for both prototyping and production automation
Standalone Clients are better when you need:
- Custom user interfaces or specialized visualization
- Integration deeply embedded in existing applications
- Full control over the runtime environment
- Specific frameworks, libraries, or deployment requirements
Many production deployments use both: SDK Playground for robot-side logic and orchestration, standalone clients for custom interfaces and external system integration.
