Пример #1
0
 private void textHomingMethod_Leave(object sender, EventArgs e)
 {
     // 設定回 Home 模式
     // textHomingMethod.Text = 1 : 往負方向運動,碰到極限開關後,反轉找第一個 pulse index
     // textHomingMethod.Text = 2 : 往正方向運動,碰到極限開關後,反轉找第一個 pulse index
     FormApp.BotEvaluateScript(textHomingMethod.Text + @" " + torqueDriveChannel.ToString() + @" " + torqueDriveSlave.ToString() + @" homing-method!");
 }
Пример #2
0
        private void textBoxAXPCLV_Leave(object sender, EventArgs e)
        {
            TextBox tb = (TextBox)sender;

            FormApp.BotEvaluateScript(tb.Text + " " + currAxis.ToString() + " ax-curr-limit!");
            axPCLVFocus = false;
        }
Пример #3
0
        private void buttonPull_Click(object sender, EventArgs e)
        {
            // 使用 torque.fs 內的 tq-release-go 指令
            // tq-release-go 是以指定的速度移動 textReleaseV 到目標點位置 textReleaseP
            double p, v;
            bool   pass = true;

            if (!double.TryParse(textReleaseP.Text, out p))
            {
                textReleaseP.Text      = "Error";
                textReleaseP.ForeColor = Color.Red;
                pass = false;
            }
            if (!double.TryParse(textReleaseV.Text, out v) || v < 0)
            {
                textReleaseV.Text      = "Error";
                textReleaseV.ForeColor = Color.Red;
                pass = false;
            }

            // deploy ... ;deploy 是用來將指令送到 NC Background task 執行,因為 tq-release-go 指令會等待位置到達後做後續的設定
            // 如果不送到 NC Background task 執行,則此 user task 會沒有回應。
            if (pass)
            {
                FormApp.BotEvaluateScript("deploy " + textReleaseP.Text + @"e mm " + textReleaseV.Text + @"e mm/min tq-release-go ;deploy");
            }
        }
Пример #4
0
 private void button1_Click(object sender, EventArgs e)
 {
     // 讓 torque.sfc 中的 SFC ,停止每個 real time 周期都送出 real torque。
     FormApp.BotEvaluateScript("false rt-info-output-enabled !");
     pauseEvent.Reset();
     plotEnabled = false;
 }
Пример #5
0
        private void textBoxAXACDEC_Leave(object sender, EventArgs e)
        {
            TextBox tb = (TextBox)sender;

            FormApp.BotEvaluateScript(tb.Text + " " + currAxis.ToString() + " ax-ac/dec!");
            axACDECFocus = false;
        }
Пример #6
0
 private void button2_Click(object sender, EventArgs e)
 {
     // 讓 torque.sfc 中的 SFC ,每個 real time 周期都送出 real torque (用來畫圖)。
     FormApp.BotEvaluateScript("true rt-info-output-enabled !");
     pauseEvent.Set();
     plotEnabled = true;
 }
Пример #7
0
 private void textBoxRetryCountMax_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         FormApp.BotEvaluateScript(((TextBox)sender).Text + @" feeder-retry-count-max ! .feeder-para");
     }
 }
Пример #8
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     textFollowingError.Text = FollowingError().ToString("F3");
     if (Math.Abs(FollowingError()) < 2.0)
     {
         textFollowingError.ForeColor = Color.Black;
     }
     else
     {
         textFollowingError.ForeColor = Color.Red;
     }
     if (torqueDriveSlave != 0)
     {
         // 回傳有差異的參數
         if (!FormApp.stopPolling)
         {
             FormApp.BotEvaluateScript(torqueDriveSlave.ToString() + @" .slave-diff");
         }
     }
     if (torqueAxisNumber != 0)
     {
         // "1 .axis" 回應的訊息範例如下:
         // axis_command_position.1|0.0000000|axis_demand_position.1|0.0000000|axis_corrected_position.1|0.0000000
         // |encoder_position.1|0.0000000|external_encoder_position.1|0.0000000|feedback_position.1|0.0000000
         // |position_correction.1|0.0000000|following_error.1|0.0000000|axis_interpolator_enabled.1|0|axis_homed.1
         // |0|axis_velocity.1|0.000000|axis_acceleration.1|0.000000
         // 其中 axis_command_position 是運動的目標位置
         //      axis_demand_position 是依加減速機制算出來當下應該要走到的位置
         if (!FormApp.stopPolling)
         {
             FormApp.BotEvaluateScript(torqueAxisNumber.ToString() + @" .axis");
         }
     }
 }
