Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

RosManager.Initialize to static constructor

  • Loading branch information...
commit 635f6e4225baef591146a487609c3d47478fec32 1 parent 9adf729
ZOETROPE authored

Showing 26 changed files with 48 additions and 65 deletions. Show diff stats Hide diff stats

  1. +0 1  App/RosCore/Program.cs
  2. +12 15 Doc/source/index-en.rst
  3. +10 15 Doc/source/index-ja.rst
  4. +0 1  RosSharp.IntegrationTests/ParameterServerTest.cs
  5. +0 1  RosSharp.IntegrationTests/PublisherAndSubscriberTest.cs
  6. +0 1  RosSharp.IntegrationTests/ServerAndClientTest.cs
  7. +0 1  RosSharp.Tests/Node/RosNodeTest.cs
  8. +0 1  RosSharp.Tests/Parameter/ParameterServerTest.cs
  9. +0 4 RosSharp.Tests/ROSTest.cs
  10. +1 0  RosSharp.Tests/SandBoxTest.cs
  11. +0 1  RosSharp.Tests/Slave/SlaveServerTest.cs
  12. +0 1  RosSharp.Tests/Topic/PublisherTest.cs
  13. +0 1  RosSharp.Tests/Topic/RosTopicClientTest.cs
  14. +0 1  RosSharp.Tests/Topic/RosTopicServerTest.cs
  15. +0 5 RosSharp.Tests/Transport/TcpRosHeaderTest.cs
  16. +20 2 RosSharp/Node/RosNode.cs
  17. +2 1  RosSharp/Parameter/Parameter.cs
  18. +1 1  RosSharp/RosManager.cs
  19. +0 5 RosSharp/RosSharp.csproj
  20. +0 1  Sample/Client/Program.cs
  21. +0 1  Sample/Listener/Program.cs
  22. +0 1  Sample/ParameterClient/Program.cs
  23. +0 1  Sample/Server/Program.cs
  24. +2 3 Sample/Talker/Program.cs
  25. BIN  Utility/RosSharp.0.1.0-beta.nupkg
  26. BIN  Utility/RosSharp.0.1.0.nupkg
