public void Move(float[] Poses) { if (Poses.Length != 6) { throw new ArgumentException("給的pose應該要是6個才對。"); } foreach (float Pose in Poses) { if (Pose == 0) { throw new ArgumentException("數值不能有0,UR3很任性的。"); } } byte[] data = Encoding.UTF8.GetBytes(URHandler.FloatArrayToURPose(Poses)); Stream.Write(StatusCode.MovePoseWithCMD, 0, 1); StreamRead(100, "Move"); Stream.Write(data, 0, data.Length); StreamRead(100, "DoneMove"); }
public async Task MoveAsync(float[] Poses) { if (Poses.Length != 6) { throw new ArgumentException("給的pose應該要是6個才對。"); } foreach (float Pose in Poses) { if (Pose == 0) { throw new ArgumentException("數值不能有0,UR3很任性的。"); } } byte[] data = Encoding.UTF8.GetBytes(URHandler.FloatArrayToURPose(Poses)); await Stream.WriteAsync(StatusCode.MovePoseWithCMD, 0, 1).ConfigureAwait(false); await StreamReadAsync(100, "Move").ConfigureAwait(false); await Stream.WriteAsync(data, 0, data.Length).ConfigureAwait(false); await StreamReadAsync(100, "DoneMove").ConfigureAwait(false); }