Recently I saw a blog article from @zahi_kakish that got me interested in exploring the viam framework for robotics. I wanted to try it out and see what it looks like. Here is my initial experience with the framework as I tried to follow their docs tutorial to get mock robot running on my Linux laptop [running Ubuntu 22.04].
Steps to perform on your laptop
Install viam-server and start it, just run following command in linux terminal
curl https://storage.googleapis.com/packages.viam.com/apps/viam-server/viam-server-stable-x86_64.AppImage -o viam-server && chmod 755 viam-server && sudo ./viam-server — aix-install
sudo systemctl start viam-server
Build your mock robot in cloud using the viam web app
follow instructions here — https://docs.viam.com/tutorials/configure/build-a-mock-robot/. You have to login to the app at https://app.viam.com/
Here is the summary of steps:
- add your new robot
- add arm component to robot [of fake arm type]
- add motor component to robot [of fake motor type]
- add board component to robot of fake board type [this step was missing in the docs but was required]
You can setup dependencies between arm and motor [since arm is using the motor]. I did it by using the depends on field in each component.
At this point download the mock robot config file and tell the viam-server to use it.
- download config file you prepared from app [running on cloud]
- configure viam server using your mock robot config file [json format]
# you can copy this link from your robot's setup tab
sudo curl -H “Secret: yoursecrethere” “https://app.viam.com/api/json1/config?id=your_config_id_here&client=true" -o /etc/viam.json
sudo ./viam-server -config viam.json
Write/modify python code to control the mock robot using viam sdk
First install python sdk for viam
pip install viam-sdk
##3 create python code file to use viam SDK to control your mock robot
if you have followed all the steps the control tab will show your components. You can expand arm component to see if joints are showing any movement [this will happen when we run our python code on laptop]
Goto sample code tab and copy the code in the file and save it as some file name e.g. testmock.py
At the end of all import statements at the beginning of your python file add following import statements
from viam.components.arm import ArmClient, JointPositions
At the end of your main function add following statements
arm = ArmClient.from_robot(robot=robot, name='myArm')
Run the code at command line by doing
See my full config file and python code file in references section.
You should see output like this — https://docs.viam.com/tutorials/img/build-a-mock-robot/image2.webm
Overall I have good first impression of the framework and how easy it was to get up and running without a lot of installation issues and things just worked as soon as I started the viam server on my machine. It will be interesting to see how it performs on RPi4 once I start converting my real hardware robot to this and how responsive things are. Most of the stuff on their site says its all open source but it looks like there is a good portion of compute running on the cloud and they do have pricing on their site for that. But how much it would cost to run prototyping and running robots for hobby/tinkering would cost as opposed to commercial remains to be seen. But it looks very promising and worth tinkering with it more.
Thanks also to Jack Damon @1nternetjack for pointing me to documentation and discord links.
Enjoy!! Next, I’m going to convert one of my small wheeled robot that runs on RPi4 to run using viam framework. In addition more ambitious goal would be resurrect my old hoverboard robot project to use this framework. They have an example rover robot that looks very similar to my hoverboard robot and I have most of those parts so I might try that if the small robot experiment goes well!!
Installation guide — https://docs.viam.com/installation/
Mock robot instructions — https://docs.viam.com/tutorials/configure/build-a-mock-robot
Using the Viam RDK with the Mini Pupper Robot
Having used ROS for many years now, I've always been curious how other programming middlewares would work in comparison…
Config json file
Python code file [scrubbed]