Esempio n. 1
0
        public void SELECT_EXIT(Joints joints)
        {
            needle.kinematics.joint.UpperBevel = joints.UpperBevel;
            needle.kinematics.joint.LowerBevel = joints.LowerBevel;
            needle.kinematics.joint.Elbow      = joints.Elbow;
            needle.kinematics.joint.twist      = joints.twist;
            needle.update_needle();


            trajectory.exit_point = NeedleKinematics.get_translation(needle.head);//mode.two_point_suturing
            trajectory.set_entry_needle(joints);
            trajectory.set_exit_needle(joints);
            state++;

            // delete late

            /*
             * Joints traj_joint = trajectory.update_trajectory(joints);
             * needle.kinematics.joint.UpperBevel = traj_joint.UpperBevel;
             * needle.kinematics.joint.LowerBevel = traj_joint.LowerBevel;
             * needle.kinematics.joint.Elbow = traj_joint.Elbow;
             * needle.kinematics.joint.twist = traj_joint.twist;
             * needle.update_needle();
             * */
            //
        }
Esempio n. 2
0
        public static void specified_pos(Needle needle)
        {
            /*
             * Needle needle = new Needle(); // for sake of have a valid head position and initial joint values for the following optimizer
             * needle.kinematics.joint.UpperBevel = 60;
             * needle.kinematics.joint.LowerBevel = 60;
             * needle.kinematics.joint.Elbow = 150; // no need for twist, twist will be given in loop
             * needle.kinematics.joint.twist=0;
             * needle.update_needle();
             */

            Optimizer optimizer = new Optimizer();

            optimizer.point_target.X = NeedleKinematics.get_translation(needle.head).X;
            optimizer.point_target.Y = NeedleKinematics.get_translation(needle.head).Y;
            optimizer.point_target.Z = NeedleKinematics.get_translation(needle.head).Z;

            optimizer.x = new double[3] {
                needle.kinematics.joint.UpperBevel, needle.kinematics.joint.LowerBevel, needle.kinematics.joint.Elbow
            };
            int n = 20;

            for (int i = 0; i < n; i++)
            {
                optimizer.point_target.W = i * 360 / n;
                Joints optimized_joints = optimizer.minimize_postionNtwist();
                needle.kinematics.joint = optimized_joints;
                needle.update_needle();
                Print.PrintJointOnFile(optimized_joints);
                Print.PrintMatrixOnFile(needle.center);
                optimizer.x = new double[3] {
                    optimized_joints.UpperBevel, optimized_joints.LowerBevel, optimized_joints.Elbow
                };
            }
        }
Esempio n. 3
0
        public void SELECT_ENTRY(Joints joints)
        {
            needle.kinematics.joint.UpperBevel = joints.UpperBevel; //-60; //joints.UpperBevel;
            needle.kinematics.joint.LowerBevel = joints.LowerBevel; //-50;// joints.LowerBevel;
            needle.kinematics.joint.Elbow      = joints.Elbow;      //80;// joints.Elbow;
            needle.kinematics.joint.twist      = joints.twist;      //0;// joints.twist;
            needle.update_needle();                                 // one-point suturing
            Print.PrintJointOnFile(joints);                         // print joints at the entry time
            switch (mode)
            {
            case 1:     // mode.one_point_suturing
                state++;
                state++;
                break;

            case 2:     //mode.two_point_suturing
                trajectory.entry_point = NeedleKinematics.get_translation(needle.head);
                //trajectory.set_entry_needle(joints);
                state++;
                break;
            }
        }
 void get_p2()
 {
     this.p2 = NeedleKinematics.get_translation(M_target);
 }
 void get_p0()
 {
     this.p0 = NeedleKinematics.get_translation(M_initial);
 }