Class RecordingTelemetry
- All Implemented Interfaces:
org.firstinspires.ftc.robotcore.external.Telemetry
Telemetry that keeps what the Driver Station would have shown, so a test can read it back.
Every update() renders the current items and lines to text, one string per Driver Station
line, and appends that list to transmissions(). The rendering follows the SDK's defaults: an item
reads "caption : value", the items on one Telemetry.Line are joined with " | ", and with
auto-clear on (the default) every item that is not retained is removed when the next item or line is
added after an update - not at the update itself, which is when the SDK's own telemetry clears too. So an
update with nothing new added shows the same lines again, as the Driver Station would: an iterative
OpMode that calls telemetry.update() itself, followed by the SDK's own update after
loop(), still ends on what it added. Lines added through log() go to
loggedLines().
What it deliberately does not do. Nothing is sent anywhere, speak(String) is silent, and
the transmission interval is stored but not honoured: every update is recorded, because a sim tick is not
a real 250 ms. Formatted values (addData(caption, "%.2f", x)) use Locale.ROOT, so a run
reads the same on a laptop set to any language; the robot uses its own default locale.
Not thread-safe. The runner only lets one thread touch it at a time, and a test reads it after the run.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.firstinspires.ftc.robotcore.external.Telemetry
org.firstinspires.ftc.robotcore.external.Telemetry.DisplayFormat, org.firstinspires.ftc.robotcore.external.Telemetry.Item, org.firstinspires.ftc.robotcore.external.Telemetry.Line, org.firstinspires.ftc.robotcore.external.Telemetry.Log -
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty telemetry with the SDK's default separators and auto-clear on. -
Method Summary
Modifier and TypeMethodDescriptionorg.firstinspires.ftc.robotcore.external.Telemetry.Itemorg.firstinspires.ftc.robotcore.external.Telemetry.Item<T> org.firstinspires.ftc.robotcore.external.Telemetry.ItemaddData(String caption, String format, org.firstinspires.ftc.robotcore.external.Func<T> valueProducer) <T> org.firstinspires.ftc.robotcore.external.Telemetry.Itemorg.firstinspires.ftc.robotcore.external.Telemetry.LineaddLine()org.firstinspires.ftc.robotcore.external.Telemetry.Linevoidclear()Removes every item that is not retained, and every line left with no retained item.voidclearAll()Removes every item and line, retained or not, every action, and the log.intReturns the stored interval, in milliseconds; it is not honoured, see the class javadoc.booleanReturns the lines shown by the most recentupdate(), or an empty list if none has happened.org.firstinspires.ftc.robotcore.external.Telemetry.Loglog()Returns every line added throughlog(), oldest first, however many the log's capacity shows.booleanremoveAction(Object token) booleanremoveItem(org.firstinspires.ftc.robotcore.external.Telemetry.Item item) booleanremoveLine(org.firstinspires.ftc.robotcore.external.Telemetry.Line line) voidsetAutoClear(boolean autoClear) voidsetCaptionValueSeparator(String captionValueSeparator) voidsetDisplayFormat(org.firstinspires.ftc.robotcore.external.Telemetry.DisplayFormat displayFormat) Accepted and ignored: the recorded text is the same in every display format.voidsetItemSeparator(String itemSeparator) voidsetMsTransmissionInterval(int msTransmissionInterval) Stores the interval, in milliseconds; it is not honoured, see the class javadoc.voidDoes nothing: there is no Driver Station to speak through.voidDoes nothing: there is no Driver Station to speak through.Returns every update so far, oldest first: each one is the list of Driver Station lines it showed.booleanupdate()Runs the actions, renders every item and line to text and records that as one transmission.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.firstinspires.ftc.robotcore.external.Telemetry
setNumDecimalPlaces
-
Constructor Details
-
RecordingTelemetry
public RecordingTelemetry()Creates an empty telemetry with the SDK's default separators and auto-clear on.
-
-
Method Details
-
transmissions
Returns every update so far, oldest first: each one is the list of Driver Station lines it showed. The list is a snapshot; later updates do not change it.- Returns:
- every update so far, oldest first: each one is the list of Driver Station lines it showed
-
lastTransmission
Returns the lines shown by the most recentupdate(), or an empty list if none has happened.- Returns:
- the lines shown by the most recent
update(), or an empty list if none has happened
-
loggedLines
Returns every line added throughlog(), oldest first, however many the log's capacity shows.- Returns:
- every line added through
log(), oldest first, however many the log's capacity shows
-
addData
public org.firstinspires.ftc.robotcore.external.Telemetry.Item addData(String caption, String format, Object... args) - Specified by:
addDatain interfaceorg.firstinspires.ftc.robotcore.external.Telemetry
-
addData
public org.firstinspires.ftc.robotcore.external.Telemetry.Item addData(String caption, Object value) - Specified by:
addDatain interfaceorg.firstinspires.ftc.robotcore.external.Telemetry
-
addData
public <T> org.firstinspires.ftc.robotcore.external.Telemetry.Item addData(String caption, org.firstinspires.ftc.robotcore.external.Func<T> valueProducer) - Specified by:
addDatain interfaceorg.firstinspires.ftc.robotcore.external.Telemetry
-
addData
public <T> org.firstinspires.ftc.robotcore.external.Telemetry.Item addData(String caption, String format, org.firstinspires.ftc.robotcore.external.Func<T> valueProducer) - Specified by:
addDatain interfaceorg.firstinspires.ftc.robotcore.external.Telemetry
-
removeItem
public boolean removeItem(org.firstinspires.ftc.robotcore.external.Telemetry.Item item) - Specified by:
removeItemin interfaceorg.firstinspires.ftc.robotcore.external.Telemetry
-
clear
public void clear()Removes every item that is not retained, and every line left with no retained item.- Specified by:
clearin interfaceorg.firstinspires.ftc.robotcore.external.Telemetry
-
clearAll
public void clearAll()Removes every item and line, retained or not, every action, and the log.- Specified by:
clearAllin interfaceorg.firstinspires.ftc.robotcore.external.Telemetry
-
addAction
- Specified by:
addActionin interfaceorg.firstinspires.ftc.robotcore.external.Telemetry
-
removeAction
- Specified by:
removeActionin interfaceorg.firstinspires.ftc.robotcore.external.Telemetry
-
speak
Does nothing: there is no Driver Station to speak through.- Specified by:
speakin interfaceorg.firstinspires.ftc.robotcore.external.Telemetry
-
speak
Does nothing: there is no Driver Station to speak through.- Specified by:
speakin interfaceorg.firstinspires.ftc.robotcore.external.Telemetry
-
update
public boolean update()Runs the actions, renders every item and line to text and records that as one transmission. With auto-clear on, the next item or line added clears the non-retained ones first.- Specified by:
updatein interfaceorg.firstinspires.ftc.robotcore.external.Telemetry- Returns:
- true, as the SDK does when it sends
-
addLine
public org.firstinspires.ftc.robotcore.external.Telemetry.Line addLine()- Specified by:
addLinein interfaceorg.firstinspires.ftc.robotcore.external.Telemetry
-
addLine
- Specified by:
addLinein interfaceorg.firstinspires.ftc.robotcore.external.Telemetry
-
removeLine
public boolean removeLine(org.firstinspires.ftc.robotcore.external.Telemetry.Line line) - Specified by:
removeLinein interfaceorg.firstinspires.ftc.robotcore.external.Telemetry
-
isAutoClear
public boolean isAutoClear()- Specified by:
isAutoClearin interfaceorg.firstinspires.ftc.robotcore.external.Telemetry
-
setAutoClear
public void setAutoClear(boolean autoClear) - Specified by:
setAutoClearin interfaceorg.firstinspires.ftc.robotcore.external.Telemetry
-
getMsTransmissionInterval
public int getMsTransmissionInterval()Returns the stored interval, in milliseconds; it is not honoured, see the class javadoc.- Specified by:
getMsTransmissionIntervalin interfaceorg.firstinspires.ftc.robotcore.external.Telemetry- Returns:
- the stored interval, in milliseconds; it is not honoured, see the class javadoc
-
setMsTransmissionInterval
public void setMsTransmissionInterval(int msTransmissionInterval) Stores the interval, in milliseconds; it is not honoured, see the class javadoc.- Specified by:
setMsTransmissionIntervalin interfaceorg.firstinspires.ftc.robotcore.external.Telemetry
-
getItemSeparator
- Specified by:
getItemSeparatorin interfaceorg.firstinspires.ftc.robotcore.external.Telemetry
-
setItemSeparator
- Specified by:
setItemSeparatorin interfaceorg.firstinspires.ftc.robotcore.external.Telemetry
-
getCaptionValueSeparator
- Specified by:
getCaptionValueSeparatorin interfaceorg.firstinspires.ftc.robotcore.external.Telemetry
-
setCaptionValueSeparator
- Specified by:
setCaptionValueSeparatorin interfaceorg.firstinspires.ftc.robotcore.external.Telemetry
-
setDisplayFormat
public void setDisplayFormat(org.firstinspires.ftc.robotcore.external.Telemetry.DisplayFormat displayFormat) Accepted and ignored: the recorded text is the same in every display format.- Specified by:
setDisplayFormatin interfaceorg.firstinspires.ftc.robotcore.external.Telemetry
-
log
public org.firstinspires.ftc.robotcore.external.Telemetry.Log log()- Specified by:
login interfaceorg.firstinspires.ftc.robotcore.external.Telemetry
-