DEV Community

vmodal_ai
vmodal_ai

Posted on

Kotlin + NVIDIA Jetson: Building a Real-Time Robot Camera Dashboard

Kotlin + NVIDIA Jetson: Building a Real-Time Robot Camera Dashboard

This tutorial shows how Kotlin can provide a responsive Android dashboard while NVIDIA Jetson performs camera inference.

Architecture

Robot Camera
     ↓
 NVIDIA Jetson
     ↓
AI inference
     ↓
Detection metadata
     ↓
Robot Gateway
     ↓
Android Kotlin
Enter fullscreen mode Exit fullscreen mode

Sending detection metadata instead of every raw frame can reduce mobile bandwidth.

1. Define a detection model

data class Detection(
    val label: String,
    val confidence: Float,
    val x: Float,
    val y: Float,
    val width: Float,
    val height: Float
)
Enter fullscreen mode Exit fullscreen mode

2. Represent perception state

data class PerceptionState(
    val detections: List<Detection> = emptyList(),
    val inferenceMs: Long = 0
)
Enter fullscreen mode Exit fullscreen mode

Use StateFlow to expose state to Compose.

class PerceptionViewModel : ViewModel() {
    private val _state = kotlinx.coroutines.flow.MutableStateFlow(PerceptionState())
    val state = _state.asStateFlow()
}
Enter fullscreen mode Exit fullscreen mode

3. Process frames on Jetson

A typical pipeline is:

Camera
  ↓
ROS 2 image topic
  ↓
AI inference
  ↓
Detection / tracking
  ↓
JSON or protobuf result
  ↓
Gateway
Enter fullscreen mode Exit fullscreen mode

NVIDIA Isaac ROS includes GPU-accelerated perception packages designed for Jetson and ROS 2.

4. Display detections

Create an overlay composable using the normalized coordinates received from Jetson.

data class Box(
    val left: Float,
    val top: Float,
    val right: Float,
    val bottom: Float
)
Enter fullscreen mode Exit fullscreen mode

Normalize coordinates to the displayed image size so the UI remains resolution-independent.

5. Keep AI off the UI thread

Use coroutines and flows for network and state updates.

viewModelScope.launch {
    gateway.observeDetections().collect { detections ->
        _state.update { it.copy(detections = detections) }
    }
}
Enter fullscreen mode Exit fullscreen mode

6. Handle stale detections

Attach a timestamp or sequence number to every inference result. The Android client should discard old results rather than displaying stale robot perception.

7. Optimize bandwidth

Useful strategies include:

  • Send detection metadata rather than raw video
  • Reduce telemetry frequency
  • Compress snapshots
  • Use adaptive video quality
  • Separate video and command channels

Conclusion

This architecture keeps heavy AI computation on Jetson while Kotlin focuses on visualization and operator interaction.

References

Useful Links

Website: www.v-modal.com

SDK Flutter: https://github.com/v-modal/vmodal_sdk_flutter

SDK Android: https://github.com/v-modal/vmodal_sdk_android

Discord: https://discord.gg/K72z28KUx

Reddit: https://www.reddit.com/r/v_modal/

Top comments (0)