Beispiel #1
0
 private void BtnRefresh_Click(object sender, RoutedEventArgs e)
 {
     Boxs[0] = new box(new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 0, 1), -45), new Point3D(0, 0, 0)), new TranslateTransform3D(-700, -2600, joints[8].model.Bounds.SizeZ + 60));
     Boxs[1] = new box(new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 0, 1), 45), new Point3D(0, 0, 0)), new TranslateTransform3D(700, -1240, joints[9].model.Bounds.SizeZ + 60));
     Boxs[2] = new box(new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 0, 1), 45), new Point3D(0, 0, 0)), new TranslateTransform3D(560, -3840, joints[10].model.Bounds.SizeZ + 60));
     Boxs[3] = new box(new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 0, 1), -45), new Point3D(0, 0, 0)), new TranslateTransform3D(1960, -2500, joints[11].model.Bounds.SizeZ + 60));
     double[] angles = { joints[0].angle, joints[1].angle, joints[2].angle, joints[3].angle, joints[4].angle, joints[5].angle = 70 };
     ForwardKinematics(angles);
 }
Beispiel #2
0
        public MainWindow()
        {
            InitializeComponent();

            basePath = "res\\arm\\obj\\";
            List <string> modelsNames = new List <string>();

            modelsNames.Add(MODEL_PATH1);
            modelsNames.Add(MODEL_PATH2);
            modelsNames.Add(MODEL_PATH3);
            modelsNames.Add(MODEL_PATH4);
            modelsNames.Add(MODEL_PATH5);
            modelsNames.Add(MODEL_PATH6);
            modelsNames.Add(MODEL_PATH7);
            modelsNames.Add(MODEL_PATH8);
            modelsNames.Add(MODEL_PATH9);
            modelsNames.Add(MODEL_PATH9);
            modelsNames.Add(MODEL_PATH9);
            modelsNames.Add(MODEL_PATH9);

            RoboticArm.Content = Initialize_Environment(modelsNames);

            var builder  = new MeshBuilder(true, true);
            var position = new Point3D(0, 0, 0);

            builder.AddSphere(position, 50, 15, 15);
            visual = new ModelVisual3D();

            Map.Fill = new ImageBrush(new BitmapImage(new Uri("res\\image\\map.png", UriKind.Relative)));

            viewPort3d.RotateGesture = new MouseGesture(MouseAction.RightClick);
            viewPort3d.PanGesture    = new MouseGesture(MouseAction.LeftClick);
            viewPort3d.Children.Add(visual);
            viewPort3d.Children.Add(RoboticArm);
            viewPort3d.Camera.LookDirection = new Vector3D(-14000, 0, -14000);
            viewPort3d.Camera.UpDirection   = new Vector3D(0.0, 0.0, 1.0);
            viewPort3d.Camera.Position      = new Point3D(13700, -200, 14000);

            Boxs = new box[4];

            Boxs[0] = new box(new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 0, 1), -45), new Point3D(0, 0, 0)), new TranslateTransform3D(-700, -2600, joints[8].model.Bounds.SizeZ + 60));
            Boxs[1] = new box(new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 0, 1), 45), new Point3D(0, 0, 0)), new TranslateTransform3D(700, -1240, joints[9].model.Bounds.SizeZ + 60));
            Boxs[2] = new box(new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 0, 1), 45), new Point3D(0, 0, 0)), new TranslateTransform3D(560, -3840, joints[10].model.Bounds.SizeZ + 60));
            Boxs[3] = new box(new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 0, 1), -45), new Point3D(0, 0, 0)), new TranslateTransform3D(1960, -2500, joints[11].model.Bounds.SizeZ + 60));

            double[] angles = { joints[0].angle, joints[1].angle, joints[2].angle, joints[3].angle = 90, joints[4].angle, joints[5].angle = 70 };
            ForwardKinematics(angles);

            RenderTimer          = new System.Windows.Forms.Timer();
            RenderTimer.Interval = 5;
            RenderTimer.Tick    += new System.EventHandler(RenderTimer_Tick);

            RenderTimer.Start();
        }
Beispiel #3
0
 private void BtnClearAll_Click(object sender, RoutedEventArgs e)
 {
     lastRobotCommand = null;
     Boxs[0]          = new box(new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 0, 1), -45), new Point3D(0, 0, 0)), new TranslateTransform3D(-700, -2600, joints[8].model.Bounds.SizeZ + 60));
     Boxs[1]          = new box(new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 0, 1), 45), new Point3D(0, 0, 0)), new TranslateTransform3D(700, -1240, joints[9].model.Bounds.SizeZ + 60));
     Boxs[2]          = new box(new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 0, 1), 45), new Point3D(0, 0, 0)), new TranslateTransform3D(560, -3840, joints[10].model.Bounds.SizeZ + 60));
     Boxs[3]          = new box(new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 0, 1), -45), new Point3D(0, 0, 0)), new TranslateTransform3D(1960, -2500, joints[11].model.Bounds.SizeZ + 60));
     double[] angles = { joints[0].angle = 0, joints[1].angle = 0, joints[2].angle = 0, joints[3].angle = 90, joints[4].angle = 0, joints[5].angle = 70 };
     ForwardKinematics(angles);
     CommandQueue.Items.Clear();
     TbStatus.Text            = TbLastN.Text = "0";
     TbM11.Text               = TbM12.Text = TbM13.Text = TbM14.Text = TbM15.Text = TbM16.Text = "0";
     TbT11.Text               = TbT12.Text = TbT13.Text = TbT14.Text = TbT15.Text = TbT16.Text = "0";
     TbL11.Text               = TbL12.Text = TbL13.Text = TbL14.Text = TbL15.Text = TbL16.Text = "0";
     TbMR1n.Text              = TbMR1x.Text = TbMR1y.Text = TbMR1t.Text = TbMR1g.Text = TbMR1l.Text = "0";
     TbMR2n.Text              = TbMR2x.Text = TbMR2y.Text = TbMR2t.Text = TbMR2g.Text = TbMR2l.Text = "0";
     TbLogRobotSimulator.Text = "";
 }