Mobile Robots Battery Status Tutorial
This tutorial will guide us deeper into the request-response service and the dht, show hyveOS in the context of mobile robots, and explain some of the decentralization-specific patterns that might be needed for developing hyve applications.
Scenario
Let’s consider a scenario with three robots: node 0, node 1, and node 2.
node 0is a Raspberry Pi connected to a charging station and monitors its status. It knows when the charging station is being used and can communicate with the other nodes.node 1andnode 2are mobile robots with batteries that need to be recharged periodically. When their battery levels drop below a certain threshold, they request access to the charging station fromnode 0.
In this tutorial, we will implement the logic for node 1 and node 2 to send a request
to node 0 when their battery levels are low.
We will also implement the logic for node 0 to respond to these requests with an action suggestion,
indicating whether the robot should return to the charging station or wait.
We will use the send_request() method of the request-response service to send the request
and the receive() and respond() methods to handle the response.
Steps
- All nodes provide their role together with their peer_id in the DHT
node 1andnode 2need to find out the peer id ofnode 0node 1andnode 2periodically check their battery levels- If the battery level is below a certain threshold, they send a request for charging to
node 0 - Then,
node 0first needs to find out the peer ids ofnode 1andnode 2 node 0receives the robot’s request and decides whether the robot should return to the charging station or waitnode 0responds to the request with an action suggestion. If the robot should wait, it also provides an estimated duration until the robot can charge.
Further development
Coming soon…
© 2025 P2P Industries. This documentation is licensed under the MIT License.
Cookie Policy
Privacy Policy