/// <summary> /// Initializes a new instance of the <see cref="BaseComm"/> class. /// </summary> public BaseCommExample() { // Set up communication with the robot and initialize force to zero robot = new RobotClient(); var version = robot.GetVersion(); Barrett.Logger.Debug(Barrett.Logger.INFO, version.ToString()); robot.SendCartesianForces(Vector3.zero); // Set up keyboard callbacks. PrintUsage needs to be updated when these are changed. keyboardManager = new Barrett.KeyboardManager(); keyboardManager.SetDebug(true); // print key pressed keyboardManager.AddKeyPressCallback("q", Close); // this will call the Close method when 'q' is pressed keyboardManager.AddKeyPressCallback("h", OnHome); keyboardManager.AddKeyPressCallback("e", OnEnable); keyboardManager.AddKeyPressCallback("d", OnDisable); keyboardManager.AddKeyPressCallback("t", SubscribeToUpdate); PrintUsage(); // Loop: send zero force at every timestep. bool running = true; while (running) { running = ReadKeyPress(); Thread.Sleep(50); robot.SendCartesianForces(Vector3.zero); } }