private void buttonGoto_Click(object sender, EventArgs e) { if (m_moving == false) { m_tic.set_max_speed((int)numericUpDownSpeed.Value); m_tic.set_target_position((int)numericUpDownPosition.Value); m_moving = true; buttonGoto.Text = "STOP"; } else { m_tic.halt_and_hold(); buttonGoto.Text = "GOTO"; m_moving = true; } buttonHome.Enabled = !m_moving; checkBoxJogLeft.Enabled = !m_moving; checkBoxJogRigth.Enabled = !m_moving; }
/// <summary> /// Default constructor /// </summary> /// <param name="serialNo">The serial number of the controller</param> /// <remarks>TODO: make sure all errors are handled so the server can run smoothly</remarks> public TicMotor(string serialNo) { this.serial = serialNo; try { TryReconnect(); // open the motor so we can handle errors and set the max velocity ticController.set_max_speed((int)CONSTANTS.MAX_VELOCITY); ticController.set_starting_speed(5000000); ticController.set_max_accel(3000000); ticController.set_max_decel(3000000); } catch (Exception e) { Console.Write("[TicMotorError] : " + e.StackTrace); } }