Control Baxter robot with robonomics

Example of how it works:

Requirements:

  • Ubuntu 18.04
  • ROS Melodic + Gazebo (installation manual here)
  • extra packages:
sudo apt-get install ros-melodic-gazebo-ros-control ros-melodic-effort-controllers ros-melodic-joint-state-controller
  • IPFS 0.4.22 (download from here and install)
  • pip:
sudo apt install python-pip
  • ipfshttpclient:
pip install ipfshttpclient

1. Download Baxter model and controller packages

Download packages:

cd ~
mkdir -p robot_ws/src
git clone https://github.com/nakata5321/Baxter_simulation_controller.git
cd robot_ws/src
ln -s ~/Baxter_simulation_controller/ .
cd ..
catkin build

Dont forget to add source command:

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

2. Create simulation world

Let's start gazebo world and put our baxter in it:

roslaunch gazebo_ros empty_world.launch

empty world

Open one more window in terminal:

rosrun gazebo_ros spawn_model -file `rospack find baxter_description`/urdf/baxter.urdf -urdf -z 1 -model baxter

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 configuration.txt in robot_ws/src/robot_controller/src/

4.Start simulation

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 <CURIOSITY ADDRESS> -s <EMPLOYER’S KEY>

Where <CURIOSITY 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 IPFS Companion:

ipfs

Click View on Gateway and that's all!

result1result2