Say "Hello Baxter!" with robonomics

Example of how it works is available here.

Requirements:

  • Ubuntu 18.04
  • ROS Melodic + Gazebo (installation manual here)
  • extra packages:
sudo apt-get install ros-melodic-qt-build ros-melodic-driver-common ros-melodic-gazebo-ros-control ros-melodic-gazebo-ros-pkgs ros-melodic-ros-control ros-melodic-control-toolbox ros-melodic-realtime-tools ros-melodic-ros-controllers ros-melodic-xacro python-wstool ros-melodic-tf-conversions ros-melodic-kdl-parser python-wstool python-catkin-tools qt4-default
  • IPFS 0.4.22 (download from here and install)
  • pip:
sudo apt install python-pip
  • ipfshttpclient
pip install ipfshttpclient

1. Download Baxter model

Download packages:

cd ~
mkdir -p robot_ws/src
cd robot_ws/src/
wstool init .
wstool merge https://raw.githubusercontent.com/RethinkRobotics/baxter_simulator/master/baxter_simulator.rosinstall
wstool update
git clone https://github.com/nakata5321/Baxter_simulation_controller.git

This packages were created for ROS indigo. We have to change some files to run them on ROS melodic. We will use patch files.

patch ./baxter_simulator/baxter_sim_io/include/baxter_sim_io/qnode.hpp ./Baxter_simulation_controller/patch/qnode_patch
patch ./baxter_simulator/baxter_sim_kinematics/src/arm_kinematics.cpp ./Baxter_simulation_controller/patch/arm_patch

And let's build all our packages:

cd ..
catkin build

Dont forget to add source command:

echo "source /home/$USER/robot_ws/devel/setup.bash" >> ~/.bashrc

At the end save Robonomics node (binary file) in robot_ws directory.

2. Start simulation

First of all copy and edit baxter.sh

cp src/baxter/baxter.sh .

Edit the following values in baxter.sh :

  • your_ip value - put your local ip address
  • ros_version

Run the baxter shell script with sim specified:

./baxter.sh sim
roslaunch baxter_gazebo baxter_world.launch

You can put some models in front of our baxter. It will be more intresting. baxter

3.Manage accounts in DAPP

Since we are testing, let us create a local robonomics network with robonomics binary file. Go to folder with robonomics file and run:

./robonomics --dev --rpc-cors all

robonomics

Don't forget to remove db folder after every launch:

rm -rf /home/$USER/.local/share/robonomics/chains/dev/db

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

Go to Accounts and transfer some money to Baxter and Employer accounts.

You can find The manual "Create an Account on Robonomics Portal" here.

Add Baxter's secret key and adress to config.yaml in robot_ws/src/Baxter_simulation_controller/config/

4.Beginning of work

In new window run:

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

Open separate terminal and start controller package:

rosrun robot_controller robot_control.py

waiting

Return to the first terminal, open new window and send command to robonomics io. This command will turn ON your robot:

echo "ON" | ./robonomics io write launch -r <BAXTER ADDRESS> -s <EMPLOYER’S KEY>

Where <BAXTER ADDRESS> and <EMPLOYER’S KEY> are replaced with previously saved strings accordingly.

rob_message

You should see the following:

working

when the work is over go to the Robonomics Portal to Developer > Chain state. Choose datalog in state query and add Baxter datalog message using "+" button.

datalog

Now the IPFS hash of the telemetry and photos is saved in the blockchain. To see the data simply copy the hash and insert it in the search bar with URL: gateway.ipfs.io/ipfs/<put your hash here>

That's all!

result1result2