CameraIsolate class abstract
A child isolate that manages a single camera and streams frames from it.
This class can represent any combination of hardware and software, such as regular USB cameras
driven by OpenCV or a depth camera read with the RealSense SDK. To use, override initCamera
and disposeCamera, then override sendFrames to retreive and send images. Override
updateDetails to be notified when the current CameraDetails
have changed, but the common
cases such as stopping and starting the camera will be handled for you.
You may use sendStatus, sendLog, or sendFrame to send data to the Dashboard. Do not try to communicate directly as only the parent isolate can access the network.
This class manages a few camera-independent details, such as:
- periodically sending the camera's current status to the Dashboard
- periodically logging how many frames were successfully read
- periodically calling sendFrames to read the camera
- calling updateDetails when a new
VideoCommand
arrives.
- Inheritance
-
- Object
- IsolateChild<
IsolatePayload, VideoCommand> - CameraIsolate
- Implementers
Constructors
- CameraIsolate({required CameraDetails details})
- A constructor with initial details.
Properties
- details → CameraDetails
-
Holds the current details of the camera.
final
- fpsCount ↔ int
-
Records how many FPS this camera is actually running at.
getter/setter pair
- fpsTimer ↔ Timer?
-
A timer to log out the fpsCount every 5 seconds using sendLog.
getter/setter pair
- frameTimer ↔ Timer?
-
A timer to read from the camera at an FPS given by details.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → Object
-
A unique identifier for this child to identify itself to the parent.
finalinherited
- isReadingFrame ↔ bool
-
Whether the camera is currently reading a frame.
getter/setter pair
- name → CameraName
-
The name of this camera (where it is on the rover).
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- statusTimer ↔ Timer?
-
A timer to periodically send the camera status to the dashboard.
getter/setter pair
-
stream
→ Stream<
VideoCommand> -
A broadcast stream of all messages from the parent.
no setterinherited
Methods
-
dispose(
) → void - Disposes of this camera and all other resources.
-
disposeCamera(
) → void - Closes and releases the camera.
-
initCamera(
) → void - Initializes the camera and starts streaming.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onData(
VideoCommand data) → void -
A callback to run when new data is received from the parent.
override
-
onSpawn(
) → Future< void> -
Runs when the child isolate is spawned, after registerWithParent is called.
override
-
registerWithParent(
TypedSendPort< ChildIsolatePayload< port) → Future<IsolatePayload, VideoCommand> >void> -
Registers this child with its parent.
inherited
-
sendFrame(
Uint8List image, {CameraDetails? detailsOverride}) → void - Sends an individual frame to the dashboard.
-
sendFrames(
) → Future< void> - Reads a frame from the camera and sends it to the dashboard.
-
sendLog(
LogLevel level, String message) → void - Logs a message by sending a LogPayload to the parent isolate.
-
sendStatus(
[dynamic _]) → void - Sends the current status to the dashboard.
-
sendToParent(
IsolatePayload obj) → void -
Sends data to the parent isolate.
inherited
-
start(
) → void - Starts the camera and timers.
-
stop(
) → void - Cancels all timers and stops reading the camera.
-
toString(
) → String -
A string representation of this object.
inherited
-
updateDetails(
CameraDetails newDetails) → void - Updates the camera's details, which will take effect on the next sendFrame call.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited