Building a Kotlin Android Robot Control App with NVIDIA Jetson and ROS 2
A practical guide to building an Android operator app in Kotlin that communicates with a robot computer running on NVIDIA Jetson. The Android layer handles human interaction while Jetson and ROS 2 handle robotics workloads.
Architecture
Android / Kotlin
|
HTTPS / WebSocket / MQTT
|
Robot Gateway
|
ROS 2
|
NVIDIA Jetson
| | |
Vision Nav Control
|
Robot Hardware
1. Create the Android project
Create a Kotlin Android project and add lifecycle-aware coroutines and a networking library appropriate for your gateway.
data class RobotStatus(
val connected: Boolean,
val batteryPercent: Int,
val mode: String
)
2. Model robot commands
Keep the Android API small and explicit.
sealed interface RobotCommand {
data class SetVelocity(val linear: Double, val angular: Double) : RobotCommand
data object Stop : RobotCommand
}
3. Create a gateway client
The mobile application should communicate with a controlled gateway rather than exposing ROS 2 internals directly.
interface RobotGateway {
suspend fun send(command: RobotCommand)
fun observeStatus(): kotlinx.coroutines.flow.Flow<RobotStatus>
}
4. Expose ROS 2 commands
On the Jetson side, the gateway can translate an approved command into ROS 2 messages such as /cmd_vel. Keep validation and safety checks on the robot side.
Kotlin command
↓
Gateway validation
↓
ROS 2 /cmd_vel
↓
Safety controller
↓
Motor controller
5. Build the Kotlin UI
Jetpack Compose can represent connection, battery, robot mode, and control state.
@Composable
fun RobotStatusCard(status: RobotStatus) {
Column {
Text(if (status.connected) "Robot Online" else "Disconnected")
Text("Battery: ${status.batteryPercent}%")
Text("Mode: ${status.mode}")
}
}
6. Add an emergency-stop path
An emergency stop should not depend solely on Android. Provide a physical or robot-side safety mechanism and treat the mobile stop button as one additional command path.
7. Test failure conditions
Test:
- Network loss
- Gateway restart
- Stale commands
- Low battery
- Invalid commands
- Robot-side safety timeout
- Android process restart
Conclusion
Kotlin is a useful supervisory layer for Physical AI robots: Android provides the human interface while Jetson and ROS 2 perform compute-intensive robotics work. NVIDIA Isaac ROS provides CUDA-accelerated ROS 2 packages for perception and other robotics workloads.
References
- NVIDIA Isaac ROS: https://developer.nvidia.com/isaac/ros
- NVIDIA Isaac: https://developer.nvidia.com/isaac
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
Top comments (0)