Пример #9
0
 private void textBoxSettlingDurationMs_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         FormApp.BotEvaluateScript(((TextBox)sender).Text + @" feeder-settling-duration! .feeder-para");
     }
 }
Пример #10
0
 private void textRotationSpeed_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         FormApp.BotEvaluateScript(textRotationSpeed.Text + @" feeder-rotation-speed! .feeder-para");
     }
 }
Пример #11
0
 private void textCylinderOffMs_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         FormApp.BotEvaluateScript(textCylinderOffMs.Text + @" cylinder-off-duration! .feeder-para");
     }
 }
Пример #12
0
 private void timer1s_Tick(object sender, EventArgs e)
 {
     if (feederReady && !sdoRequestSuspended && !FormApp.stopPolling)
     {
         FormApp.BotEvaluateScript(@"sdo-upload-tp-status");
     }
 }
Пример #13
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     if (!FormApp.stopPolling)
     {
         FormApp.BotEvaluateScript(currAxis.ToString() + @" .rcon-system");
     }
 }
Пример #14
0
 private void textBoxAXPCLV_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         TextBox tb = (TextBox)sender;
         FormApp.BotEvaluateScript(tb.Text + " " + currAxis.ToString() + " ax-curr-limit!");
         axPCLVFocus = false;
     }
 }
Пример #15
0
 private void buttonPLCEnable_Click(object sender, EventArgs e)
 {
     if ((sender as Button).Text == "Enable PLC")
     {
         FormApp.BotEvaluateScript(@"plc-enabled on");
     }
     else
     {
         FormApp.BotEvaluateScript(@"plc-enabled off");
     }
 }
Пример #16
0
 private void radioButtonAXBKRL_Click(object sender, EventArgs e)
 {
     if ((sender as RadioButton).Checked)
     {
         FormApp.BotEvaluateScript(currAxis.ToString() + @" -ax-bkrl");
     }
     else
     {
         FormApp.BotEvaluateScript(currAxis.ToString() + @" +ax-bkrl");
     }
 }
Пример #17
0
 private void radioButtonGWMON_Click(object sender, EventArgs e)
 {
     if ((sender as RadioButton).Checked)
     {
         FormApp.BotEvaluateScript(@"-gw-mon");
     }
     else
     {
         FormApp.BotEvaluateScript(@"+gw-mon");
     }
 }
Пример #18
0
 private void button4_Click(object sender, EventArgs e)
 {
     // 切換驅動器到 CSP Mode, 避免切換時跳異警,檢查或後誤差是否太大
     if (Math.Abs(FollowingError()) < 0.05)
     {
         FormApp.BotEvaluateScript(@"csp " + torqueDriveChannel.ToString() + @" " + torqueDriveSlave.ToString() + @" op-mode!");
     }
     else
     {
         new Thread(() => System.Windows.Forms.MessageBox.Show("Following Error Too Large")).Start();
     }
 }
Пример #19
0
 private void button7_Click(object sender, EventArgs e)
 {
     // 驅動器 Drive On 前檢查 following error
     if (Math.Abs(FollowingError()) < 0.05)
     {
         FormApp.BotEvaluateScript(torqueDriveChannel.ToString() + @" " + torqueDriveSlave.ToString() + @" drive-on");
     }
     else
     {
         new Thread(() => System.Windows.Forms.MessageBox.Show("Following Error Too Large")).Start();
     }
 }
Пример #20
0
        private void timerPoll_Tick(object sender, EventArgs e)
        {
            string cmd = "";

            if (driveDeviceSlave != 0 && driveDeviceChannel != 0)
            {
                cmd += (driveDeviceSlave.ToString() + @" .slave-diff ");
            }
            if (cylinderDeviceSlave != 0 && cylinderDeviceChannel != 0)
            {
                cmd += (cylinderDeviceSlave.ToString() + @" .slave-diff ");
            }
            if (feederReady)
            {
                cmd += @".feeder ";
            }
            if (!FormApp.stopPolling)
            {
                FormApp.BotEvaluateScript(cmd);
            }
        }
