public string GetSecondCalibrationCommonds() { PosePositions.Clear(); TouchPoints.Clear(); var commonds = new List <BaseCommand>(); var lengths = new[] { 70, 80, 90, 100, 110, 120, 130 }; // coordinate_x var rotates = new[] { 90, 100, 110, 120, 130, 140, 150 }; // step var coor_Z = (int)ArmPositionCalculator.SharedInstance.ToCoordinate(ArmPositionCalculator.SharedInstance.ProbbedPose).Item3; var tapDistance = CommandHelper.GetTapDistance(); for (var i = 0; i < lengths.Length; i++) { var length = lengths[i]; var rotate = rotates[i]; var pose = ArmPositionCalculator.SharedInstance.ToPose(new Tuple <double, double, double>(length, 0, coor_Z)); var x = pose.X - tapDistance; var y = pose.Y - tapDistance; commonds.Add(new PoseCommand(x, y, 0)); commonds.Tap(); commonds.WaitForTouch(); commonds.TouchInSameRadius(new List <int> { rotate, -2 * rotate }); commonds.Rotate(rotate); } commonds.Reset(); commonds.Add(new DoneCommand(TaskNameCalibration)); commonds.Add(new PauseCommand(30, -1)); if (commonds.Count <= 0) { return(string.Empty); } JsonSerializerSettings settings = new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.Auto }; string serialized = JsonConvert.SerializeObject(commonds, settings); return(serialized); //List<Base> deserializedList = JsonConvert.DeserializeObject<List<Base>>(Serialized, settings); }
public bool ReportTouchBegin(long timeStamp, double x, double y) { if (isProbing) { ArmPositionCalculator.SharedInstance.ProbbedPose = PosePositions.Last().Value; ArmPositionCalculator.SharedInstance.ProbbedPose.X += CommandHelper.GetTapDistance(); ArmPositionCalculator.SharedInstance.ProbbedPose.Y += CommandHelper.GetTapDistance(); isProbing = false; } else { TouchPoints[timeStamp] = new TouchPoint(x, y); isTouchReported = true; } return(true); }