keepcalculator

06 Numbers and Powers

Flutter Robot Interfaces with ROS 2 and NVIDIA Isaac

Card No. 06·49703 · Updated · Standard formula, shown below

Update period 0.100 s
Distance per update
0.100 m
Result
Update rate (Hz)
10 Hz
You entered
Robot speed (m/s)
1 m/s
You entered
You enter
Update rate (Hz), Robot speed (m/s)
You get
Update period, Distance per update
Rounding
3 dp

This article explains a practical architecture for building Flutter-based robot interfaces that communicate with ROS 2 and leverage NVIDIA Isaac for accelerated perception and simulation. You will learn the core communication patterns, how to structure the Flutter app, and how to integrate it with ROS 2 and Isaac Sim or Isaac ROS.

Formula

The update period P is the reciprocal of the update rate f: P = 1 / f. The distance traveled per update D is the robot speed v multiplied by the period: D = v × (1 / f). In the calculator, f is in hertz (updates per second), v is in meters per second, P is in seconds, and D is in meters.

Worked Example

With the default values of f = 10 Hz and v = 1.0 m/s:

  • Period: P = 1 / 10 = 0.1 s
  • Distance per update: D = 1.0 × 0.1 = 0.1 m

The calculator shows 0.100 s and 0.100 m, matching the formula.

Why Flutter for Robot UIs?

Flutter is a cross-platform UI toolkit that compiles to native code for Android, iOS, web, Windows, macOS, and Linux. For robot interfaces, it offers a single codebase for a touchscreen tablet, a desktop teleop station, and a web-based monitoring dashboard. Its reactive widget tree and rich animation support make it well-suited for real-time sensor visualizations, joystick controls, and status dashboards. Unlike web-only frameworks, Flutter can maintain a persistent WebSocket or UDP connection without a browser tab throttling background tasks.

Core Communication Patterns

ROS 2 uses a distributed publish-subscribe model with nodes communicating over DDS (Data Distribution Service). A Flutter app cannot directly use the ROS 2 client library because it is not implemented in Dart. The standard solution is to run a ROS 2 bridge node that translates between ROS 2 topics and a lightweight protocol the Flutter app can consume, typically JSON over WebSocket, MQTT, or protobuf over TCP/UDP.

The recommended architecture has three layers:

  • Robot layer: ROS 2 nodes for control, perception, and navigation, possibly using NVIDIA Isaac ROS for GPU-accelerated perception (e.g., object detection, stereo depth, path planning).
  • Bridge layer: A ROS 2 node (written in C++ or Python) that subscribes to necessary topics and republishes them as JSON messages over WebSocket (using a library like rosbridge_suite) or as protobuf over a custom TCP socket. This node also receives commands from the Flutter app and publishes them to ROS 2 topics.
  • Client layer: The Flutter app, which uses a WebSocket or socket library to connect to the bridge, parse JSON messages, and update the UI.

For low-latency teleoperation, consider a separate UDP channel for high-frequency joystick commands, while using WebSocket for status and visualization. The bridge node can also compress image topics (e.g., JPEG or H.264) to reduce bandwidth.

Integrating NVIDIA Isaac

NVIDIA Isaac provides two complementary tools: Isaac ROS, a collection of GPU-accelerated ROS 2 packages, and Isaac Sim, a simulation environment built on Omniverse. Isaac ROS packages (e.g., isaac_ros_detectnet for object detection, isaac_ros_stereo_depth for depth estimation) run as ROS 2 nodes and publish standard message types like sensor_msgs/Image and vision_msgs/Detection2DArray. The Flutter app does not need to know whether the data comes from a real sensor or a simulation; it simply receives the same topic messages via the bridge.

In a typical setup, Isaac Sim runs on a separate workstation or server, publishing simulated sensor data and accepting velocity commands. The same bridge node can connect to the simulation topics, allowing the Flutter app to control a simulated robot and visualize its camera feed. This is useful for testing the UI without physical hardware.

Practical Architecture Example

