Automatically generate the DDS configuration for Husarnet.
Download the binary using curl or wget, which are available on most systems either preinstalled, or obtainable via package manager:
RELEASE="v1.3.6"
ARCH="amd64"
sudo curl -L https://github.com/husarnet/husarnet-dds/releases/download/$RELEASE/husarnet-dds-linux-$ARCH -o /usr/local/bin/husarnet-dds
sudo chmod +x /usr/local/bin/husarnet-ddsOn Windows, you can download the binary via GUI from Releases page and place in directory of your liking.
To do it right from PowerShell, use wget command which is an alias for Invoke-WebRequest cmdlet:
wget https://github.com/husarnet/husarnet-dds/releases/download/v1.3.4/husarnet-dds-windows-amd64.exe -OutFile husarnet-dds.exe
In order to be able to run the binary from any directory, place it in the directory present in your %PATH% environment variable.
go build -o husarnet-dds
warning
Target file name specified in
FASTRTPS_DEFAULT_PROFILES_FILEorCYCLONEDDS_URIpaths should contain 'husarnet' substring. Otherwise, the config will be saved under a default location.
On Linux/MacOS, using bash:
export RMW_IMPLEMENTATION=rmw_fastrtps_cpp
export FASTRTPS_DEFAULT_PROFILES_FILE=./husarnet-fastdds-simple.xml
husarnet-dds singleshotOn Windows, using PowerShell
$env:RMW_IMPLEMENTATION = 'rmw_fastrtps_cpp'
$env:FASTRTPS_DEFAULT_PROFILES_FILE = '.\husarnet-fastdds-simple.xml'
.\husarnet-dds.exe singleshotLet's assume that the Husarnet hostname of the device is my-server:
export DISCOVERY_SERVER_PORT=11811
husarnet-dds singleshotLaunching the discovery server:
fast-discovery-server -i 0 -x /var/tmp/husarnet-dds/fastdds-ds-server.xml
export RMW_IMPLEMENTATION=rmw_fastrtps_cpp
export FASTRTPS_DEFAULT_PROFILES_FILE=./husarnet-fastdds-ds-client.xml
export ROS_DISCOVERY_SERVER=my-server:11811
husarnet-dds singleshotexport RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
export CYCLONEDDS_URI=file://./husarnet-cyclone.xml
husarnet-dds singleshotYou can run husarnet-dds in a service mode. It will start automatically after system reboot, and every 5 seconds it will update the hosts in DDS .xml profile files.
Unix-like systems, using bash:
export RMW_IMPLEMENTATION=rmw_fastrtps_cpp
export FASTRTPS_DEFAULT_PROFILES_FILE=/var/tmp/husarnet-dds/husarnet-fastdds.xml
sudo husarnet-dds install $USER \
-e RMW_IMPLEMENTATION=$RMW_IMPLEMENTATION \
-e FASTRTPS_DEFAULT_PROFILES_FILE=$FASTRTPS_DEFAULT_PROFILES_FILEOn Windows, using PowerShell as Administrator:
$env:RMW_IMPLEMENTATION = 'rmw_fastrtps_cpp'
$env:FASTRTPS_DEFAULT_PROFILES_FILE = 'C:\Users\husarnetman\Desktop\dds\husarnet-fastdds-simple.xml'
.\husarnet-dds.exe install LocalSystem -e RMW_IMPLEMENTATION=$env:RMW_IMPLEMENTATION `
-e FASTRTPS_DEFAULT_PROFILES_FILE=$env:FASTRTPS_DEFAULT_PROFILES_FILEBe sure to provide absolute path to the file which will be watched, as in the example.
Available environment variables
| key | default value | description |
|---|---|---|
FASTRTPS_DEFAULT_PROFILES_FILE |
/var/tmp/husarnet-dds/fastdds.xml |
path to the output .xml file for RMW_IMPLEMENTATION=rmw_fastrtps_cpp |
CYCLONEDDS_URI |
file:///var/tmp/husarnet-dds/cyclonedds.xml |
path to the output .xml file for RMW_IMPLEMENTATION=rmw_cyclonedds_cpp |
ROS_DISCOVERY_SERVER |
(unset) | set it ONLY for devices running in Fast DDS Discovery Server "Client mode". The value of this env should have the following format: <Husarnet-hostname-of-discovery-server>:<PORT>, eg. my-ds-server:11811 |
DISCOVERY_SERVER_PORT |
11811 |
set it ONLY for devices running in Fast DDS Discovery Server "Server mode" |
sudo husarnet-dds startNow you can check the status of the service on Linux and last logs like that:
sudo systemctl status husarnet-dds.service sudo journalctl --unit husarnet-dds.service -n 100 On Windows, see services.msc
sudo husarnet-dds stop
sudo husarnet-dds uninstall
git tag v1.0.0 main
git push origin v1.0.0 main