Giter Club home page Giter Club logo

robonomics_sample_controller's Introduction

HOWTO: Robonomics demo with Curiosity Rover moving after transaction and storing data in blockchain

Sample of how it works is available on YT: https://www.youtube.com/watch?v=6BSOyRbmac8

Requirements:

  • ROS Melodic + Gazebo + RViz (installation manual here)
  • extra packages:
sudo apt-get install ros-melodic-gazebo-ros-control ros-melodic-effort-controllers ros-melodic-joint-state-controller
  • IPFS up to 0.6.0
  • Robonomics node (binary file) (download latest release here. This tutorial tested fine on v1.1)

1. Set up a simulation

Download Curiosity rover package:

mkdir -p robonomics_ws/src
cd robonomics_ws/src
git clone https://bitbucket.org/theconstructcore/curiosity_mars_rover/src/master/
cd ..
catkin build

We need to adjust starting conditions to make our rover spawn smoothly:

  • Go to

src/master/curiosity_mars_rover_description/worlds and change line 14 of the file mars_curiosity.world to <pose>0 0 8 0 0 0</pose>

  • Go to

src/master/curiosity_mars_rover_description/launch and change line 4 of the file mars_curiosity_world.launch to <arg name="paused" default="false"/>

Don't forget to add source command to ~/.bashrc source /home/$USER/robonomics_ws/devel/setup.bash

  • Reboot console and launch the simulation:
roslaunch curiosity_mars_rover_description main_real_mars.launch

Mars rover

Note: if the image is dark, e.g. shadowed, change Camera to Orthorgraphic in Gazebo toolbar. The simulation can be closed for a while.


2. Download Robonomics controller package

To download a controller package for Rover type in terminal:

cd ~/robonomics_ws/src
git clone https://github.com/PaTara43/robonomics_sample_controller
cd robonomics_sample_controller
pip3 install -r requirements.txt
cd ..
catkin build -DPYTHON_EXECUTABLE=/usr/bin/python3 # The controller supports python3

3. Manage accounts in DAPP

Since we are testing, let us create a local robonomics network with robonomics binary file:

./robonomics --dev --tmp

Running node

Go to https://parachain.robonomics.network and switch to local node

Local node

Go to Accounts and create CURIOSITY and EMPLOYER accounts.

Important! Copy each account's address (to copy address click on account's icon) and Curiosity's account mnemonic seed (obtained while creating the account) Transfer some money (units) to these accounts. You can read more about accounts in Robonomics here

Account creation

Add these addresses, seed and node address (defaults to ws://127.0.0.1:9944 for developer node) in config.config in robonomics_ws/src/robonomics_sample_controller/src. No quotes.


4. Start Robonomics

In a separate terminal launch IPFS:

ifps init #you only need to do this once per IPFS installation
ipfs daemon

In another separate terminal launch Curiosity simulation if it's not live:

roslaunch curiosity_mars_rover_description main_real_mars.launch

Wait till it stays still

In another terminal launch the controller:

rosrun robonomics_sample_controller sample_controller.py

Controller

Now you can send a transaction triggering the Rover to start moving and collecting data. To do so, you can use the same portal https://parachain.robonomics.network. Go to Developer->Extrinsics and select Curiosity's employer account, launch extrinsic, Curiosity's account as a target account and yes as a parameter. Submit the extrinsic.

Extrinsic

The robot should start moving. It won't accept commands from other accounts neither commands with no parameter. The rover will move around and collect data for about a minute. Later, when the job is done:

Job done

On the Robonomics portal go to Developer -> Chain state and obtain a CURIOSITY datalog using โ€œ+โ€ button with selected datalog -> RingBufferItem as query:

Datalog

Now the IPFS hash of the telemetry is saved in the blockchain. To see the data simply copy the hash and find it on a gateway:

Data in IPFS

This telemetry is kept in a decentralized storage, and it's hash is stored in a blockchain!

robonomics_sample_controller's People

Contributors

patara43 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.