其他分享
首页 > 其他分享> > 回零、机构设定功能

回零、机构设定功能

作者:互联网

        public static double a1, a2, a3;  //静平台半径
        public static double b1, b2, b3;  //动平台半径
        public static double l1, l2, l3;  //主动臂杆长
        public static double q1, q2, q3;  //从动臂杆长
        public static double k1_max, k1_min;
        public static double k2_max, k2_min;
        public static double k3_max, k3_min;
        public static double theta1_max, theta1_min;
        public static double theta2_max, theta2_min;
        public static double theta3_max, theta3_min;
        //暂存上一时刻尺度
        double s_a1, s_a2, s_a3;
        double s_b1, s_b2, s_b3;  //动平台半径
        double s_l1, s_l2, s_l3;  //主动臂杆长
        double s_q1, s_q2, s_q3;  //从动臂杆长
        double s_k1_max, s_k1_min;
        double s_k2_max, s_k2_min;
        double s_k3_max, s_k3_min;
        double s_theta1_max, s_theta1_min;
        double s_theta2_max, s_theta2_min;
        double s_theta3_max, s_theta3_min;


 private void reset_Click(object sender, EventArgs e)
        {
            if (wether_link == 0)
            {
                MessageBox.Show("请先打开设备!");
                return;
            }
            if (SF == 0)
            {
                MessageBox.Show("伺服未开启!");
                return;
            }
            if (LTSMC.smc_check_done_multicoor(CardNum, 0) == 0)
            {
                MessageBox.Show("电机运动中,请稍后尝试!", "提示");
                return;
            }
            comeback(); 
        }
private void comeback()
        {
            double speed = gear * decimal.ToDouble(back_speed.Value) * (fp / (2 * Math.PI));    
            LTSMC.smc_set_vector_profile_unit(CardNum, 0, start, speed, acc, dec, stop);//设置插补运动速度参数
            for (int i = 0; i < axis_all.Length; i = i + 1)
            {
                LTSMC.smc_set_equiv(CardNum, axis_all[i], 1);//设置脉冲当量
                LTSMC.smc_set_alm_mode(CardNum, axis_all[i], 0, 0, 0);//设置报警使能,关闭报警             
            }
            ThreadPool.QueueUserWorkItem(
                delegate
                {
                    LTSMC.smc_conti_set_lookahead_mode(CardNum, 0, 2, 2, 0.1, 1000);//设置连续插补前瞻模式及参数
                    LTSMC.smc_conti_open_list(CardNum, 0, 3, axis_all);//打开连续插补缓冲区
                    LTSMC.smc_conti_line_unit(CardNum, 0, 3, axis_all, new double[] { 0, 0, 0 }, 1, 0);
                    LTSMC.smc_conti_start_list(CardNum, 0);//启动插补
                    LTSMC.smc_conti_close_list(CardNum, 0);//关闭连续插补缓冲区
                }
                );
        }

 private void machine_seting_Click(object sender, EventArgs e)
        {
            int locatin_x = 12;
            int locantion_y = 80;
            Point newPoint = new Point();
            newPoint.X = locatin_x;
            newPoint.Y = locantion_y;
            machine_seting_Box.Location = newPoint;
            machine_seting_Box.Visible = true;
            teaching_Box.Visible = false;
            machine_seting.BackColor = Color.Green;
            moateaching.BackColor = Color.Transparent;
            programming.BackColor = Color.Transparent;
            reset.BackColor = Color.Transparent;
            close_SF.BackColor = Color.Transparent;
            open_SF.BackColor = Color.Transparent;
        }
 public void read_dimention()
        {
            a1 = Convert.ToDouble(value_a1.Text);       
            a2 = Convert.ToDouble(value_a2.Text);
            a3 = Convert.ToDouble(value_a3.Text);
            b1 = Convert.ToDouble(value_b1.Text);
            b2 = Convert.ToDouble(value_b2.Text);
            b3 = Convert.ToDouble(value_b3.Text);
            l1 = Convert.ToDouble(value_l1.Text);
            l2 = Convert.ToDouble(value_l2.Text);
            l3 = Convert.ToDouble(value_l3.Text);
            q1 = Convert.ToDouble(value_q1.Text);
            q2 = Convert.ToDouble(value_q2.Text);
            q3 = Convert.ToDouble(value_q3.Text);
            k1_max = Convert.ToDouble(value_k1_max.Text);
            k1_min = Convert.ToDouble(value_k1_min.Text);
            k2_max = Convert.ToDouble(value_k2_max.Text);
            k2_min = Convert.ToDouble(value_k2_min.Text);
            k3_max = Convert.ToDouble(value_k3_max.Text);
            k3_min = Convert.ToDouble(value_k3_min.Text);
            theta1_max = Convert.ToDouble(value_theta1_max.Text);
            theta1_min = Convert.ToDouble(value_theta1_min.Text);
            theta2_max = Convert.ToDouble(value_theta2_max.Text);
            theta2_min = Convert.ToDouble(value_theta2_min.Text);
            theta3_max = Convert.ToDouble(value_theta3_max.Text);
            theta3_min = Convert.ToDouble(value_theta3_min.Text);
        }
        public void save_dimention()
        {
            s_a1 = a1; s_a2 = a2; s_a3 = a3;
            s_b1 = b1; s_b2 = b2; s_b3 = b3;
            s_l1 = l1; s_l2 = l2; s_l3 = l3;
            s_q1 = q1; s_q2 = q2; s_q3 = q3;
            s_k1_max = k1_max; s_k2_max = k2_max; s_k3_max = k3_max;
            s_k1_min = k1_min; s_k2_min = k2_min; s_k3_min = k3_min;
            s_theta1_max = theta1_max; s_theta2_max = theta2_max; s_theta3_max = theta3_max;
            s_theta1_min = theta1_min; s_theta2_min = theta2_min; s_theta3_min = theta3_min;
        }
        //确认修改尺度
        private void dimention_change_Click(object sender, EventArgs e)
        {
            read_dimention();
            save_dimention();  //保存之前的记录
            MessageBox.Show("尺度已更改!");
        }
        //取消尺度修改
        private void dimention_cancel_Click(object sender, EventArgs e)
        {
            value_a1.Text = s_a1.ToString(); value_a2.Text = s_a2.ToString(); value_a3.Text = s_a3.ToString();
            value_b1.Text = s_b1.ToString(); value_b2.Text = s_b2.ToString(); value_b3.Text = s_b3.ToString();
            value_l1.Text = s_l1.ToString(); value_l2.Text = s_l2.ToString(); value_l3.Text = s_l3.ToString();
            value_q1.Text = s_q1.ToString(); value_q2.Text = s_q2.ToString(); value_q3.Text = s_q3.ToString();
            value_k1_max.Text = s_k1_max.ToString();
            value_k2_max.Text = s_k2_max.ToString();
            value_k3_max.Text = s_k3_max.ToString();
            value_k1_min.Text = s_k1_min.ToString();
            value_k2_min.Text = s_k2_min.ToString();
            value_k3_min.Text = s_k3_min.ToString();
            value_theta1_max.Text = s_theta1_max.ToString();
            value_theta2_max.Text = s_theta2_max.ToString();
            value_theta3_max.Text = s_theta3_max.ToString();
            value_theta1_min.Text = s_theta1_min.ToString();
            value_theta2_min.Text = s_theta2_min.ToString();
            value_theta3_min.Text = s_theta3_min.ToString();
        }

 

标签:设定,min,Text,功能,value,ToDouble,回零,max,ToString
来源: https://www.cnblogs.com/charles48789982/p/14332278.html