Skip to content

jhavinit/Blockchain_Swarm_Robotics

Repository files navigation

Blockchain_Swarm_Robotics

Contributions are most welcome!

Objective:

To develop a Blockchain based Decentralised Framework for a 2 - bot foraging system using V-rep and python. There will be two bots in the arena and they both are on the same blockchain network. They bot will be assigned fixed number of boxes to pick and place, BUT if they finish their own boxes they can go to help the other bot and pick other bot's boxes (<-main concept of swarm robotics). In the Result video below: Bot#1 which is faster is assigned blue boxes and bot#2 is assigned green boxes to pick and place. Bot#1 completes placing its boxes and then goes for Bot#2's box for picking and placing. All the bots interaction is through Blockchain and it is completely decentralized. PoW is used for mining the box(block in blockchain). The boxes kept are mined by other bot when it wants to help pick that box which was assigned to some other bot(It can get some amount as a result of a smart contract). Decentralization makes the whole process secure, consistent and fast.

System:

In an arena where blocks are kept in random cells,relatively simpler bots come together to make collective decisions and forage all the blocks to a common place.

Workflow of Code:

Capture

This project is implemented for 2 bots, one can scale it for more bots.

How to implement above code locally:

Understanding the file structure:

  1. vrep_scenes: Contain all files that are required to run Vrep locally and are required to be started before any next step.
  2. test_version_1: Contains python code to implement 2 bots ... server1/2 and client1/2 are used via sockets.
  3. display_blockchain: Contains 2 files: HTML and python that is used to visualize the blockchain in a web browser.
  4. communication: Contains files for communicating between Vrep and python script (zigserial) that gets the path for bot.
  5. client_server_files: Contains the client and server files for each of the two bots(It has addtional for 3rd bot also but it is not used in this project).
  6. botS: Contains files required for running bots in vrep enviornment.
  7. Blockchain code working(without vrep and segregation): Contains the code for client and server for bot 1 and bot 2 without vrep. One can test it seperately in this folder itself. Example: Step 1: Run server-1.py and server-2.py Step 2: Run client-1.py and client-2.py You can observer how blockchain is modified at each step after box pick and place.
  8. main: It contains all the files and folders collectively in one folder from which one can run the project directly.

How to run code on a local system?

Step 1: Fork the repo: https://github.com/jhavinit/Blockchain_Swarm_Robotics
Step 2: Go inside /main directory in your system (All the files required to run the project are inside "main" folder)
Step 3: Install Vrep v_3.6.1 (Tested in ubuntu 16.04 LTS)
Step 4: Make sure to have python > 3.5.4 and a text editor for editing C, C++ (gedit) and python files(IDLE py:3.5.4)
Step 5: Make the virtual serial ports for 2 bots (4 terminals in total) (Refer Medium article for setting virtual port: [https://medium.com/@karthiks1701/virtual-serial-ports-hack-for-communication-between-local-scripts-883fda0f60f]) Step 6: Open the scene in Vrep: Go to vrep and open scene (filename: dual_bot.ttt or fin_rep.ttt(recommended))
Step 7: Run server-1.py and server-2.py
Step 8: Run the cpp exe files that are in the debug folder of ebot1 and ebot2
Step 9: Run the main-1.py and main-2.py
Step 10: One can observe the results in the Vrep

Result video:

qr_vrep_simulation (1)

Images during project development:

Screenshot from 2019-07-03 15-58-50 Capture Screenshot from 2019-06-13 14-53-21 Screenshot from 2019-06-30 12-57-46 Screenshot from 2019-06-30 16-29-21

References:

  1. https://dl.acm.org/citation.cfm?id=3237464
  2. https://arxiv.org/pdf/1608.00695.pdf

About

Application of Blockchain in swarm robotics for a secure, distributed and effective output

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published