public TrajectoryController(Game game, Robot robot, InverseKinematicsSolver iksolver)
			: base(game)
		{
			Robot = robot;
			IKSolver = iksolver;
			Time = new TimeSpan(0);
			Trajectory = new List<TrajectoryPoint>();			
		}
		public JoystickController(Game game, Robot robot, InverseKinematicsSolver softsolver, InverseKinematicsSolver hardsolver)
			: base(game)
		{
			Robot = robot;
			SoftPassIKSolver = softsolver;
			HardPassIKSolver = hardsolver;
			SetupJoystick();			
		}
		public InverseKinematicsSolver(Robot robot, Vector3 target) 
		{
			TargetError = 0.05f;			
			GradientDelta = 0.001f;
			DampFactor = 0.01f;
			MaxIterations = 150;
			MaxBruteForceIterations = 50;

			Robot = robot;
			TargetPosition = target;
			Mode = ErrorCheckingMode.ByComponent;
		}
Exemple #4
0
		/// <summary>
		/// Allows the game to perform any initialization it needs to before starting to run.
		/// This is where it can query for any required services and load any non-graphic
		/// related content.  Calling base.Initialize will enumerate through any components
		/// and initialize them as well.
		/// </summary>
		protected override void Initialize()
		{			
			// Setup main world matrix
			world = Matrix.CreateRotationX(-MathHelper.PiOver2);

			// Setup camera
			Camera = new Camera();
			Camera.Position = new Vector3(0.0f, 15.0f, 100.0f);
			Camera.Forward = new Vector3(0, 0, -1);

			// Setup Robot
			robot = new Robot();			

			// Setup TrajectoryController
			InverseKinematicsSolver iks = new InverseKinematicsSolver(robot, new Vector3()) { MaxBruteForceIterations = 0, MaxIterations = 200 };
			InverseKinematicsSolver hardiks = new InverseKinematicsSolver(robot, new Vector3()) { MaxBruteForceIterations = 10, MaxIterations = 100 };

			trajectory = new TrajectoryController(this, robot, iks);
			trajectory.Enabled = false;
			Components.Add(trajectory);

			// TODO Test if jostick is present to try enable
			//joystick = new JoystickController(this, robot, iks, hardiks);
			//joystick.Enabled = true;
			//Components.Add(joystick);

			hardware = new HardwareInterfaceController(this, robot);			
			Components.Add(hardware);

			// Creates the UI
			MainForm mainfrm = new MainForm();
			mainfrm.SetRobotEdit(robot, Content);
			mainfrm.SetTrajectoryController(trajectory);
			mainfrm.SetJoystickController(joystick);
			mainfrm.SetHardwareInterfaceController(hardware);
			mainfrm.Show();

			base.Initialize();
		}
		public HardwareInterfaceController(Game game, Robot robot) : base(game)
		{
			SelectedRobot = robot;
			Assigments = new List<Assigment>();
		}