Skip to content

Commit

Permalink
Create ROS2NodeBuilder (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
ds58 authored Dec 3, 2024
1 parent 9c32fde commit f61521f
Show file tree
Hide file tree
Showing 38 changed files with 1,186 additions and 560 deletions.
75 changes: 17 additions & 58 deletions .github/workflows/run-gradle-test-all-platforms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@ name: Run Gradle test (all platforms)

on:
workflow_dispatch:
push:
branches:
- develop
pull_request:

jobs:
test-linux:
runs-on: [ubuntu-20.04]
test:
strategy:
matrix:
# os: [ubuntu-20.04, windows-2019, macos-12, macos-14]
os: [ubuntu-20.04, windows-2019]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -17,62 +25,13 @@ jobs:
java-version: '17'
- uses: gradle/actions/setup-gradle@v4
with:
gradle-version: 8.5
gradle-version: 8.11.1
- name: Run tests
run: |
patch ihmc-pub-sub/thirdparty/Fast-RTPS/resources/xsd/fastRTPS_profiles.xsd ihmc-pub-sub/patches/fastRTPS_profiles.patch
gradle compositeTask --stacktrace --info -PtaskName=test
test-windows:
runs-on: [windows-2019]
steps:
- uses: actions/checkout@v4
with:
lfs: 'false'
submodules: 'recursive'
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- uses: gradle/actions/setup-gradle@v4
with:
gradle-version: 8.5
- name: Run tests
run: |
patch ihmc-pub-sub/thirdparty/Fast-RTPS/resources/xsd/fastRTPS_profiles.xsd ihmc-pub-sub/patches/fastRTPS_profiles.patch
gradle compositeTask --stacktrace --info -PtaskName=test
test-macos-intel:
runs-on: [macos-12] # macos-12 is exclusively x86_64 intel
steps:
- uses: actions/checkout@v4
with:
lfs: 'false'
submodules: 'recursive'
- uses: actions/setup-java@v4
gradle compositeTask -PtaskName=test -PrunningOnCIServer=true
- name: Publish Test Report - ${{ inputs.test-category }}
uses: mikepenz/action-junit-report@v4
if: success() || failure() # always run even if the previous step fails
with:
distribution: 'temurin'
java-version: '17'
- uses: gradle/actions/setup-gradle@v4
with:
gradle-version: 8.5
- name: Run tests
run: |
patch ihmc-pub-sub/thirdparty/Fast-RTPS/resources/xsd/fastRTPS_profiles.xsd ihmc-pub-sub/patches/fastRTPS_profiles.patch
gradle compositeTask --stacktrace --info -PtaskName=test
test-macos-arm:
runs-on: [macos-14] # macos-14 runner is exclusively arm64
steps:
- uses: actions/checkout@v4
with:
lfs: 'false'
submodules: 'recursive'
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- uses: gradle/actions/setup-gradle@v4
with:
gradle-version: 8.5
- name: Run tests
run: |
patch ihmc-pub-sub/thirdparty/Fast-RTPS/resources/xsd/fastRTPS_profiles.xsd ihmc-pub-sub/patches/fastRTPS_profiles.patch
gradle compositeTask --stacktrace --info -PtaskName=test
report_paths: '**/build/test-results/test/TEST-*.xml'
detailed_summary: true
35 changes: 0 additions & 35 deletions .github/workflows/run-gradle-test-linux-self-hosted.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@ public void subscriberTopicChange(boolean isAlive,
public EndpointDiscoveryProtocolListenerExample() throws IOException
{
Domain domain = DomainFactory.getDomain();

ParticipantProfile attributes = ParticipantProfile.create()
.domainId(215)
.useOnlyIntraProcessDelivery()
.discoveryLeaseDuration(Time.Infinite)
.name("EndpointDiscoveryProtocolListenerExample");
Participant participant = domain.createParticipant(attributes, new ParticipantListenerImpl());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public PublisherExample() throws IOException

ParticipantProfile attributes2 = ParticipantProfile.create()
.domainId(1)
.useOnlyIntraProcessDelivery()
.name("PublisherExample2")
.discoveryLeaseDuration(Time.Infinite);
//.discoveryServer("127.0.0.1", 4);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public SubscriberExample() throws IOException

ParticipantProfile attributes2 = ParticipantProfile.create()
.domainId(1)
.useOnlyIntraProcessDelivery()
.name("ParticipantExample")
.discoveryLeaseDuration(Time.Infinite);
//.discoveryServer("127.0.0.1", 4);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public AggressivePublisher() throws IOException

ParticipantProfile attributes = ParticipantProfile.create()
.domainId(215)
.useOnlyIntraProcessDelivery()
.discoveryLeaseDuration(Time.Infinite)
.useOnlySharedMemoryTransport()
.name("AggressivePublisher");

Participant participant = domain.createParticipant(attributes, new ParticipantListenerImpl());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public CreateSubscriptionUnderLoad() throws IOException

ParticipantProfile attributes = ParticipantProfile.create()
.domainId(215)
.useOnlyIntraProcessDelivery()
.discoveryLeaseDuration(Time.Infinite)
.useOnlySharedMemoryTransport()
.name("CreateSubscriptionProcessDuringAggressivePublishTest");

Participant participant = domain.createParticipant(attributes, new ParticipantListenerImpl());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ public void testPublishSubscribeFooHandshake() throws IOException

ParticipantProfile attributes = ParticipantProfile.create()
.domainId(220)
.useOnlyIntraProcessDelivery()
.discoveryLeaseDuration(Time.Infinite)
.useOnlySharedMemoryTransport()
.name("StatusTest");

Participant participant = domain.createParticipant(attributes, new ParticipantListenerImpl());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,23 +54,28 @@ public void onSubscriptionMatched(Subscriber subscriber, MatchingInfo info)
}

@Test
public void TestMulitpleParticipantsInSameProcess() throws IOException, InterruptedException
public void testMulitpleParticipantsInSameProcess() throws IOException, InterruptedException
{
AtomicInteger counter = new AtomicInteger(0);
AtomicInteger counter = new AtomicInteger();

Domain domain = DomainFactory.getDomain();

try
{
TopicDataType topicDataType = new ChatMessagePubSubType();
TopicDataType<ChatMessage> topicDataType = new ChatMessagePubSubType();

PublisherAttributes genericPublisherAttributes = PublisherAttributes.create().topicDataType(topicDataType).topicName("Status")
PublisherAttributes genericPublisherAttributes = PublisherAttributes.create()
.topicDataType(topicDataType)
.topicName("Status")
.reliabilityKind(ReliabilityQosKindPolicyType.RELIABLE)
.partitions(Collections.singletonList("us/ihmc"))
.durabilityKind(DurabilityQosKindPolicyType.TRANSIENT_LOCAL)
.historyQosPolicyKind(HistoryQosKindPolicyType.KEEP_LAST).historyDepth(10);
.historyQosPolicyKind(HistoryQosKindPolicyType.KEEP_LAST)
.historyDepth(10);

SubscriberAttributes subscriberAttributes = SubscriberAttributes.create().topicDataType(topicDataType).topicName("Status")
SubscriberAttributes subscriberAttributes = SubscriberAttributes.create()
.topicDataType(topicDataType)
.topicName("Status")
.reliabilityKind(ReliabilityQosKindPolicyType.RELIABLE)
.partitions(Collections.singletonList("us/ihmc"))
.durabilityKind(DurabilityQosKindPolicyType.TRANSIENT_LOCAL)
Expand All @@ -81,25 +86,22 @@ public void TestMulitpleParticipantsInSameProcess() throws IOException, Interrup
{
ParticipantProfile participantProfile = ParticipantProfile.create()
.domainId(217)
.useOnlyIntraProcessDelivery()
.discoveryLeaseDuration(Time.Infinite)
.useOnlySharedMemoryTransport()
.name("StatusTest" + i);
Participant participant = domain.createParticipant(participantProfile);
LogTools.info("Creating participant #" + i);
participants.add(participant);
}
LogTools.info("Created {} participants", participants.size());

List<Publisher> publishers = new ArrayList<>();

for (int i = 0; i < participants.size(); i++)
{
publishers.add(domain.createPublisher(participants.get(i), genericPublisherAttributes, null));
LogTools.info("Creating publisher #" + (i + 1));
}
for (Participant participant : participants)
publishers.add(domain.createPublisher(participant, genericPublisherAttributes, null));
LogTools.info("Created {} publishers", publishers.size());

Subscriber subscriber = domain.createSubscriber(participants.get(0), subscriberAttributes, new SubscriberListenerImpl(counter));

//publish one message from each publisher in each participant
// Publish one message from each publisher in each participant
Thread thread = new Thread(() ->
{
AtomicInteger msgCounter = new AtomicInteger();
Expand All @@ -108,10 +110,9 @@ public void TestMulitpleParticipantsInSameProcess() throws IOException, Interrup
try
{
ChatMessage msg = new ChatMessage();
msg.setMsg(String.valueOf(msgCounter.get()));
msg.setMsg(String.valueOf(msgCounter.getAndIncrement()));
publisher.write(msg);
Thread.sleep(5L); // Sleep a bit so FastDDS can deliver the message.
msgCounter.incrementAndGet();
Thread.sleep(20L); // Sleep a bit so Fast-DDS can deliver the message.
}
catch (IOException | InterruptedException e)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ public void runAllocationTest() throws IOException

ParticipantProfile attributes = ParticipantProfile.create()
.domainId(218)
.useOnlyIntraProcessDelivery()
.discoveryLeaseDuration(Time.Infinite)
.useOnlySharedMemoryTransport()
.name("StatusTest");

Participant participant = domain.createParticipant(attributes, new ParticipantListenerImpl());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public void testPublishSubscribeUInt32SharedMemory() throws IOException

ParticipantProfile attributes = ParticipantProfile.create()
.domainId(219)
.useOnlyIntraProcessDelivery()
.discoveryLeaseDuration(Time.Infinite)
.useOnlySharedMemoryTransport()
.name("StatusTest");

Participant participant = domain.createParticipant(attributes, new ParticipantListenerImpl());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public void testPublishSubscribeUInt32() throws IOException

ParticipantProfile attributes = ParticipantProfile.create()
.domainId(219)
.useOnlyIntraProcessDelivery()
.discoveryLeaseDuration(Time.Infinite)
.useOnlySharedMemoryTransport()
.name("StatusTest");

Participant participant = domain.createParticipant(attributes, new ParticipantListenerImpl());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
public class PublisherSubscriberMatchTest
{
@Test
public void TestMatchingAttributes()
public void testMatchingAttributes()
{
TopicDataType topicDataType = new ChatMessagePubSubType();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public PubSubTester(Supplier<P> msgTypeSupplier) throws IOException

ParticipantProfile attributes = ParticipantProfile.create()
.domainId(systemDomain())
.useOnlyIntraProcessDelivery()
.discoveryLeaseDuration(Time.Infinite)
.name("PubSubTester");

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

public class DomainFactory
{
public static synchronized Domain getDomain()
public static synchronized FastRTPSDomain getDomain()
{
return FastRTPSDomain.getInstance(false);
}
Expand Down
Loading

0 comments on commit f61521f

Please sign in to comment.