Пример #21
0
 private void textHomingAcc_Leave(object sender, EventArgs e)
 {
     // 設定回 Home 模式中的加速度,單位通常是 pulse/s^2,不同廠牌驅動器可能會不同
     FormApp.BotEvaluateScript(textHomingAcc.Text + @" " + torqueDriveChannel.ToString() + @" " + torqueDriveSlave.ToString() + @" homing-a!");
 }
Пример #22
0
 private void textHomingSpeed2_Leave(object sender, EventArgs e)
 {
     // 設定回 Home 模式中找 pulse index 的速度,單位通常是 pulse/s,不同廠牌驅動器可能會不同
     FormApp.BotEvaluateScript(textHomingSpeed2.Text + @" " + torqueDriveChannel.ToString() + @" " + torqueDriveSlave.ToString() + @" homing-v2!");
 }
Пример #23
0
 private void button15_Click(object sender, EventArgs e)
 {
     // 停止軸組運動
     FormApp.BotEvaluateScript(@"tq-release-stop");
 }
Пример #24
0
 private void textEncoderPPU_Leave(object sender, EventArgs e)
 {
     // 設定單位距離有幾個 encoder pulse 數量
     FormApp.BotEvaluateScript(textEncoderPPU.Text + @"e " + torqueAxisNumber.ToString() + @" enc-ppu! " + torqueAxisNumber.ToString() + @" .axiscfg");
 }
Пример #25
0
 public void Initialize()
 {
     // 取得裝置資訊
     FormApp.BotEvaluateScript(@".rcon-infos");
 }
Пример #26
0
 private void textAxisAmax_Leave(object sender, EventArgs e)
 {
     // 設定運動軸的最大加速度 (主站使用的是 SI 單位,線性軸是 m/s^2),設定完成後取回軸設定參數 (.axiscfg),
     // 用來看參數是否設定正確
     FormApp.BotEvaluateScript(textAxisAmax.Text + @"e " + torqueAxisNumber.ToString() + @" axis-amax! " + torqueAxisNumber.ToString() + @" .axiscfg");
 }
Пример #27
0
 private void textDriveSlavePosition_Leave(object sender, EventArgs e)
 {
     // 設定運動軸的對應的驅動器 slave position,如果沒有對應的驅動器,則是虛擬運動軸。
     // 設定完成後取回軸設定參數 (.axiscfg),用來看參數是否設定正確
     FormApp.BotEvaluateScript(textDriveSlavePosition.Text + @" " + torqueAxisNumber.ToString() + @" drv-slave! " + torqueAxisNumber.ToString() + @" .axiscfg");
 }
Пример #28
0
 private void textDriveChannel_Leave(object sender, EventArgs e)
 {
     // 設定運動軸的對應的驅動器的 Channel,如果沒有對應的驅動器,則是虛擬運動軸。
     // 設定完成後取回軸設定參數 (.axiscfg),用來看參數是否設定正確
     FormApp.BotEvaluateScript(textDriveChannel.Text + @" " + torqueAxisNumber.ToString() + @" drv-channel! " + torqueAxisNumber.ToString() + @" .axiscfg");
 }
Пример #29
0
 private void textGroupJmax_Leave(object sender, EventArgs e)
 {
     // 設定軸組對應的運動軸的最大加加速度,設定完成後取回軸組設定參數 (.grpcfg),用來看參數是否設定正確
     FormApp.BotEvaluateScript(textGroupJmax.Text + @"e " + torqueGroupNumber.ToString() + @" gjmax! " + torqueGroupNumber.ToString() + @" .grpcfg");
 }
Пример #30
0
 private void textGroupMapping_Leave(object sender, EventArgs e)
 {
     // 設定軸組對應的運動軸,設定完成後取回軸組設定參數 (.grpcfg),用來看參數是否設定正確
     FormApp.BotEvaluateScript(textGroupMapping.Text + @" " + torqueGroupNumber.ToString() + @" gmap! " + torqueGroupNumber.ToString() + @" .grpcfg");
 }