Listener
The Listener
interface contains event driven callback methods. Implementing
the listener interface allows you to receive the event data containing important
information. These callbacks are called on different occasions and allow you to
structure your application' logic accordingly. Usually the listener will pass a
custom event object, containing the current analyser instance, as well as useful
data corresponding to the occurred event. It is important to note here that
there is no fixed sequence of callbacks meaning there is no guarantee that for
example a PoseEvent
is always received before a MetricValuesEvent
. A
detailed documentation about the Listener
can be found in
the Javadocs reference.
onReady
Event: ReadyEvent
This event is called when the analyser has successfully established a connection with the server and the exercise has been successfully configured. In order for this to happen you must first create an Analyser instance, during which the client will attempt to set up a connection.
onPose
Event: PoseEvent
The PoseEvent
is called when the human pose estimation analysed an image and
returns the results. The event includes a Pose
, that contains the Point
for
each BodyPointType
.
Pose
Point
- The key point containing adouble
for theX
-coordinate,Y
-coordinate and confidencescore
for eachBodyPointType
.
public enum BodyPointType
{
NOSE,
NECK,
LEFT_EAR,
RIGHT_EAR,
LEFT_EYE,
RIGHT_EYE,
LEFT_SHOULDER,
RIGHT_SHOULDER,
LEFT_ELBOW,
RIGHT_ELBOW,
LEFT_WRIST,
RIGHT_WRIST,
LEFT_HIP,
RIGHT_HIP,
LEFT_KNEE,
RIGHT_KNEE,
LEFT_ANKLE,
RIGHT_ANKLE,
MID_HIP,
}
onMetricValues
Event: MetricValuesEvent
This event is called when metric values are received from the movement analysis.
The event includes a list of MetricValue
s. A MetricValue
is described by
a value
that belongs to a Metric
and its confidence score
.
onFeedback
Event: FeedbackEvent
The FeedbackEvent
is received when a movement violation has been detected. The
event contains a list of all Feedback
, where each Feedback
is linked to a
Metric
and includes a Key
, Name
, a list of possible feedback messages and
an Importance
categorization. Following FeedbackImportance
categories are
possible:
HIGH
: Mainly feedback regarding injury prevention and primary movement mechanics.MEDIUM_HIGH
: Mainly feedback regarding secondary movement mechanics.MEDIUM
: Mainly feedback regarding range of motion.LOW
: Mainly feedback regarding general performance improvements which are not related to the upper categories.UNDEFINED
: No importance is yet defined for this feedback.
Furthermore, there is a helper method to compare two FeedbackImportance
values, which can be used as followed:
FeedbackImportance first;
FeedbackImportance other;
boolean isMoreImportant = first.isMoreImportantThan(other);
onActivity
Event: ActivityEvent
After every recognized activity, an ActivityEvent
provides the Activity
and
a list of all Feedback
that were received during the activity.
The Activity
can be one of the following:
Repetition
: The exercise was completed once with a full range. The repetition summary furthermore contains the repetitionDuration
.Attempt
: The exercise was performed but the range of motion or form deviated too much from the target exercise that it is not considered a repetition but only an attempt.
onRepetition
Event: RepetitionEvent
After every recognized repetition, a RepetitionEvent
providing the Duration
of the repetition and a list of all Feedback
that were received during the
duration. This event holds the same information as the onActivity
event if a
repetition is detected.
onError
Event: ErrorEvent
If an error occurs, the ErrorEvent
is described by an ErrorText
. The error
is further grouped into one of the following ErrorType
. More details and
concrete error cases that are covered by this callback can be found on a
separate page.
enum ErrorType
{
SERVER_ERROR,
INVALID_INPUT,
CONNECTION_ERROR,
TIMEOUT,
SECURITY_ERROR,
OTHER
}
onStop
No Event
onStop
is called when the analyser has been stopped and no further images can
be submitted to the server for analysis.
onSessionQualityChanged
Event: SessionQualityChangedEvent
The session quality quantifies the LATENCY
and the ENVIRONMENT
. If one of
these subjects changes, the SessionQualityChangedEvent
is called where the new
ratings for both subjects are provided. More details how to interpret the
session quality can be found on a separate page. Possible
qualities are:
NONE
: No quality information available yet.BAD
: The quality may impair the movement analysis. We cannot guarantee a good performance.OK
: The quality is good enough to perform the movement analysis, but the accuracy can be affected.GOOD
: The quality is optimal and enables the movement analysis.
onSessionStateChanged
Event: SessionStateChangedEvent
When the session state changes, the SessionStateChangedEvent
is received with
the new SessionState
. The SessionState
can be in one of the following
states:
NO_HUMAN
: No human can be recognized in the provided image.POSITIONING
: The starting position has not been reached by the user.EXERCISING
: The starting position was reached by the user and the exercise is running.