1  App/RosCore/Program.cs
@@ -8,7 +8,6 @@ class Program
8 8 {
9 9 static void Main(string[] args)
10 10 {
11   - RosManager.Initialize();
12 11
13 12 int portNumber = 11311;
14 13
27 Doc/source/index-en.rst
Source Rendered
@@ -3,18 +3,19 @@ RosSharp Documentation
3 3
4 4 Overview
5 5 ***************************************************
6   -RosSharp is C# client library for ROS (Robot Operating System).
  6 +RosSharp is C# client library for ROS.
7 7
8   -Copyright (c) 2012 zoetrope. All Rights Reserved.
  8 +`ROS <http://ros.org/>`_ is Robot Operating System developed by `Willow Garage <http://www.willowgarage.com/>`_.
9 9
10   -Licensed undear the BSD License
11   -
12   -Source: https://github.com/zoetrope/RosSharp
  10 +* Author: `zoetrope <https://twitter.com/#!/zoetro>`_
  11 +* Source: https://github.com/zoetrope/RosSharp
  12 +* License: `BSD License <https://github.com/zoetrope/RosSharp/blob/master/License.txt>`_
13 13
14 14 Features:
  15 +==================================================
15 16
16 17 * RosSharp is implemented based on Reactive Extensions
17   -* NuGet installation support
  18 +* `NuGet <http://nuget.codeplex.com/>`_ installation support
18 19 * Create ROS Node
19 20 * Master/Slave/ParameterServer API XML-RPC Client
20 21 * Master/Slave/ParameterServer API XML-RPC Server
@@ -25,29 +26,24 @@ Features:
25 26 * GenMsg (Code generation tool from .msg/.srv files)
26 27
27 28 The following features are not supported:
  29 +==================================================
28 30
29 31 * Remapping Arguments
30 32 * Graph Resource Names (supports only the global name)
31 33 * Clock Node
32 34 * roslang
33 35
34   -
35   -
36   -Requirements
  36 +System Requirements
37 37 ***************************************************
38 38
39 39 * .NET Framework 4
40   -
41 40 * Reactive Extensions
42 41 * Common.Logging
43 42 * XML-RPC.NET
44 43 * NDesk.Options
45   -
46 44 * F# Runtime 2.0 (for GenMsg)
47 45 * FParsec (for GenMsg)
48 46
49   -
50   -
51 47 Installation
52 48 ***************************************************
53 49
@@ -58,6 +54,8 @@ To install RosSharp, run the following command in the NuGet Package Manager Cons
58 54
59 55 PM> Install-Package RosSharp
60 56
  57 +http://nuget.org/packages/RosSharp
  58 +
61 59 Binary Package
62 60 ==================================================
63 61
@@ -78,7 +76,6 @@ Configuring in your code
78 76
79 77 .. code-block:: csharp
80 78
81   - ROS.Initialize();
82 79 ROS.HostName = "192.168.1.11";
83 80 ROS.MasterUri = new Uri("http://192.168.1.10:11311");
84 81 ROS.TopicTimeout = 3000;
@@ -177,7 +174,7 @@ Create Node
177 174
178 175 .. code-block:: csharp
179 176
180   - var node = ROS.CreateNode("Test");
  177 + var node = RosManager.CreateNode("Test");
181 178
182 179
183 180 Create Subscriber
25 Doc/source/index-ja.rst
Source Rendered
@@ -3,18 +3,19 @@ RosSharpドキュメント
3 3
4 4 概要
5 5 ***************************************************
6   -RosSharpは、ROS (Robot Operating System)のC#クライアントライブラリです。
  6 +RosSharpは、ROSのC#クライアントライブラリです。
7 7
8   -Copyright (c) 2012 zoetrope. All Rights Reserved.
  8 +`ROS <http://ros.org/>`_ は `Willow Garage <http://www.willowgarage.com/>`_ の開発するRobot Operating Systemです。
9 9
10   -Licensed undear the BSD License
11   -
12   -ソースコード: https://github.com/zoetrope/RosSharp
  10 +* Author: `zoetrope <https://twitter.com/#!/zoetro>`_
  11 +* Source: https://github.com/zoetrope/RosSharp
  12 +* License: `BSD License <https://github.com/zoetrope/RosSharp/blob/master/License.txt>`_
13 13
14 14 特徴:
  15 +==================================================
15 16
16   -* RosSharpは、Reactive Extensionsをベースにして実装しています。
17   -* NuGetでのインストールをサポートしています。
  17 +* RosSharp is implemented based on Reactive Extensions
  18 +* `NuGet <http://nuget.codeplex.com/>`_ installation support
18 19 * Create ROS Node
19 20 * Master/Slave/ParameterServer API XML-RPC Client
20 21 * Master/Slave/ParameterServer API XML-RPC Server
@@ -25,29 +26,24 @@ Licensed undear the BSD License
25 26 * GenMsg (Code generation tool from .msg/.srv files)
26 27
27 28 未実装機能:
  29 +==================================================
28 30
29 31 * Remapping Arguments
30 32 * Graph Resource Names (supports only the global name)
31 33 * Clock Node
32 34 * roslang
33 35
34   -
35   -
36   -環境
  36 +システム要件
37 37 ***************************************************
38 38
39 39 * .NET Framework 4
40   -
41 40 * Reactive Extensions
42 41 * Common.Logging
43 42 * XML-RPC.NET
44 43 * NDesk.Options
45   -
46 44 * F# Runtime 2.0 (for GenMsg)
47 45 * FParsec (for GenMsg)
48 46
49   -
50   -
51 47 インストール方法
52 48 ***************************************************
53 49
@@ -78,7 +74,6 @@ https://github.com/zoetrope/RosSharp/downloads
78 74
79 75 .. code-block:: csharp
80 76
81   - ROS.Initialize();
82 77 ROS.HostName = "192.168.1.11";
83 78 ROS.MasterUri = new Uri("http://192.168.1.10:11311");
84 79 ROS.TopicTimeout = 3000;
1  RosSharp.IntegrationTests/ParameterServerTest.cs
@@ -19,7 +19,6 @@ public class ParameterServerTest
19 19 [TestInitialize]
20 20 public void Initialize()
21 21 {
22   - RosManager.Initialize();
23 22 RosManager.MasterUri = new Uri("http://localhost:11311/");
24 23 RosManager.HostName = "localhost";
25 24 RosManager.TopicTimeout = 3000;
1  RosSharp.IntegrationTests/PublisherAndSubscriberTest.cs
@@ -16,7 +16,6 @@ public class PublisherAndSubscriberTest : ReactiveTest
16 16 [TestInitialize]
17 17 public void Initialize()
18 18 {
19   - RosManager.Initialize();
20 19 RosManager.MasterUri = new Uri("http://localhost:11311/");
21 20 RosManager.HostName = "localhost";
22 21 RosManager.TopicTimeout = 3000;
1  RosSharp.IntegrationTests/ServerAndClientTest.cs
@@ -17,7 +17,6 @@ public class ServerAndClientTest : ReactiveTest
17 17 [TestInitialize]
18 18 public void Initialize()
19 19 {
20   - RosManager.Initialize();
21 20 RosManager.MasterUri = new Uri("http://localhost:11311/");
22 21 RosManager.HostName = "localhost";
23 22 RosManager.TopicTimeout = 3000;
1  RosSharp.Tests/Node/RosNodeTest.cs
@@ -17,7 +17,6 @@ public class RosNodeTest
17 17 [TestInitialize]
18 18 public void Initialize()
19 19 {
20   - RosManager.Initialize();
21 20 RosManager.MasterUri = new Uri("http://localhost:11311/");
22 21 RosManager.HostName = "localhost";
23 22 RosManager.TopicTimeout = 3000;
1  RosSharp.Tests/Parameter/ParameterServerTest.cs
@@ -18,7 +18,6 @@ public class ParameterServerTest
18 18 [TestInitialize]
19 19 public void Initialize()
20 20 {
21   - RosManager.Initialize();
22 21 RosManager.HostName = "localhost";
23 22 }
24 23
4 RosSharp.Tests/ROSTest.cs
@@ -12,8 +12,6 @@ public class ROSTest
12 12 [TestMethod]
13 13 public void Dispose()
14 14 {
15   - RosManager.Initialize();
16   -
17 15 RosManager.GetNodes().Count.Is(0);
18 16
19 17 var node = RosManager.CreateNode("test");
@@ -28,8 +26,6 @@ public void Dispose()
28 26 [TestMethod]
29 27 public void DisposeByNode()
30 28 {
31   - RosManager.Initialize();
32   -
33 29 RosManager.GetNodes().Count.Is(0);
34 30
35 31 var node = RosManager.CreateNode("test");
1  RosSharp.Tests/SandBoxTest.cs
@@ -159,5 +159,6 @@ public void Rx_Subject()
159 159
160 160 Thread.Sleep(TimeSpan.FromSeconds(3));
161 161 }
  162 +
162 163 }
163 164 }
1  RosSharp.Tests/Slave/SlaveServerTest.cs
@@ -19,7 +19,6 @@ public class SlaveServerTest
19 19 [TestInitialize]
20 20 public void Initialize()
21 21 {
22   - RosManager.Initialize();
23 22 var topicContainer = new TopicContainer();
24 23 topicContainer.AddPublisher(new Publisher<std_msgs.String>("/test_topic", "test"));
25 24
1  RosSharp.Tests/Topic/PublisherTest.cs
@@ -16,7 +16,6 @@ public class PublisherTest
16 16 [TestInitialize]
17 17 public void Initialize()
18 18 {
19   - RosManager.Initialize();
20 19 RosManager.TopicTimeout = 3000;
21 20 RosManager.XmlRpcTimeout = 3000;
22 21 }
1  RosSharp.Tests/Topic/RosTopicClientTest.cs
@@ -17,7 +17,6 @@ public class RosTopicClientTest
17 17 [TestInitialize]
18 18 public void Initialize()
19 19 {
20   - RosManager.Initialize();
21 20 RosManager.TopicTimeout = 2000;
22 21 }
23 22
1  RosSharp.Tests/Topic/RosTopicServerTest.cs
@@ -21,7 +21,6 @@ public class RosTopicServerTest
21 21 [TestInitialize]
22 22 public void Initialize()
23 23 {
24   - RosManager.Initialize();
25 24 RosManager.TopicTimeout = 2000;
26 25 }
27 26
5 RosSharp.Tests/Transport/TcpRosHeaderTest.cs
@@ -8,11 +8,6 @@ namespace RosSharp.Tests.Transport
8 8 [TestClass]
9 9 public class TcpRosHeaderTest
10 10 {
11   - [TestInitialize]
12   - public void Initialize()
13   - {
14   - RosManager.Initialize();
15   - }
16 11
17 12 [TestMethod]
18 13 public void SerializeSubscriberHeader_Success()
22 RosSharp/Node/RosNode.cs
@@ -97,9 +97,27 @@ public Task<Parameter<T>> CreateParameterAsync<T>(string paramName)
97 97 var param = new Parameter<T>(NodeId, paramName, _slaveServer.SlaveUri, _parameterServerClient);
98 98
99 99 _parameters.Add(paramName, param);
100   - //TODO: HasParamでチェックして、あればGetParam,なければSetParam。戻り値もTaskに。
101   - return Task.Factory.StartNew(() => param);
102 100
  101 + var tcs = new TaskCompletionSource<Parameter<T>>();
  102 +
  103 + param.InitializeAsync().ContinueWith(task =>
  104 + {
  105 + if (task.IsFaulted)
  106 + {
  107 + tcs.SetException(task.Exception.InnerException);
  108 + _logger.Error("Initialize Parameter: Failure", task.Exception.InnerException);
  109 + }
  110 + else if (task.IsCanceled)
  111 + {
  112 + tcs.SetCanceled();
  113 + }
  114 + else
  115 + {
  116 + tcs.SetResult(param);
  117 + }
  118 + });
  119 +
  120 + return tcs.Task;
103 121 }
104 122
105 123 public void Dispose()
3  RosSharp/Parameter/Parameter.cs
@@ -76,8 +76,9 @@ internal Parameter(string nodeId, string paramName, Uri slaveUri, ParameterServe
76 76 }
77 77 }
78 78
79   - internal Task Initialize()
  79 + internal Task InitializeAsync()
80 80 {
  81 + //TODO: tcs? 失敗したときの処理がない。
81 82 return _parameterServerClient.HasParamAsync(NodeId, Name)
82 83 .ContinueWith(task =>
83 84 {
2  RosSharp/RosManager.cs
@@ -76,7 +76,7 @@ public static class RosManager
76 76 /// <summary>
77 77 /// Initialize Setting
78 78 /// </summary>
79   - public static void Initialize()
  79 + static RosManager()
80 80 {
81 81 MasterUri = ReadMasterUri();
82 82 HostName = ReadHostName();
5 RosSharp/RosSharp.csproj
@@ -50,12 +50,7 @@
50 50 <HintPath>..\packages\Rx-Main.1.0.11226\lib\Net4\System.Reactive.dll</HintPath>
51 51 </Reference>
52 52 <Reference Include="System.Runtime.Remoting" />
53   - <Reference Include="System.Web" />
54   - <Reference Include="System.Xml.Linq" />
55   - <Reference Include="System.Data.DataSetExtensions" />
56 53 <Reference Include="Microsoft.CSharp" />
57   - <Reference Include="System.Data" />
58   - <Reference Include="System.Xml" />
59 54 </ItemGroup>
60 55 <ItemGroup>
61 56 <Compile Include="ConfigurationSectionDesigner.csd.cs">
1  Sample/Client/Program.cs
@@ -7,7 +7,6 @@ class Program
7 7 {
8 8 static void Main(string[] args)
9 9 {
10   - RosManager.Initialize();
11 10 RosManager.MasterUri = new Uri("http://192.168.11.5:11311/");
12 11 RosManager.HostName = "192.168.11.3";
13 12
1  Sample/Listener/Program.cs
@@ -6,7 +6,6 @@ class Program
6 6 {
7 7 static void Main(string[] args)
8 8 {
9   - RosManager.Initialize();
10 9 RosManager.MasterUri = new Uri("http://192.168.11.5:11311/");
11 10 RosManager.HostName = "192.168.11.3";
12 11
1  Sample/ParameterClient/Program.cs
@@ -6,7 +6,6 @@ class Program
6 6 {
7 7 static void Main(string[] args)
8 8 {
9   - RosManager.Initialize();
10 9 RosManager.MasterUri = new Uri("http://192.168.11.5:11311/");
11 10 RosManager.HostName = "192.168.11.3";
12 11
1  Sample/Server/Program.cs
@@ -6,7 +6,6 @@ class Program
6 6 {
7 7 static void Main(string[] args)
8 8 {
9   - RosManager.Initialize();
10 9 RosManager.MasterUri = new Uri("http://192.168.11.5:11311/");
11 10 RosManager.HostName = "192.168.11.3";
12 11
5 Sample/Talker/Program.cs
@@ -7,9 +7,8 @@ class Program
7 7 {
8 8 static void Main(string[] args)
9 9 {
10   - RosManager.Initialize();
11   - RosManager.MasterUri = new Uri("http://192.168.11.5:11311/");
12   - RosManager.HostName = "192.168.11.3";
  10 + //RosManager.MasterUri = new Uri("http://192.168.11.5:11311/");
  11 + //RosManager.HostName = "192.168.11.3";
13 12
14 13 var node = RosManager.CreateNode("Talker");
15 14
BIN  Utility/RosSharp.0.1.0-beta.nupkg
Binary file not shown
BIN  Utility/RosSharp.0.1.0.nupkg
Binary file not shown

0 comments on commit 635f6e4

Please sign in to comment.
Something went wrong with that request. Please try again.