DEV Community

vmodal_ai
vmodal_ai

Posted on

Kotlin Android Interface for NVIDIA Jetson AI Navigation

Kotlin Android Interface for NVIDIA Jetson AI Navigation

This tutorial builds a Kotlin supervisory interface for a robot whose navigation stack runs on NVIDIA Jetson.

Architecture

Kotlin Android
   ↓
Navigation API
   ↓
Jetson Gateway
   ↓
ROS 2 Navigation
   ↓
Localization + Planning
   ↓
Robot Base
Enter fullscreen mode Exit fullscreen mode

1. Define navigation commands

data class Pose2D(
    val x: Double,
    val y: Double,
    val yaw: Double
)

sealed interface NavigationCommand {
    data class GoTo(val pose: Pose2D) : NavigationCommand
    data object Cancel : NavigationCommand
}
Enter fullscreen mode Exit fullscreen mode

2. Send a goal

Android should send a high-level goal instead of directly controlling individual motors during autonomous navigation.

interface NavigationClient {
    suspend fun sendGoal(pose: Pose2D)
    suspend fun cancelGoal()
}
Enter fullscreen mode Exit fullscreen mode

3. Receive navigation state

enum class NavigationState {
    IDLE, PLANNING, MOVING, ARRIVED, FAILED
}
Enter fullscreen mode Exit fullscreen mode

Expose this through StateFlow.

4. Visualize a map

The Android UI can display:

  • Robot position
  • Goal position
  • Planned route
  • Obstacles
  • Localization state

The actual navigation computation remains on Jetson.

5. Add cancellation

Button(onClick = {
    viewModel.cancelGoal()
}) {
    Text("Cancel Navigation")
}
Enter fullscreen mode Exit fullscreen mode

Cancellation should be sent to the robot navigation stack and confirmed by a robot-side state update.

6. Handle navigation failures

Examples:

NO_LOCALIZATION
GOAL_BLOCKED
PLANNER_FAILED
ROBOT_TIMEOUT
SAFETY_STOP
Enter fullscreen mode Exit fullscreen mode

Do not turn these into generic "failed" messages; meaningful error states make robot operations easier to diagnose.

Conclusion

Kotlin works well as a human-facing navigation layer while Jetson and ROS 2 execute perception, localization, planning, and control.

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)