其他分享
首页 > 其他分享> > 运动监测

运动监测

作者:互联网

 private void timer1_Tick(object sender, EventArgs e)
        {
            if (wether_link == 0 || teaching_Box.Visible == false)
            {
                return;
            }
            else
            {
                for (int i = 0; i < axis_all.Length; i = i + 1)
                {
                    LTSMC.smc_get_encoder_unit(CardNum, axis_all[i], ref pos0[i]);//当前编码器位置
                    pos0[i] = pos0[i] / (fp / 360);
                    pos1[i] = pos0[i] * (fp / 360);
                }
                //textBox3.Text = pos1[2].ToString();
                //textBox2.Text = pos1[1].ToString();
                //textBox1.Text = pos1[0].ToString();
                J1_axis.Text = pos0[0].ToString();
                J2_axis.Text = pos0[1].ToString();
                J3_axis.Text = pos0[2].ToString();                                      //主动臂当前位置下转动角度

                Forward.foward_calculate(pos0[0], pos0[1], pos0[2]);
                x_axis.Text = Forward.instantaneous_Gx.ToString("F4");
                y_axis.Text = Forward.instantaneous_Gy.ToString("F4");
                z_axis.Text = Forward.instantaneous_Gz.ToString("F3");                  //当前位置下动平台相对于静坐标系的坐标

                LTSMC.smc_read_current_speed_unit(CardNum, axis_all[0], ref vel[0]);
                J1_speed.Text = ((vel[0] * 2 * Math.PI) / (10 * fp)).ToString();
                LTSMC.smc_read_current_speed_unit(CardNum, axis_all[1], ref vel[1]);
                J2_speed.Text = ((vel[1] * 2 * Math.PI) / (10 * fp)).ToString();
                LTSMC.smc_read_current_speed_unit(CardNum, axis_all[2], ref vel[2]);    //获取当前运动轴速度,单位:unit/s
                J3_speed.Text = ((vel[2] * 2 * Math.PI) / (10 * fp)).ToString();               //电机转轴角速度rad/s
            }
        }

private void timer3_Tick(object sender, EventArgs e)
{
LTSMC.smc_write_outbit(CardNum, 17, 0); //打开抱闸的IO(0,低电平。1,高电平)
timer3.Stop();
}

 

private void timer4_Tick(object sender, EventArgs e)
{
for (int i = 0; i < axis_all.Length; i = i + 1)
{
LTSMC.smc_write_sevon_pin(CardNum, axis_all[i], 1);//关闭伺服使能
}
timer4.Stop();
}

 

 

标签:Text,vel,ToString,监测,speed,运动,pos0,axis
来源: https://www.cnblogs.com/charles48789982/p/14348672.html