Skip to content

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 0 is 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 1 and node 2 are 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 from node 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

  1. All nodes provide their role together with their peer_id in the DHT
  2. node 1 and node 2 need to find out the peer id of node 0
  3. node 1 and node 2 periodically check their battery levels
  4. If the battery level is below a certain threshold, they send a request for charging to node 0
  5. Then, node 0 first needs to find out the peer ids of node 1 and node 2
  6. node 0 receives the robot’s request and decides whether the robot should return to the charging station or wait
  7. node 0 responds 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