Say "Hello Baxter!" with robonomics
Example of how it works is available here.
- 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)
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
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
cp src/baxter/baxter.sh .
Edit the following values in
- your_ip value - put your local ip address
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.
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
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
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>
<BAXTER 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 the search bar with URL:
gateway.ipfs.io/ipfs/<put your hash here>