private void timer1_Tick(object sender, EventArgs e) { if (aRTClient.Status == RTClientStatus.Syncing) { RTClientObj aObj = aRTClient.getRTClientObj(); textBox5.Text = aObj.actual_TCP_pose.ToString(); } if (aRTDE.isSynchronizing) { RTDEOutputObj OutObj = aRTDE.getOutputObj(); textBox7.Text = "Actual tcp pose: " + OutObj.actual_TCP_pose.ToString() + "\n"; textBox7.Text = textBox7.Text + " Elbow position: " + OutObj.elbow_position.ToString(); } }
/// <summary> /// 计时器触发 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private IEnumerator timer1_Tick() { while (true) { #region 读取机器人状态 Vector6 <double> l4 = null; //Vector6<double> j = null; if (aRTClient.Status == RTClientStatus.Syncing) { RTClientObj aRTClientObj = aRTClient.getRTClientObj(); //读取aRTClientObj double currenttime = aRTClientObj.timestamp; Vector6 <double> a = aRTClientObj.actual_current; ulong b = aRTClientObj.actual_digital_input_bits; ulong c = aRTClientObj.actual_digital_output_bits; double d = aRTClientObj.actual_execution_time; Vector6 <double> e1 = aRTClientObj.actual_joint_voltage;//真实关节电压 double f = aRTClientObj.actual_main_voltage; double g = aRTClientObj.actual_momentum; double h = aRTClientObj.actual_momentum_internal1; double i = aRTClientObj.actual_momentum_internal2; j = aRTClientObj.actual_q; //关节真实位置 Vector6 <double> k = aRTClientObj.actual_qd; //关节真实速度 double l = aRTClientObj.actual_robot_current; //机器人真实电流 double l2 = aRTClientObj.actual_robot_voltage; //机器人真实市电电压 Vector6 <double> l3 = aRTClientObj.actual_TCP_force; //tcp的真实受力 l4 = aRTClientObj.actual_TCP_pose; //TCP的真实位置 Vector6 <double> l5 = aRTClientObj.actual_TCP_speed; //tcp的真实速度 Vector3 <double> l6 = aRTClientObj.actual_tool_accelerometer; Vector6 <double> l7 = aRTClientObj.actual_tool_accelerometer_internal; double l8 = aRTClientObj.elbow_position; double l9 = aRTClientObj.elbow_velocity; Vector6 <double> l10 = aRTClientObj.joint_control_output; Vector6 <int> l11 = aRTClientObj.joint_mode; Vector6 <double> l12 = aRTClientObj.joint_temperatures; double l13 = aRTClientObj.program_state; double l14 = aRTClientObj.robot_mode; double l15 = aRTClientObj.safety_mode; Vector6 <double> l16 = aRTClientObj.safety_mode_internal; double l17 = aRTClientObj.speed_scaling; Vector6 <double> l18 = aRTClientObj.target_current; Vector6 <double> l19 = aRTClientObj.target_moment; Vector6 <double> l20 = aRTClientObj.target_q; //关节目标位置,单位是弧度 Vector6 <double> l21 = aRTClientObj.target_qd; //关节目标速度 Vector6 <double> l22 = aRTClientObj.target_qdd; //关节目标加速度 Vector6 <double> l23 = aRTClientObj.target_TCP_pose; //TCP目标位姿 Vector6 <double> l24 = aRTClientObj.target_TCP_speed; //TCP目标速度 double l25 = aRTClientObj.test_value; //使用aRTClientObj中的数据 //aRTClient.sendScript("movel(p[" + j1.ToString() + ",0.2,0.3,0,0,0],a=0.8,v=0.5)"); //发送脚本给机器人; //aRTClient.sendScript("rv=[1,2,1]"); //发送脚本给机器人 } //TCP当前位置 if (l4 != null) { //ActTCPTB_X.Text = (l4.X * 1000).ToString("0.00"); //ActTCPTB_Y.Text = (l4.Y * 1000).ToString("0.00"); //ActTCPTB_Z.Text = (l4.Z * 1000).ToString("0.00"); //ActTCPTB_RX.Text = (l4.Rx * 1000).ToString("0.00"); //ActTCPTB_RY.Text = (l4.Ry * 1000).ToString("0.00"); //ActTCPTB_RZ.Text = (l4.Rz * 1000).ToString("0.00"); } //关节当前位置 if (j != null) { Pos[0].text = (j.X * 180 / PI).ToString("0.00"); Pos[1].text = (j.Y * 180 / PI).ToString("0.00"); Pos[2].text = (j.Z * 180 / PI).ToString("0.00"); Pos[3].text = (j.Rx * 180 / PI).ToString("0.00"); Pos[4].text = (j.Ry * 180 / PI).ToString("0.00"); Pos[5].text = (j.Rz * 180 / PI).ToString("0.00"); } yield return(new WaitForSeconds(0.1f)); #endregion } }