private void Connect_Click(object sender, RoutedEventArgs e) { // Connet UR Secondary Port urSec = IURSecondaryConnection.Create(IPAddress.Text); var resp = urSec.Receive(); // Connet UR RTDE port rtde = IURRTDEConnection.Create(IPAddress.Text); var np = new NegotiateProtocolVersion(rtde); Logging.Text += $"NegotiateProtocolVersion Accepted: { np.Accepted }"; ControllerVersion cv = new ControllerVersion(rtde); Logging.Text += $"Controller Version: major { cv.Major }" + $" minor { cv.Minor } bugfix { cv.Bugfix } build { cv.Build }"; string vars = "timestamp,actual_TCP_pose,actual_q,runtime_state"; SetupOutput setupOut = new SetupOutput(rtde, 125, vars); Logging.Text += $"Setup Output: output recipe id { setupOut.OutputRecipeId }" + $" variable types { setupOut.VariableTypes }"; var ss = new StartSending(rtde); rd = new ReceiveData(rtde, setupOut.VariableTypes); var task = new Task(() => ReceiveRTDE()); task.Start(); }
public static string CMD_GET_VERSION() { var cmdBuffer = new byte[64]; cmdBuffer[0] = 6; var response = UsbDriver.CMD(cmdBuffer); var version = new ControllerVersion(response); return(version.ToString()); }
private void Connect_Click(object sender, RoutedEventArgs e) { dashboard = IURDashboardConnection.Create(IPAddress.Text); secondary = IURSecondaryConnection.Create(IPAddress.Text); // Connet UR RTDE port rtde = IURRTDEConnection.Create(IPAddress.Text); var np = new NegotiateProtocolVersion(rtde); ControllerVersion cv = new ControllerVersion(rtde); string vars = "timestamp,actual_TCP_pose,runtime_state"; SetupOutput setupOut = new SetupOutput(rtde, 125, vars); var ss = new StartSending(rtde); rd = new ReceiveData(rtde, setupOut.VariableTypes); var taskRTDEReceiving = new Task(() => RTDEReceiving()); taskRTDEReceiving.Start(); }
/// <summary> /// 检查类型是否正确 /// FT8000 FT8003 都是老版本7位 /// NT8001 存在老板本7位 与 新版本7位 与 新版本8位 /// NT8007 NT8021 NT8036 NT8053 都是新版本8位 /// </summary> /// <returns></returns> private static bool CheckIsValidType(NTP ntp) { bool result = false; switch (CurrentContrllerType) { case ControllerType.FT8000: if (ntp.Content != null && ntp.Content.Length >= 2) { if (ntp.Content[0] == 0x80 && ntp.Content[1] == 0x00) { result = true; } } break; case ControllerType.FT8003: if (ntp.Content != null && ntp.Content.Length >= 2) { if (ntp.Content[0] == 0x80 && ntp.Content[1] == 0x03) { result = true; } } break; case ControllerType.NT8001: if (ntp.Content != null && ntp.Content.Length >= 2) { if (ntp.Content[0] == 0x80 && (ntp.Content[1] == 0x06 || ntp.Content[1] == 0x01)) { if (ntp.Content[1] == 0x06) { CurrentControllerVersion = ControllerVersion.NewVersion8; } else if (ntp.Content[1] == 0x01 && ntp.Content.Length > 2) { CurrentControllerVersion = ControllerVersion.NewVersion7; } else { CurrentControllerVersion = ControllerVersion.OldVersion7; //老版本中不存在 最后的版本号 } result = true; } } break; case ControllerType.NT8007: if (ntp.Content != null && ntp.Content.Length >= 2) { if (ntp.Content[0] == 0x80 && ntp.Content[1] == 0x07) { result = true; } } break; case ControllerType.NT8021: if (ntp.Content != null && ntp.Content.Length >= 2) { if (ntp.Content[0] == 0x80 && ntp.Content[1] == 0x21) { result = true; } } break; case ControllerType.NT8036: if (ntp.Content != null && ntp.Content.Length >= 2) { if (ntp.Content[0] == 0x80 && ntp.Content[1] == 0x36) { result = true; } } break; case ControllerType.NT8053: if (ntp.Content != null && ntp.Content.Length >= 2) { if (ntp.Content[0] == 0x80 && ntp.Content[1] == 0x53) { result = true; } } break; } return(result); }