sudo apt install clang-format
pip install pre-commit
pre-commit installsudo apt install libpaho-mqtt-dev libpaho-mqttpp-dev- Define gRPC installation directory and export variable.
export GRPC_INSTALL_DIR=$HOME/grpc_install_dir
mkdir $GRPC_INSTALL_DIR- Make sure that there is CMake version 3.13 or later. Try installing from package.
sudo apt install -y cmakeCheck CMake version and if it is too low, install if from source.
cmake --version- Install other required packages.
sudo apt install -y build-essential autoconf libtool pkg-config- Clone gRPC repository.
git clone --recurse-submodules -b v1.64.0 --depth 1 --shallow-submodules https://github.com/grpc/grpc- Build and install gRPC and Protocol Buffers.
cd grpc
mkdir -p cmake/build
pushd cmake/build
cmake -DBUILD_SHARED_LIBS=ON \
-DCMAKE_INSTALL_PREFIX=$GRPC_INSTALL_DIR \
-DgRPC_BUILD_GRPC_CPP_PLUGIN=ON \
-DgRPC_BUILD_GRPC_CSHARP_PLUGIN=OFF \
-DgRPC_BUILD_GRPC_NODE_PLUGIN=OFF \
-DgRPC_BUILD_GRPC_OBJECTIVE_C_PLUGIN=OFF \
-DgRPC_BUILD_GRPC_PHP_PLUGIN=OFF \
-DgRPC_BUILD_GRPC_PYTHON_PLUGIN=OFF \
-DgRPC_BUILD_GRPC_RUBY_PLUGIN=OFF \
../..
make -j$(nproc --ignore=2) # if your machine is stronger, consider increasing number of jobs or skip it altogether to run without constraints
make install
popd- Export variables to be able to load built shared libraries and include headers. It is recommended to put those variables inside
.bashrcfile.
export GRPC_INSTALL_DIR=${HOME}/grpc_install_dir
export PATH=$PATH:${GRPC_INSTALL_DIR}/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${GRPC_INSTALL_DIR}/libDownload all dependencies needed to run the bridge locally.
vcs import < local_dependencies.reposThere is prepared Docker based configuration in chirpstack_docker directory.
Note
For more detailed information about Chirpstack check official documentation: https://www.chirpstack.io/docs/getting-started/docker.html
Note
All configuration files are used in EUR868 zone. If you are running LoRaWAN devices in different zone, please take that into account by changing configuration file.
- Build binaries.
cd sx1302_hal
make- Find gateway ID, copy it, open configuration file (located in
packet_forwarder/global_conf.json.sx1250.EU868.USB) and replace gateway ID value.
"gateway_ID": "REPLACE_THIS_VALUE",Navigate to ROS 2 workspace and build.
colcon build --packages-up-to wisevision_lorawan_bridgecd src/wisevision_lorawan_bridge/sx1302_hal/packet_forwarder
sudo ./lora_pkt_fwd -c global_conf.json.sx1250.EU868.USBNote
If there are problems starting packet_forwarder, check the device. In configuration file it is set
to /dev/ttyACM0.
cd chirpstack_docker
docker compose up- Import devices profiles.
cd chirpstack_docker
./import_lorawan_devices.sh- Open Chirpstack dashboard panel by going to
localhost:8080in browser.
- Login to the panel. On the first start username is admin and password is admin.
Note
It is recommended to change the password.
- On the left side, navigate to Gateways under Tenant and add new gateway. One can add multiple of those.
Fill the name field and gateway ID.
- Navigate to Applications and create one. Save
application IDfor later use. - Add device for the application that was just created. For that, Device EUI and Device profile is needed. If there is no profile available for the device, one has to configure it manually.
- If added device supports OTAA (Over-The-Air-Activation), navigate to OTAA keys tab for selected device and fill Application key provided to device.
- Repeat step 6-7 for all devices that one wants to see in the system.
Last step in Chirpstack UI is to obtain CHIRPSTACK_API_KEY needed to connect bridge to Chirpstack via MQTT.
- Navigate to API Keys under current Tenant.
- Add new key and give it a name.
- Copy the value which is presented in the window and store it in
CHIRPSTACK_API_TOKENenvironment variable.
Note
Change broker.host and broker.port parameters if MQTT broker is deployed on different host.
- Source built workspace.
source install/local_setup.bash- Start bridge as standalone node.
export CHIRPSTACK_API_TOKEN=<API key>
ros2 run wisevision_lorawan_bridge lorawan_bridge --ros-args --param application_id:=<APPLICATION_ID> --param use_only_standard:=false- Start bridge in components container.
- start component container
export CHIRPSTACK_API_TOKEN=<API key>
ros2 run rclcpp_components component_container- load bridge component
ros2 component load /ComponentManager wisevision_lorawan_bridge wisevision::LoraWanBridge --parameter application_id:=<APPLICATION_ID> --parameter use_only_standard:=false- Create
.envfile from.env_exampleand rewriteCHIRPSTACK_API_TOKENandAPPLICATION_IDwith personal keys (How to get keys?).
cp .env_example .env- Run docker-compose
docker-compose up- application_id (string),
- use_only_standard (boolean),
- api.host (string),
- api.port (integer),
- mqtt_broker.host (string),
- mqtt_broker.port (integer),
- devices_pagination (integer).

