22 #ifndef SRC_POSTURE_ESTIMATOR_H_
23 #define SRC_POSTURE_ESTIMATOR_H_
26 #include <RemoteNotifyBroadcast.h>
33 #include "opencv2/core.hpp"
34 #include "opencv2/imgproc.hpp"
81 std::array<ConnectedJoint, JointMax + 1>
joints;
146 std::vector<DelayTimer*>
149 RemoteNotify::Broadcast*
167 RemoteNotify::Broadcast* broadcast, std::string msg,
249 std::array<cv::Scalar, 4> colours = {
250 cv::Scalar(255, 0, 0), cv::Scalar(0, 255, 0), cv::Scalar(0, 0, 255),
251 cv::Scalar(144, 144, 144)};
256 RemoteNotify::Broadcast broadcaster;
300 void calculatePoseChanges();
317 void checkPostureState();
324 void calculateChangesAndCheckPosture();
350 cv::Mat current_frame,
367 cv::Mat current_frame);
464 cv::Mat current_frame);
Simple timer which just has the running flag set when running and unset when not running.
Definition: posture_estimator.h:116
~DelayTimer()
Definition: posture_estimator.cpp:386
bool running
Boolen which indicates if timer is running (True = running)
Definition: posture_estimator.h:120
void timerEvent()
Sets running flag to false.
Definition: posture_estimator.cpp:387
DelayTimer(size_t time)
Constructor for PostureEstimating::DelayTimer
Definition: posture_estimator.cpp:385
void countdown()
Starts the delay timer running.
Definition: posture_estimator.cpp:389
size_t time
The time timer runs for.
Definition: posture_estimator.h:119
Broadcasts a message using RemoteNotify::Broadcast after a time is elapsed.
Definition: posture_estimator.h:144
~MessageTimer()
Deconstructor for PostureEstimating::MessageTimer
Definition: posture_estimator.cpp:424
void timerEvent()
Definition: posture_estimator.cpp:437
bool running
Boolen which indicates if timer is running (True = running)
Definition: posture_estimator.h:156
size_t time
Definition: posture_estimator.h:154
void countdown()
Starts timer to countdown, sending a messsage at the end of the countdown.
Definition: posture_estimator.cpp:425
void stopCountdown()
Stops the countdown and doesn't send message.
Definition: posture_estimator.cpp:431
MessageTimer(std::vector< DelayTimer * > timers, RemoteNotify::Broadcast *broadcast, std::string msg, size_t time)
Constructor for PostureEstimating::MessageTimer
Definition: posture_estimator.cpp:415
This class handles representations of the user's pose and calculates any updates to their pose that i...
Definition: posture_estimator.h:243
Pose current_pose
The user's current Pose from most recent data provided.
Definition: posture_estimator.h:383
Pose pose_changes
A representation of what changes are needed to get back to ideal Pose.
Definition: posture_estimator.h:395
float pose_change_threshold
A representation of what absolute value changes for a pose is acceptably still a good pose.
Definition: posture_estimator.h:401
float get_pose_change_threshold(void)
Get the currently set pose_change_threshold. Note that this threshold is in radians and we set a maxi...
Definition: posture_estimator.cpp:329
PostureEstimating::PostureState posture_state
Whether the user is currently in a Good, Bad, Unset, Undefined or UndefinedAndUnset posture....
Definition: posture_estimator.h:409
PostureEstimator()
Construct a new PostureEstimator object.
Definition: posture_estimator.cpp:64
PoseStatus runEstimator(PostProcessing::ProcessedResults results)
Return a PoseStatus of the user's pose.
Definition: posture_estimator.cpp:333
void update_ideal_pose(PostureEstimating::Pose pose)
Calibrate the user's ideal_pose with a pose object. The ideal_pose is only updated if the posture_sta...
Definition: posture_estimator.cpp:313
void analysePosture(PostureEstimating::PoseStatus pose_status, cv::Mat current_frame)
Analyse the posture_state field of PostureEstimating::PoseStatus and use it as follows:
Definition: posture_estimator.cpp:341
Pose ideal_pose
The user's ideal Pose, expected to be generated during user calibration.
Definition: posture_estimator.h:389
~PostureEstimator()
Destroy a PostureEstimator object.
Definition: posture_estimator.cpp:86
bool set_pose_change_threshold(float threshold)
Set the pose_change_threshold to allow user configuration. Note that this threshold is in radians and...
Definition: posture_estimator.cpp:320
Timer which countdowns and stops a PostureEstimating::MessageTimer if countdown ends.
Definition: posture_estimator.h:192
void timerEvent()
Runs stopCountdown() on PostureEstimating::MessageTimer
Definition: posture_estimator.cpp:410
StopTimer(MessageTimer *toStop, size_t time)
Constructor for PostureEstimating::StopTimer
Definition: posture_estimator.cpp:393
void countdown()
Starts countdown, stopping PostureEstimating::MessageTimer if countdown reached.
Definition: posture_estimator.cpp:398
size_t time
The time to wait before stopping MessageTimer countdown.
Definition: posture_estimator.h:197
~StopTimer()
Deconstructor for PostureEstimating::StopTimer
Definition: posture_estimator.cpp:397
bool running
Boolen which indicates if timer is running (True = running)
Definition: posture_estimator.h:198
void stopCountdown()
Stops the countdown and doesn't stop PostureEstimating::MessageTimer
Definition: posture_estimator.cpp:404
Responsible for analysing the results of pose estimation to determine any posture changes which must ...
Definition: posture_estimator.cpp:33
Colours
Colours corresponding to PostureEstimator::colours
Definition: posture_estimator.h:110
@ Blue
Definition: posture_estimator.h:110
@ Red
Definition: posture_estimator.h:110
@ Green
Definition: posture_estimator.h:110
@ Grey
Definition: posture_estimator.h:110
Pose createPose()
Creates an empty Pose object.
Definition: posture_estimator.cpp:54
std::string stringJoint(Joint joint)
Prints human readable string for enum Joint
Definition: posture_estimator.cpp:35
PostureState
Potential states which the posture can be. Unset means that the ideal_pose has not been set by the us...
Definition: posture_estimator.h:90
@ Undefined
Definition: posture_estimator.h:90
@ Good
Definition: posture_estimator.h:90
@ Bad
Definition: posture_estimator.h:90
@ UndefinedAndUnset
Definition: posture_estimator.h:90
@ Unset
Definition: posture_estimator.h:90
Indicates position and trustworthiness of a body part node.
Definition: intermediate_structures.h:122
The PostProcessing::Coordinate of each body part.
Definition: intermediate_structures.h:139
A representation of a body part.
Definition: posture_estimator.h:58
PostProcessing::Coordinate coord
Definition: posture_estimator.h:60
Joint joint
Definition: posture_estimator.h:59
float lower_angle
Definition: posture_estimator.h:62
float upper_angle
Definition: posture_estimator.h:61
Representation of user's pose for use by the pipeline processing.
Definition: posture_estimator.h:100
PostureState posture_state
Definition: posture_estimator.h:104
Pose ideal_pose
Definition: posture_estimator.h:101
Pose pose_changes
Definition: posture_estimator.h:103
Pose current_pose
Definition: posture_estimator.h:102
The representation of a human's pose, containing all the expected ConnectedJoint
Definition: posture_estimator.h:74
std::array< ConnectedJoint, JointMax+1 > joints
Each element of this array corresponds to a body part with its connections also specifed in a Posture...
Definition: posture_estimator.h:81