public static void Test_robot_acceleration_inferior_1g() { Random rand; double x, y; rand = new Random(); int numberWayPoints = rand.Next(5, 10); List <Point2D> WayPoints = new List <Point2D>(); for (int i = 0; i < numberWayPoints; i++) { x = rand.NextDouble() * 10000; y = rand.NextDouble() * 10000; Point2D wayPoint = new Point2D(x, y); WayPoints.Add(wayPoint); } MyRobot robot = new MyRobot(WayPoints[0], WayPoints[0].AbsoluteBearing(WayPoints[1])); List <Point2D> trajectory = robot.CalculateIntermediatePointsBetweenWayPoints(WayPoints, 1.55); robot.Trajectory = WayPoints; robot.Speed = 0; double lastSpeed = 0; for (int i = 0; i < 100; i++) { robot.MoveRobot(new Point2D(robot.Position.X + 100, robot.Position.Y)); (robot.Speed - lastSpeed).Should().BeLessThan(9.81); lastSpeed = robot.Speed; } }
public static void Test_robot_should_follow_trajectory() { Random rand; double x, y; rand = new Random(); int numberWayPoints = rand.Next(5, 10); List <Point2D> WayPoints = new List <Point2D>(); for (int i = 0; i < numberWayPoints; i++) { x = rand.NextDouble() * 10000; y = rand.NextDouble() * 10000; Point2D wayPoint = new Point2D(x, y); WayPoints.Add(wayPoint); } MyRobot robot = new MyRobot(WayPoints[0], 0); List <Point2D> trajectory = robot.CalculateIntermediatePointsBetweenWayPoints(WayPoints, 1.55); robot.Trajectory = WayPoints; robot.Speed = 1; for (int i = 0; i < 100; i++) { robot.MoveRobot(new Point2D(robot.Position.X + 1, robot.Position.Y + 1)); } }