ros2_flutter library
Flutter widgets for ROS 2, built on package:ros2_client.
Wrap your app in a RosConnection and the rest of the widgets find the client automatically:
RosConnection(
uri: Uri.parse('ws://192.168.1.10:9090'),
child: Scaffold(
body: Column(children: [
const Expanded(child: RosLaserScanView()),
RosTopicBuilder<BatteryState>(
topic: '/battery_state',
builder: (context, b) =>
Text(b == null ? '—' : '${(b.percentage * 100).round()}%'),
),
const TeleopJoystick(),
]),
),
)
Classes
-
ActionCodec<
Goal, Feedback, Result> - Converter for a ROS 2 action's goal/feedback/result triple.
- ActionRegistry
- Registry of action codecs, keyed by Dart goal type.
- Backpressure
- What to do with messages that arrive while the consumer is busy.
- BatteryState
-
sensor_msgs/msg/BatteryState. - BoolMsg
-
std_msgs/msg/Bool. - ColorRGBA
-
std_msgs/msg/ColorRGBA. - CompressedImage
-
sensor_msgs/msg/CompressedImage— usually the cheapest way to stream a camera to a UI, since the payload is already JPEG/PNG and can be handed straight to a FlutterRosImage.memory. - EmptyMsg
-
std_msgs/msg/Empty. - Field
- Field decoding helpers shared by all generated message classes.
- Float64Msg
-
std_msgs/msg/Float64. -
GoalHandle<
Feedback, Result> - A handle to an in-flight action goal.
- Header
-
std_msgs/msg/Header. - Imu
-
sensor_msgs/msg/Imu. - Int32Msg
-
std_msgs/msg/Int32. - JointState
-
sensor_msgs/msg/JointState. - JsonMessage
- An untyped message: a plain rosbridge JSON map.
- LaserScan
-
sensor_msgs/msg/LaserScan. - MapMetaData
-
nav_msgs/msg/MapMetaData. -
MessageCodec<
T> -
Bidirectional converter between a Dart type
Tand the rosbridge wire form. - MessageRegistry
- Global registry of message codecs.
-
sensor_msgs/msg/NavSatFix. - NodeInfo
- What a node publishes, subscribes to and serves.
- OccupancyGrid
-
nav_msgs/msg/OccupancyGrid. - Odometry
-
nav_msgs/msg/Odometry. - Point
-
geometry_msgs/msg/Point. - PointCloud2
-
sensor_msgs/msg/PointCloud2. - PointCloudReader
- Reads values out of a PointCloud2's packed buffer in place.
- PointField
-
Registers every
sensor_msgscodec.sensor_msgs/msg/PointField— one channel in a PointCloud2's blob. - Pose
-
geometry_msgs/msg/Pose. - PoseStamped
-
geometry_msgs/msg/PoseStamped. - QosProfile
- A ROS 2 Quality of Service profile.
- Quaternion
-
geometry_msgs/msg/Quaternion. - ReconnectPolicy
- Controls retry timing after an unexpected disconnect.
- Ros2Client
- A ROS 2 client speaking the rosbridge v2 protocol.
- RosCameraView
-
Displays a
sensor_msgs/msg/CompressedImagetopic. - RosConnection
- Owns a Ros2Client and exposes it to the widget subtree.
- RosConnectionBuilder
- Rebuilds as the connection state changes.
- RosDuration
-
builtin_interfaces/msg/Duration. - RosImage
-
sensor_msgs/msg/Image. - RosLaserScanView
-
A top-down plot of a
sensor_msgs/msg/LaserScan. - RosMessage
- Marker for a generated (or hand-written) ROS 2 message type.
- RosPath
-
nav_msgs/msg/Path. -
RosPublisher<
T> - A typed publisher bound to one topic.
- RosRawImageView
-
Displays a raw
sensor_msgs/msg/Imagetopic. - RosStatus
- A diagnostic message emitted by the rosbridge server.
- RosTime
-
builtin_interfaces/msg/Time. -
RosTopicBuilder<
T> - Subscribes to a topic and rebuilds on each message.
- RosTransform
-
geometry_msgs/msg/Transform. - RosTransformStamped
-
geometry_msgs/msg/TransformStamped. - RosTransport
- A bidirectional frame transport (WebSocket today, others later).
-
ServiceCodec<
Req, Res> - Converter for a ROS 2 service's request/response pair.
- ServiceRegistry
- Registry of service codecs, keyed by Dart request type.
- StringMsg
-
std_msgs/msg/String. - TeleopJoystick
-
A thumb-stick that publishes
geometry_msgs/msg/Twistto a topic. - TeleopPad
- A directional pad for precise, discrete teleoperation.
- TfBuffer
- A tf2 transform buffer: stores the frame tree and answers lookups.
- TfFrameBuilder
- Resolves a tf2 transform and rebuilds as the frame moves.
- TfListener
-
Keeps a TfBuffer fed from a robot's
/tfand/tf_statictopics. - TFMessage
-
tf2_msgs/msg/TFMessage— the payload of/tfand/tf_static. - TopicInfo
- A topic name paired with its ROS type.
- Twist
-
geometry_msgs/msg/Twist— the canonical velocity command. - Vector3
-
geometry_msgs/msg/Vector3. - WebSocketTransport
-
A RosTransport over a WebSocket, working on every Flutter target
(mobile, desktop, and web, where
dart:iois unavailable). - WireCodec
- Decodes rosbridge frames off the wire into plain Dart structures.
Enums
- Compression
- Wire compression for subscriptions.
- Durability
- ROS 2 QoS durability policy.
- GoalStatus
-
Terminal status of an action goal, mirroring
action_msgs/msg/GoalStatus. - History
- ROS 2 QoS history policy.
- Liveliness
- ROS 2 QoS liveliness policy. ROS 2 QoS liveliness policy.
- Reliability
- ROS 2 QoS reliability policy.
- RosConnectionState
- Lifecycle of a Ros2Client connection.
- StatusLevel
-
Severity levels emitted by rosbridge
statusmessages.
Extensions
- PointMath on Point
- QuaternionMath on Quaternion
-
Rigid-body maths on the
geometry_msgsvalue types. - Ros2Introspection on Ros2Client
-
Live introspection of the ROS graph, via the
rosapinode. - TransformMath on RosTransform
- Vector3Math on Vector3
Functions
-
registerGeometryMsgs(
) → void -
Registers every
geometry_msgscodec. -
Registers every
nav_msgscodec. -
registerSensorMsgs(
) → void -
registerStandardMessages(
) → void -
Registers codecs for the bundled
std_msgs,geometry_msgs,sensor_msgsandnav_msgstypes. -
registerStdMsgs(
) → void -
Registers every
std_msgs/builtin_interfacescodec.
Exceptions / Errors
- ActionFailedException
- Thrown when an action goal is rejected or ends in a non-success state.
- PointCloudFormatException
- Thrown when a cloud's declared layout does not match the bytes it carries.
- ServiceCallException
- Thrown when a service call is rejected or fails on the ROS side.
- TfException
- Thrown when a transform cannot be resolved.
- UnknownMessageTypeError
- Thrown when a message type is used before its codec has been registered.