我将degreeOutput
来自 Thalmic Lab 的 Myo 传感器的传感器的度数读数存储在 WPF 应用程序中的双精度类型变量中。存储在变量中的值随着用户移动手臂而不断变化,但我想存储当人做出姿势时某个动作点的度数读数,而fist
不是不断变化的值。
在我当前的实现中,我触发degreeOutput
要在 中显示的值painfulArcStartTbx
来表示我要测量的弧的起始值,但这并没有按计划工作。
相反,当握住拳头时,度数值会输出到文本框,但会不断变化。
我只希望在握住拳头时输出初始读数,然后再输出任何读数。
应该在松开拳头姿势后输出弧的结束读数,但我得到与上述相同的行为。
有人对我如何仅存储握拳点的当前值和放开拳头姿势的当前值有任何建议吗?
这是处理度数输出的方法:
private void Myo_OrientationDataAcquired(object sender, OrientationDataEventArgs e)
{
App.Current.Dispatcher.Invoke((Action)(() =>
{
//need to record degree reading when pose made that
//signifies begining of painful arc.
//then specify a second pose that signals the end of
//painful arc and store arc reading, eg 92dg - 108dg
//myo indicator must be facing down or degrees will be inverted.
degreeOutput = ((e.Pitch + PITCH_MIN) * CALLIBRATION_FACTOR);
degreeOfAbductionTbx.Text = "Degree: " + degreeOutput;
if(e.Myo.Pose == Pose.Fist)
{
//get the start reading of the painful arc
painfulArcStartTbx.Text = "start: " + degreeOutput;
}
//then get the finish reading of the painful arc
//after the fist pose has been let go, indicating
//end of pain in movement
else
{
painfulArcEndTbx.Text = "end: " + degreeOutput;
}
}));
}