private void btnStart_Click(object sender, EventArgs e)
{
Single a, b, c;
a = 20.0F;
b = 20.0F;
c = 30.0F;
if (cmbPrograms.SelectedItem != null)
{
try
{
robot.StartJOG(0, 1, 0, a, b, c);
Thread.Sleep(1000);
robot.ImmStopJOG();
robot.StartJOG(0, 2, 1, a, b, c);
Thread.Sleep(1000);
string selectedProgram = cmbPrograms.SelectedItem.ToString();
robot.ProgramLoad("/fraser/" + selectedProgram);
int loadStatus = robot.ProgramLoad(selectedProgram);
Thread.Sleep(2000);
if (loadStatus == 0)
{
robot.Mode(0);
int num = robot.ProgramRun();
lblStatus.Text = $"Running the {selectedProgram}...";
robot.GetProgramState(ref state);
robot.GetCurrentLine(ref line);
robot.GetLoadedProgram(ref selectedProgram);
robot.ProgramStop();
robot.Mode(1);
}
else
{
lblStatus.Text = $"Failed to load {selectedProgram}.";
MessageBox.Show($"Failed to load program: {selectedProgram} (Error Code: {loadStatus})");
}
}
catch (Exception ex)
{
MessageBox.Show($"Error: {ex.Message}");
}
}
else
{
MessageBox.Show("Please select a Lua program first.");
}
}
I have an issue where when the i click start, the status will say “Running ” But the robot is not moving at all. I added the StartJOG function to test either my robot have connection or not and it moving but when i use the ProgramRun function, nothing happen. I used windows application program on C# to make an sdk. Already imported both dll that needed but still can’t move. The status send by ProgramLoad and ProgramRun is 0 which means it success but why the robot still not move like in the program. Can anyone help me?