Skip to content

Commit

Permalink
Urdf Export
Browse files Browse the repository at this point in the history
  • Loading branch information
suzannahsmith1 committed Sep 21, 2018
1 parent 59cbaa9 commit acdd1ea
Show file tree
Hide file tree
Showing 273 changed files with 27,815 additions and 19,203 deletions.
Empty file added .gitignore
Empty file.
8 changes: 3 additions & 5 deletions Libraries/RosBridgeClient/Protocols/WebSocketNetProtocol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public async void ConnectAsync()
{
await clientWebSocket.ConnectAsync(uri, cancellationToken);
IsConnected.Set();
OnConnected(null, EventArgs.Empty);
OnConnected?.Invoke(null, EventArgs.Empty);
StartListen();
}

Expand All @@ -65,7 +65,7 @@ public async void Close()
{
await clientWebSocket.CloseAsync(WebSocketCloseStatus.NormalClosure, string.Empty, CancellationToken.None);
IsConnected.Reset();
OnClosed(null, EventArgs.Empty);
OnClosed?.Invoke(null, EventArgs.Empty);
}
}

Expand All @@ -85,9 +85,7 @@ public async void SendAsync(byte[] message)
IsConnected.WaitOne();

if (clientWebSocket.State != WebSocketState.Open)
{
throw new WebSocketException(WebSocketError.InvalidState, "Error Sending Message. WebSocket State is: " + clientWebSocket.State);
}

int messageCount = (int)Math.Ceiling((double)message.Length / SendChunkSize);

Expand Down Expand Up @@ -121,7 +119,7 @@ private async void StartListen()

} while (!result.EndOfMessage);

OnReceive.Invoke(this, new MessageEventArgs(memoryStream.ToArray()));
OnReceive?.Invoke(this, new MessageEventArgs(memoryStream.ToArray()));
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions Libraries/RosBridgeClient/Protocols/WebSocketSharpProtocol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,17 @@ public void Send(byte[] data)

private void Receive(object sender, WebSocketSharp.MessageEventArgs e)
{
OnReceive(sender, new MessageEventArgs(e.RawData));
OnReceive?.Invoke(sender, new MessageEventArgs(e.RawData));
}

private void Closed(object sender, EventArgs e)
{
OnClosed(sender, e);
OnClosed?.Invoke(sender, e);
}

private void Connected(object sender, EventArgs e)
{
OnConnected(sender, e);
OnConnected?.Invoke(sender, e);
}
}
}
5 changes: 2 additions & 3 deletions Libraries/RosBridgeClient/RosSocket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ public void Close()
if (Publishers.ContainsKey(id))
Unadvertise(id);

Advertisement advertisement;
Publishers.Add(id, new Publisher<T>(id, topic, out advertisement));
Publishers.Add(id, new Publisher<T>(id, topic, out Advertisement advertisement));
Send(advertisement);
return id;
}
Expand Down Expand Up @@ -195,7 +194,7 @@ private static string GetUnusedCounterID<T>(Dictionary<string, T> dictionary, st
int I = 0;
string id;
do
id = name + ":" + (I++).ToString();
id = name + ":" + I++;
while (dictionary.ContainsKey(id));
return id;
}
Expand Down
3 changes: 2 additions & 1 deletion Libraries/RosBridgeClient/UrdfImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ private static List<Uri> ReadResourceFileUris(string robotDescription)

private void ReceiveResourceFile(ServiceReceiver<file_server.GetBinaryFileRequest, file_server.GetBinaryFileResponse> serviceReceiver, file_server.GetBinaryFileResponse serviceResponse)
{
byte[] fileContents = (serviceResponse).value;
byte[] fileContents = serviceResponse.value;
Uri resourceFileUri = new Uri((serviceReceiver.ServiceParameter).name);

if (IsColladaFile(resourceFileUri))
Expand All @@ -176,6 +176,7 @@ private static bool IsColladaFile(Uri uri)
{
return Path.GetExtension(uri.LocalPath) == ".dae";
}

private void ImportColladaTextureFiles(Uri daeFileUri, string fileContents)
{
var serviceReceivers = RequestResourceFiles(ReadDaeTextureUris(daeFileUri, fileContents));
Expand Down
3 changes: 1 addition & 2 deletions Libraries/RosBridgeClientTest/RosSocketConsoleExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ public static void Main(string[] args)

// Service Call:
rosSocket.CallService<rosapi.GetParamRequest, rosapi.GetParamResponse>("/rosapi/get_param", ServiceCallHandler, new rosapi.GetParamRequest("/rosdistro", "default"));
rosSocket.CallService<rosapi.GetParamRequest, rosapi.GetParamResponse>("/rosapi/get_param", ServiceCallHandler, new rosapi.GetParamRequest("/rosdistro", "default"));


// Service Response:
string service_id = rosSocket.AdvertiseService<std_srvs.TriggerRequest, std_srvs.TriggerResponse>("/service_response_test", ServiceResponseHandler);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

// commands on ROS system:
// launch before starting:
// roslaunch file_server roslaunch file_server publish_description_turtlebot2.launch
// roslaunch file_server publish_description_turtlebot2.launch

namespace RosSharp.RosBridgeClientTest
{
Expand Down
12 changes: 9 additions & 3 deletions Libraries/RosSharp.sln
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
# Visual Studio 15
VisualStudioVersion = 15.0.27703.2042
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RosBridgeClient", "RosBridgeClient\RosBridgeClient.csproj", "{27CD898A-8840-4CDD-A475-4A672FD2EF50}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RosBridgeClientTest", "RosBridgeClientTest\RosBridgeClientTest.csproj", "{4E1BB3D0-8254-4D23-BD1B-F6EC7AA562FC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UrdfImporter", "UrdfImporter\UrdfImporter.csproj", "{D33101DA-7196-4545-B708-C8E0C308C5FA}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Urdf", "Urdf\Urdf.csproj", "{D33101DA-7196-4545-B708-C8E0C308C5FA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UrdfTest", "UrdfTest\UrdfTest.csproj", "{FC9BA7F5-EE69-47C9-87DE-53AA67253CB2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -27,6 +29,10 @@ Global
{D33101DA-7196-4545-B708-C8E0C308C5FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D33101DA-7196-4545-B708-C8E0C308C5FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D33101DA-7196-4545-B708-C8E0C308C5FA}.Release|Any CPU.Build.0 = Release|Any CPU
{FC9BA7F5-EE69-47C9-87DE-53AA67253CB2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FC9BA7F5-EE69-47C9-87DE-53AA67253CB2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FC9BA7F5-EE69-47C9-87DE-53AA67253CB2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FC9BA7F5-EE69-47C9-87DE-53AA67253CB2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
File renamed without changes.
Loading

0 comments on commit acdd1ea

Please sign in to comment.