本文整理汇总了C#中System.IO.TextWriter.FlushAsync方法的典型用法代码示例。如果您正苦于以下问题:C# TextWriter.FlushAsync方法的具体用法?C# TextWriter.FlushAsync怎么用?C# TextWriter.FlushAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.TextWriter
的用法示例。
在下文中一共展示了TextWriter.FlushAsync方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Drive
//.........这里部分代码省略.........
vAirframe[now] = new Vector3D(data.xDot, data.yDot, data.zDot);
//vAirframe[now] = Subtract(pos[now], pos[ago[1]]);
vSeats[now] = Scale(Subtract(seats[now], seats[ago[1]]), ts[now] - ts[ago[1]]);
Vector3D bln = Transform(xform, blNormal);
Vector3D brn = Transform(xform, brNormal);
Vector3D sln = Transform(xform, slNormal);
Vector3D srn = Transform(xform, srNormal);
// ft/sec/sec
double deltaT = ts[now] - ts[ago[1]];
Vector3D aAirframe = Scale(Subtract(vAirframe[now], vAirframe[ago[1]]), 1.0 / deltaT);
Vector3D aSeat = Scale(Subtract(vSeats[now], vSeats[ago[1]]), 1.0 / deltaT);
Vector3D acc = Add(aAirframe, aSeat);
// Turns out the position and velocity data coming
// from Falcon is pretty noisy. We smooth things out
// to help with this.
double smoothing = 0.9;
fs[now] = Add(Scale(fs[ago[1]], smoothing),
Scale(Add(gravity, Scale(acc, -1.0)), 1.0 - smoothing));
Vector3D f = fs[now];
double bl = Dot(f, bln);
double br = Dot(f, brn);
double sl = Dot(f, sln);
double sr = Dot(f, srn);
double blG = bl / G;
double brG = br / G;
double slG = sl / G;
double srG = sr / G;
// TODO: Map the neutral (1G) position as .25
long commandBL = Position(blG, backNeutralG);
long commandBR = Position(brG, backNeutralG);
long commandSL = Position(slG, seatNeutralG);
long commandSR = Position(srG, seatNeutralG);
Stats stats;
stats.Forces.BL = bl;
stats.Forces.BR = br;
stats.Forces.SL = sl;
stats.Forces.SR = sr;
stats.G.BL = blG;
stats.G.BR = brG;
stats.G.SL = slG;
stats.G.SR = srG;
stats.Commands.BL = commandBL;
stats.Commands.BR = commandBR;
stats.Commands.SL = commandSL;
stats.Commands.SR = commandSR;
stats.Yaw = yaw;
stats.Pitch = pitch;
stats.Roll = roll;
stats.VAC = vAirframe[now];
stats.DVAC = aAirframe;
stats.DVSeat = aSeat;
stats.DVTot = f;
stats.T = ts[now];
stats.DeltaT = ts[now] - ts[ago[1]];
// We skip the first few frames until we have enough
// history to do calculation
if (counter > history)
{
reportStats(stats);
//ts[now] - ts[ago[1]], brG, blG, srG, slG);
if (recordWriter != null)
{
if (_recordFlushOp != null)
{
_recordFlushOp.Wait();
}
recordWriter.WriteLine("{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12}, {13}, {14}, {15}, {16}, {17}",
t,
data.x, data.y, data.z,
data.xDot, data.yDot, data.zDot,
yaw, pitch, roll,
commandBL, commandBR,
commandSL, commandSR,
acc.X, acc.Y, acc.Z,
data.alpha);
_recordFlushOp = recordWriter.FlushAsync();
}
transmit(String.Format("M BL {0}", commandBL));
transmit(String.Format("M BR {0}", commandBR));
transmit(String.Format("M SL {0}", commandSL));
transmit(String.Format("M SR {0}", commandSR));
}
++counter;
}
Sleep(interval);
}
}