Skip to content

Getting Started

This guide will help you set up and start using the Roboscope 2 platform.

  • PostgreSQL 14 or later
  • Redis 7 or later
  • Rust 1.70+ (for API server)
  • Git
  • macOS 13+ (Ventura or later)
  • Xcode 15+
  • iOS Device with LiDAR (iPhone 12 Pro+, iPad Pro 2020+)
  • iOS 17+
  • Swift 5.9+
Terminal window
git clone https://github.com/your-org/roboscope_2.git
cd roboscope_2/roboscope_2_api
Terminal window
# Install PostgreSQL (macOS)
brew install postgresql@14
brew services start postgresql@14
# Create database
createdb roboscope_dev
# Install PostGIS extension
psql roboscope_dev -c "CREATE EXTENSION IF NOT EXISTS postgis;"
Terminal window
# Install Redis (macOS)
brew install redis
brew services start redis
Terminal window
# Copy example environment file
cp .env.example .env
# Edit .env with your settings
DATABASE_URL=postgresql://localhost/roboscope_dev
REDIS_URL=redis://localhost:6379
PORT=8080
RUST_LOG=info
Terminal window
# Install sqlx-cli
cargo install sqlx-cli --no-default-features --features postgres
# Run migrations
sqlx migrate run
Terminal window
# Development mode (with auto-reload)
cargo watch -x run
# Or standard run
cargo run

The API will be available at http://localhost:8080

Terminal window
# Health check
curl http://localhost:8080/health
# Expected response:
# {"status":"healthy","database":"connected","redis":"connected"}
Terminal window
./scripts/seed-dev.sh
Terminal window
cd roboscope_2/roboscope_2_ios
open roboscope2.xcodeproj

The project uses Swift Package Manager. Dependencies should resolve automatically in Xcode.

If needed, manually resolve:

File → Packages → Resolve Package Versions

Edit roboscope2/Services/Network/APIConfiguration.swift:

struct APIConfiguration {
static var shared = APIConfiguration()
// Change to your API server URL
var baseURL: String {
switch environment {
case .development:
return "http://localhost:8080/api/v1" // Local dev
case .production:
return "https://api.roboscope.example.com/api/v1"
}
}
var environment: Environment = .development
}
  1. Select the project in Xcode navigator
  2. Select roboscope2 target
  3. Go to Signing & Capabilities
  4. Select your Team
  5. Xcode will automatically manage provisioning
  1. Connect your LiDAR-enabled iOS device
  2. Select device in Xcode
  3. Press Cmd+R to build and run

On first launch, grant:

  • Camera access (required for AR)
  • Local Network access (required for API communication)
Terminal window
curl -X POST http://localhost:8080/api/v1/spaces \
-H "Content-Type: application/json" \
-d '{
"key": "my-room",
"name": "My First Room",
"calibration_vector": [0, 0, 0]
}'

Response will include the space id. Save it for next steps.

Terminal window
curl -X POST http://localhost:8080/api/v1/work-sessions \
-H "Content-Type: application/json" \
-d '{
"space_id": "YOUR_SPACE_ID",
"session_type": "inspection",
"status": "active",
"started_at": "2025-01-16T10:00:00Z"
}'

Response will include the session id.

Terminal window
curl -X POST http://localhost:8080/api/v1/markers \
-H "Content-Type: application/json" \
-d '{
"work_session_id": "YOUR_SESSION_ID",
"label": "Test Marker",
"p1": [0.0, 0.0, 0.0],
"p2": [0.1, 0.0, 0.0],
"p3": [0.1, 0.1, 0.0],
"p4": [0.0, 0.1, 0.0],
"color": "#FF0000",
"custom_props": {
"severity": "medium",
"type": "test"
}
}'
Terminal window
curl -X POST http://localhost:8080/api/v1/markers/YOUR_MARKER_ID/details/calculate
Terminal window
curl "http://localhost:8080/api/v1/markers?work_session_id=YOUR_SESSION_ID"
  • Tap Spaces tab
  • Tap + button
  • Enter space name and details
  • Tap Save
  • Select your space
  • Tap Sessions tab
  • Tap New Session
  • Choose session type
  • Tap Start
  • In active session, tap AR View
  • Point device at target surface
  • Tap and drag to define marker corners
  • Release to create marker
  • Add label and properties
  • Tap on a marker in the list
  • View calculated metrics:
    • Center location
    • Dimensions
    • Distances
  • Edit custom properties
Terminal window
cd roboscope_2/roboscope_2_portal
Terminal window
npm install
# or
pnpm install

Edit .env.local:

Terminal window
NEXT_PUBLIC_API_URL=http://localhost:8080/api/v1
Terminal window
npm run dev
# or
pnpm dev

Open http://localhost:3000 in your browser.

  • Browse spaces and sessions
  • View markers with 3D visualization
  • Export/import sessions
  • Real-time presence tracking
  • Marker analytics and reports
Terminal window
# Drop all tables
sqlx database drop
sqlx database create
sqlx migrate run
Terminal window
# API logs
cargo run # Logs to stdout
# iOS logs
# In Xcode: View → Debug Area → Show Debug Area
Terminal window
# API tests
cargo test
# iOS tests (in Xcode)
# Product → Test (Cmd+U)
Terminal window
# API
cargo clean
# iOS (in Xcode)
# Product → Clean Build Folder (Cmd+Shift+K)
Terminal window
# Watch mode (auto-reload on changes)
cargo watch -x run
# Run specific test
cargo test test_name
# Check code
cargo clippy
# Format code
cargo fmt
Terminal window
# Build
Cmd+B
# Run on device
Cmd+R
# Run tests
Cmd+U
# Clean build folder
Cmd+Shift+K
Terminal window
# Create new migration
sqlx migrate add migration_name
# Run migrations
sqlx migrate run
# Revert last migration
sqlx migrate revert
Terminal window
# Check PostgreSQL is running
brew services list | grep postgresql
# Test connection
psql roboscope_dev -c "SELECT 1"
Terminal window
# Check Redis is running
brew services list | grep redis
# Test connection
redis-cli ping
# Expected: PONG
  1. Clean build folder: Cmd+Shift+K
  2. Delete Derived Data: Xcode → Preferences → Locations → Derived Data → Delete
  3. Reset Package Cache: File → Packages → Reset Package Caches
  1. Check API is running: curl http://localhost:8080/health
  2. Use correct IP address (not localhost) in iOS
  3. Ensure both devices on same network
  4. Check firewall settings
  1. Verify device has LiDAR (iPhone 12 Pro+, iPad Pro 2020+)
  2. Check camera permissions granted
  3. Ensure good lighting
  4. Update to latest iOS version

For questions or issues:

  • Open an issue on GitHub
  • Check existing documentation
  • Review code examples in /specs/examples/