static async Task RunWithRunLoop() { var httpClient = await RobotClientProvider.GetHttpClientAsync(hostname); var yumi = new RemoteYumi(hostname, httpClient); await yumi.Init(); await yumi.RunProcedureForBothArms("NoClue"); }
static async Task RunWithProgramPointer() { // Using this method to get the HttpClient ensures that we are already logged in to the // robot when we try to send commands later. var httpClient = await RobotClientProvider.GetHttpClientAsync(hostname); // The RemoteYumi class represents the whole robot. var yumi = new RemoteYumi(hostname, httpClient); // We must set the program pointer to the routine we want to run for each arm. await yumi.LeftArm.SetPPToRoutine("Gestures", "NoClue"); await yumi.RightArm.SetPPToRoutine("Gestures", "NoClue"); // To actually get the robot to move the execution must be started. await yumi.StartExecution(); }
static void Init() { var httpClient = RobotClientProvider.GetHttpClientAsync(hostname).Result; Program.yumi = new RemoteYumi(hostname, httpClient); Program.yumi.Init().Wait(); Program.yumi.RunProcedureForBothArms("Home").Wait(); Program.yumi.LeftArm.RunProcedure("HandUp"); Console.WriteLine(" ==== INIT COMPLETE === "); try { //RunWithProgramPointer().Wait(); //RunWithRunLoop().Wait(); Test().Wait(); } catch (Exception ex) { Console.WriteLine(ex); } }
static void Main(string[] args) { //string url = "192.168.54.108"; string url = "localhost"; var rightArm = new RemoteRobot(url, "T_ROB_R", RobotClientProvider.GetHttpClient(url)); var leftArm = new RemoteRobot(url, "T_ROB_L", RobotClientProvider.GetHttpClient(url)); Task.WhenAll( rightArm.RunProcedure("wavehigh"), leftArm.RunProcedure("wavelow")) .Wait(); Console.WriteLine("Flip"); Task.Delay(2000).Wait(); Task.WhenAll( rightArm.RunProcedure("wavelow"), leftArm.RunProcedure("wavehigh")) .Wait(); Console.WriteLine("Done"); Console.ReadKey(); }