Control Baxter robot with robonomics
Example of how it works:
- 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)
sudo apt install python-pip
pip install ipfshttpclient
- Robonomics node (binary file) (download latest release here)
- Create Baxter and Employer accounts on Robonomics Portal
(you can find tutorial "Create an Account on Robonomics Portal" here).
- IPFS browser extension (not necessary)
1. Download Baxter model and controller packages
cd ~ mkdir -p robot_ws/src cd robot_ws/src git clone https://github.com/nakata5321/Baxter_simulation_controller.git cd Baxter_simulation_controller git checkout old_version cd ../.. catkin build
Dont forget to add source command:
echo "source /home/$USER/robot_ws/devel/setup.bash" >> ~/.bashrc source ~/.bashrc
2. Create simulation world
Let's start gazebo world and put our baxter in it:
roslaunch gazebo_ros empty_world.launch
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.
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
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
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
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
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>
<CURIOSITY ADDRESS> and
<EMPLOYER’S KEY> are replaced with previously saved strings accordingly
You should see the following:
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.
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:
Click View on Gateway and that's all!