Skip to content

Commit

Permalink
Merge pull request #343 from tier4/r2fu-services
Browse files Browse the repository at this point in the history
Update Ros2ForUnity asset and add service hanling
  • Loading branch information
mackierx111 authored Aug 9, 2024
2 parents 0ca4970 + ebf9222 commit 2f2490b
Show file tree
Hide file tree
Showing 4,465 changed files with 41,245 additions and 25 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 2 additions & 2 deletions Assets/AWSIM/Scripts/Environments/V2I/V2IRos2Publisher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ private void UpdateTrafficSignalArrayMsg(V2I.OutputData data)
//Get bulbData
var trafficLightBulbData = trafficLight.GetBulbData();
//Fill TrafficSignal with bulbData
var trafficLightElementList = new List<autoware_perception_msgs.msg.TrafficLightElement>();
var trafficLightElementList = new List<autoware_perception_msgs.msg.TrafficSignalElement>();
foreach (var bulbData in trafficLightBulbData)
{
if (isBulbTurnOn(bulbData.Status))
{
var trafficLightElementMsg = new autoware_perception_msgs.msg.TrafficLightElement();
var trafficLightElementMsg = new autoware_perception_msgs.msg.TrafficSignalElement();
trafficLightElementMsg.Color = V2IROS2Utility.UnityToRosBulbColor(bulbData.Color);
trafficLightElementMsg.Shape = V2IROS2Utility.UnityToRosBulbShape(bulbData.Type);
trafficLightElementMsg.Status = V2IROS2Utility.UnityToRosBulbStatus(bulbData.Status);
Expand Down
51 changes: 51 additions & 0 deletions Assets/AWSIM/Scripts/ROS/SimulatorROS2Node.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,32 @@ static void OnTimeSourceChanged()
return node.CreateSubscription<T>(topicName, callback, qos);
}

/// <summary>
/// Create a service
/// </summary>
/// <returns>The service</returns>
/// <param name="topicName">topic under which the service will be requestable</param>
/// <param name="qos">QoS for requests. If no QoS is selected, it will default to reliable, keep 10 last</param>
static public IService<T, S> CreateService<T, S>(string topicName, Func<T, S> callback, QualityOfServiceProfile qos = null)
where T: Message, new()
where S: Message, new()
{
return node.CreateService<T, S>(topicName, callback, qos);
}

/// <summary>
/// Create a client service
/// </summary>
/// <returns>The client</returns>
/// <param name="topicName">topic under which the client will call the service</param>
/// <param name="qos">QoS for requests. If no QoS is selected, it will default to reliable, keep 10 last</param>
static public Client<T, S> CreateClient<T, S>(string topicName, QualityOfServiceProfile qos = null)
where T: Message, new()
where S: Message, new()
{
return node.CreateClient<T, S>(topicName, qos);
}

/// <summary>
/// Update header timestamp
/// </summary>
Expand Down Expand Up @@ -130,6 +156,31 @@ static public void RemoveSubscription<T>(ISubscriptionBase subscription)
}
}

/// <summary>
/// Remove ros2 service
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="service"></param>
static public void RemoveService(IServiceBase service)
{
if (ros2UnityCore.Ok())
{
node.RemoveService(service);
}
}

/// <summary>
/// Remove ros2 client
/// </summary>
/// <param name="client"></param>
static public void RemoveClient(IClientBase client)
{
if (ros2UnityCore.Ok())
{
node.RemoveClient(client);
}
}

/// <summary>
/// Get current time
/// </summary>
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Loading

0 comments on commit 2f2490b

Please sign in to comment.