public void uninit() { ROS.shutdown(); ROS.waitForShutdown(); isConnect = false; }
private static void Main(string[] args) { ROS.Init(args, "Listener"); NodeHandle node = new NodeHandle(); Subscriber <m.String> Subscriber = node.subscribe <m.String>("/chatter", 1, chatterCallback); ROS.waitForShutdown(); }
static void Main(string[] args) { string NODE_NAME = "ServiceClientTest"; try { ROS.Init(ref args, NODE_NAME + DateTime.Now.Ticks); var spinner = new AsyncSpinner(); spinner.Start(); } catch (RosException e) { ROS.Critical()("ROS.Init failed, shutting down: {0}", e.Message); ROS.shutdown(); ROS.waitForShutdown(); return; } try { var nodeHandle = new NodeHandle(); while (ROS.ok) { Random r = new Random(); TwoInts.Request req = new TwoInts.Request() { a = r.Next(100), b = r.Next(100) }; TwoInts.Response resp = new TwoInts.Response(); DateTime before = DateTime.Now; bool res = nodeHandle.serviceClient <TwoInts.Request, TwoInts.Response>("/add_two_ints").call(req, ref resp); TimeSpan dif = DateTime.Now.Subtract(before); string str = ""; if (res) { str = "" + req.a + " + " + req.b + " = " + resp.sum + "\n"; } else { str = "call failed after "; } str += Math.Round(dif.TotalMilliseconds, 2) + " ms"; ROS.Info()(str); Thread.Sleep(1000); } } catch (RosException e) { ROS.Critical()("Shutting down: {0}", e.Message); } ROS.shutdown(); ROS.waitForShutdown(); }
protected override void OnClosed(EventArgs e) { if (!closing) { closing = true; pubthread.Join(); } ROS.shutdown(); ROS.waitForShutdown(); base.OnClosed(e); }
static void Main(string[] args) { ROS.Init(args, "MoveitTest"); NodeHandle node = new NodeHandle(); gm.PoseStamped result = SetPose(-0.1, 0.1, 0.2, 0.0, 180.0, 0.0, ""); Console.WriteLine("result"); Console.WriteLine(result); GetIK(node, result, "endeffector"); ROS.waitForShutdown(); }
private static void Main(string[] args) { Trace.Listeners.Add(new TextWriterTraceListener(Console.Out)); ROS.Init(args, "Listener"); var spinner = new AsyncSpinner(); spinner.Start(); NodeHandle node = new NodeHandle(); Subscriber Subscriber = node.subscribe <std_msgs.String>("/chatter", 1, chatterCallback); ROS.waitForShutdown(); }
static void Main(string[] args) { // Setup the logging system var loggerFactory = new LoggerFactory(); loggerFactory.AddProvider( new ConsoleLoggerProvider( (string text, LogLevel logLevel) => { return(logLevel >= LogLevel.Information); }, true) ); Logger = ApplicationLogging.CreateLogger(nameof(Main)); ROS.SetLoggerFactory(loggerFactory); NodeHandle nodeHandle; string NODE_NAME = "ServiceServerTest"; ServiceServer server; try { ROS.Init(new string[0], NODE_NAME); } catch (RosException e) { Logger.LogCritical("ROS.Init failed, shutting down: {0}", e.Message); ROS.shutdown(); ROS.waitForShutdown(); return; } try { nodeHandle = new NodeHandle(); server = nodeHandle.advertiseService <TwoInts.Request, TwoInts.Response>("/add_two_ints", addition); while (ROS.ok && server.IsValid) { Thread.Sleep(10); } } catch (RosException e) { Logger.LogCritical("Shutting down: {0}", e.Message); } ROS.shutdown(); ROS.waitForShutdown(); }
private static void Main(string[] args) { ROS.Init(args, "Talker"); NodeHandle node = new NodeHandle(); Publisher <m.String> Talker = node.advertise <m.String>("/chatter", 1); int count = 0; while (ROS.ok) { ROS.Info("Publishing a chatter message: \"Blah blah blah " + count + "\""); String pow = new String("Blah blah blah " + (count++)); Talker.publish(pow); Thread.Sleep(1000); } ROS.shutdown(); ROS.waitForShutdown(); }
public static void StopROS(Action callback = null) { if (ROS.isStarted() && !ROS.shutting_down && !instance.stopping) { // instance.status = ROSStatus.Disconnected; instance.starting = false; instance.stopping = true; while (nodes.Count > 0) { NodeHandle node = nodes.Dequeue(); node.shutdown(); node.Dispose(); } Debug.Log("stopping ROS"); ROS.shutdown(); ROS.waitForShutdown(); } if (callback != null) { callback(); } }
static void Main(string[] args) { NodeHandle nodeHandle; string NODE_NAME = "ServiceServerTest"; ServiceServer server; try { ROS.Init(new string[0], NODE_NAME); var spinner = new AsyncSpinner(); spinner.Start(); } catch (RosException e) { ROS.Critical()("ROS.Init failed, shutting down: {0}", e.Message); ROS.shutdown(); ROS.waitForShutdown(); return; } try { nodeHandle = new NodeHandle(); server = nodeHandle.advertiseService <TwoInts.Request, TwoInts.Response>("/add_two_ints", addition); while (ROS.ok && server.IsValid) { Thread.Sleep(10); } } catch (RosException e) { ROS.Critical()("Shutting down: {0}", e.Message); } ROS.shutdown(); ROS.waitForShutdown(); }
public static void StopROS() { if (ROS.isStarted() && !ROS.shutting_down && roslock.WaitOne()) { if (ROS.isStarted() && !ROS.shutting_down) { Debug.Log("ROSManager is shutting down"); ROS.shutdown(); } roslock.Set(); } ROS.waitForShutdown(); #if LOG_TO_FILE lock (loggerlock) { Application.logMessageReceived -= Application_logMessageReceived; if (logwriter != null) { logwriter.Close(); logwriter = null; } } #endif }
protected override void OnClosing(System.ComponentModel.CancelEventArgs e) { ROS.shutdown(); ROS.waitForShutdown(); base.OnClosing(e); }
void OnApplicationQuit() { ROS.shutdown(); ROS.waitForShutdown(); }
void OnApplicationQuit() { ROS.shutdown(); ROS.waitForShutdown(); pub_thread.Abort(); }
protected override void OnClosed(EventArgs e) { ROS.shutdown(); ROS.waitForShutdown(); base.OnClosed(e); }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { ROS.shutdown(); ROS.waitForShutdown(); topicPoller.Join(); }
static void Main(string[] args) { string NODE_NAME = "ServiceClientTest"; var loggerFactory = new LoggerFactory(); loggerFactory.AddProvider( new ConsoleLoggerProvider( (string text, LogLevel logLevel) => { return(logLevel >= LogLevel.Debug); }, true) ); Logger = ApplicationLogging.CreateLogger(nameof(Main)); ROS.SetLoggerFactory(loggerFactory); try { ROS.Init(new string[0], NODE_NAME + DateTime.Now.Ticks); } catch (RosException e) { Logger.LogCritical("ROS.Init failed, shutting down: {0}", e.Message); ROS.shutdown(); ROS.waitForShutdown(); return; } try { var nodeHandle = new NodeHandle(); while (ROS.ok) { Random r = new Random(); TwoInts.Request req = new TwoInts.Request() { a = r.Next(100), b = r.Next(100) }; TwoInts.Response resp = new TwoInts.Response(); DateTime before = DateTime.Now; bool res = nodeHandle.serviceClient <TwoInts.Request, TwoInts.Response>("/add_two_ints").call(req, ref resp); TimeSpan dif = DateTime.Now.Subtract(before); string str = ""; if (res) { str = "" + req.a + " + " + req.b + " = " + resp.sum + "\n"; } else { str = "call failed after "; } str += Math.Round(dif.TotalMilliseconds, 2) + " ms"; Logger.LogInformation(str); Thread.Sleep(1000); } } catch (RosException e) { Logger.LogCritical("Shutting down: {0}", e.Message); } ROS.shutdown(); ROS.waitForShutdown(); }
public void Close() { ROS.shutdown(); ROS.waitForShutdown(); }