Consider a mobile robot with a camera, a LiDAR, and a differential drive base. The ROS 2 graph includes nodes for the driver, a SLAM algorithm, a navigation stack, and an Isaac ROS object detection node. The bridge node subscribes to:

  • /camera/image_raw (sensor_msgs/Image) – compress and send as JPEG over WebSocket.
  • /scan (sensor_msgs/LaserScan) – convert to a JSON array of ranges.
  • /odom (nav_msgs/Odometry) – extract position and orientation.
  • /detections (vision_msgs/Detection2DArray) – send bounding boxes and labels.
  • /map (nav_msgs/OccupancyGrid) – send a downsampled version for display.

The bridge also subscribes to a custom topic /flutter/cmd_vel that the Flutter app publishes as JSON, converts it to geometry_msgs/Twist, and republishes to /cmd_vel.

In Flutter, you can use packages like web_socket_channel for WebSocket, image for decoding JPEG frames, and custom_paint for drawing LiDAR scans or occupancy grids. For teleop, use a GestureDetector or a custom joystick widget that sends velocity commands at a fixed rate (e.g., 10–30 Hz).

Choosing the Right Bridge and Protocol

The choice of bridge depends on your latency, bandwidth, and complexity needs:

  • rosbridge_suite (ROS 2 version): Provides a WebSocket server that translates ROS 2 messages to JSON. It is easy to set up and works with any WebSocket client. However, it adds overhead and may not be suitable for high-frequency control.
  • Custom TCP/UDP bridge: Write a simple ROS 2 node that serializes messages using protobuf or FlatBuffers. This gives lower latency and smaller payloads, but requires more development effort.
  • MQTT bridge: Use an MQTT broker (e.g., Mosquitto) to relay messages between ROS 2 and Flutter. This is useful for distributed systems or when you need message persistence, but adds another component.

For most applications, starting with rosbridge_suite is recommended because it is well-documented and avoids custom serialization. If you need real-time control (e.g., for a manipulator arm), a custom UDP bridge is better.

Common Pitfalls and How to Avoid Them

  • Ignoring network latency: If the Flutter app and the robot are on different networks, use a wired Ethernet or a dedicated 5 GHz Wi-Fi. Test the round-trip time before finalizing the architecture.
  • Sending full-resolution images: Compress images to JPEG or H.264 and downscale them. A 1080p raw image at 30 fps is huge; even compressed, it may saturate Wi-Fi.
  • Blocking the UI thread: Do not parse JSON or decode images on the main isolate. Use compute() or an isolate for heavy tasks.
  • Not handling disconnects: Implement reconnection logic in Flutter and a watchdog on the bridge to detect stale connections.
  • Assuming ROS 2 message types are trivial: Some messages (e.g., nav_msgs/OccupancyGrid) have large arrays. Use efficient serialization and only send updates when they change.

Frequently Asked Questions

Can Flutter connect directly to ROS 2 without a bridge?

No, because ROS 2 client libraries are not available in Dart. You need a bridge node that translates between ROS 2 and a protocol Flutter can use, such as WebSocket or UDP.

What is the best protocol for teleoperation?

For low-latency teleop, a UDP socket with a simple binary protocol (e.g., two float values for linear and angular velocity) is best. WebSocket is fine for status and visualization but adds overhead for high-frequency commands.

How do I display camera feed in Flutter?

Use a WebSocket to receive JPEG frames (as base64 or binary) and decode them with the image package, then display with Image.memory. For H.264, use a video player plugin that supports streaming.

Does NVIDIA Isaac Sim work with Flutter?

Yes, Isaac Sim publishes ROS 2 topics, so the same bridge works. You can connect the Flutter app to the simulation exactly as you would to a real robot, which is useful for UI development and testing.

Can I use Flutter for a web-based robot dashboard?

Yes, Flutter for web works, but be aware of browser limitations: WebSocket connections may be throttled in background tabs, and some packages (like those for video streaming) may not work on all browsers.

What is the latency of a typical WebSocket bridge?

On a local network, round-trip latency is typically 5–20 ms, which is acceptable for most monitoring and non-critical control. For high-speed control, use a UDP bridge to reduce overhead.

Related

Formula used
in t | Update rate (Hz) | Hz | 10 | 1 | 100
in d | Robot speed (m/s) | m/s | 1.0 | 0 | 100
out period | Update period | s | 1 / t | 3
out dist | Distance per update | m | d * (1 / t) | 3

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →