Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

does dds support vehicles to interaction on different devices? #165

Open
CuteSmartTiger opened this issue Nov 14, 2022 · 4 comments
Open
Labels
question Further information is requested

Comments

@CuteSmartTiger
Copy link

I run two different cars on the same device, configured with the same domain, and the batches can send and receive information interactively; however, if the two processes are not on the same device, or on different network segments, what should I do the configuration for interaction, is there an example?

@CuteSmartTiger
Copy link
Author

i write a xml config file,it comes error.
it will be better if can give python example and xml config

@thijsmie
Copy link
Contributor

Hi @CuteSmartTiger,

Most of the time, if you have two devices in the same LAN, CycloneDDS "should just work". If your network setup gets more complicated, you can configure network interfaces via the CycloneDDS XML config file, which you mentioned you did. If it is not working, can you share your XML configuration, your network setup and any errors you run into?

@thijsmie thijsmie added the question Further information is requested label Nov 15, 2022
@CuteSmartTiger CuteSmartTiger changed the title does dds support vehicles to interaction no different devices? does dds support vehicles to interaction on different devices? Nov 16, 2022
@CuteSmartTiger
Copy link
Author

CuteSmartTiger commented Nov 16, 2022

xml as follow

<?xml version="1.0" encoding="UTF-8" ?>
<CycloneDDS xmlns="https://cdds.io/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://cdds.io/config https://raw.githubusercontent.com/eclipse-cyclonedds/cyclonedds/master/etc/cyclonedds.xsd">
    <Domain Id="any">
        <General>
            <Interfaces>
                <NetworkInterface name="inter" address="192.168.158.128" priority="default" multicast="default" />
            </Interfaces>
            <AllowMulticast>default</AllowMulticast>
            <MaxMessageSize>65500B</MaxMessageSize>
        </General>
        <Discovery>
            <EnableTopicDiscoveryEndpoints>true</EnableTopicDiscoveryEndpoints>
        </Discovery>
        <Internal>
            <Watermarks>
                <WhcHigh>500kB</WhcHigh>
            </Watermarks>
        </Internal>
        <Tracing>
            <Verbosity>config</Verbosity>
            <OutputFile>cdds.log.${CYCLONEDDS_PID}</OutputFile>
        </Tracing>
    </Domain>
</CycloneDDS>

python code as follow

from os import environ
environ['CYCLONEDDS_URI'] = '/home/xiaoyao/selfproject/selftool/etc/cyclonedds.xml'

from dataclasses import dataclass
from cyclonedds.domain import DomainParticipant,Domain
from cyclonedds.core import Qos, Policy
from cyclonedds.pub import DataWriter
from cyclonedds.sub import DataReader
from cyclonedds.topic import Topic
from cyclonedds.idl import IdlStruct
from cyclonedds.idl.annotations import key
from time import sleep
import numpy as np

try:
    from names import get_full_name

    name = get_full_name()
except:
    import os

    name = f"{os.getpid()}"


@dataclass
class Chatter(IdlStruct, typename="Chatter"):
    name: str
    key("name")
    message: str
    count: int



rng = np.random.default_rng()
dp = DomainParticipant()
tp = Topic(dp, "Hello", Chatter, qos=Qos(Policy.Reliability.Reliable(0)))
dw = DataWriter(dp, tp)
dr = DataReader(dp, tp)
count = 0

if __name__ == '__main__':
    while True:
        sample = Chatter(name=name, message="Hello, World!", count=count)
        count = count + 1
        print("Writing ", sample)
        dw.write(sample)
        for sample in dr.take(10):
            print("Read ", sample)
        sleep(rng.exponential())

@eboasson
Copy link
Contributor

@CuteSmartTiger what error are you getting? Your config seems valid to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants