Control Baxter robot with robonomics

Example of how it works:

Requirements:

  • 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)
  • ipfshttpclient:
pip install ipfshttpclient
  • Robonomics node (binary file) (download latest release here)
  • IPFS browser extension (not necessary)

1. Download simulation and controller packages

Download packages:

mkdir -p robot_ws/src
cd robot_ws/src
git clone https://github.com/nakata5321/Baxter_simulation_controller.git
mv Baxter_simulation_controller/* ./
rm -rf Baxter_simulation_controller/
cd ..
catkin build

Dont forget to add source command:

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

2. Start simulation

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 create Baxter and Employer accounts (Robot is not necessary)

Important! Copy each account's key and address (to copy address click on account's icon). Transfer some money (units) to these accounts:

create accountaccounts

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 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