As a software developer, you transform your thoughts and ideas into digital reality using code. But have you thought about using your software skills to build robots? Viam makes it easy to leverage your software skills to get started in robotics. You just need to learn a few things.
If you can write code, you can build a robot
When you think about it, coding is the art and science of writing instructions for a computer to follow. Whether you're a web developer, software engineer, computer scientist or anyone who knows how to code in some capacity, you’ve probably have had moments while coding where you felt like you had super powers.
Just think about it…
Developers write instructions for computers to execute at blazing speeds. Those instructions run continuously without getting tired for a very low cost as part of applications that can impact millions of users worldwide. Applications that...
- Connect people around the world
- Solve daily problems
- Analyze financial data and automate trading stocks or crypto
- Sort through emails, manage files or even automatically send a text message when it's your friend's birthday ;)
The list goes on and on.
As a programmer, you can shape our digital future, but it doesn’t stop there. You can shape our physical world as well.
There's something magical about writing code, running it, and seeing your robot move next to you. Programmers have the skills to create the intelligence in a robot (and other products for that matter) that allow it to interact with the world around it.
If you are a web/mobile developer or know how to code and are thinking about delving into robotics to start a company or even just to have fun, this article is for you!
There’s a reason why web developers can make great roboticists
Robotics can be challenging and complex in part because of the different engineering disciplines required to build something. There's mechanical engineering to build the structure and understand dynamics, electrical and electronics engineering to connect and wire your sensors and actuators, and lastly there's computer and software engineering to program the robot.
When you’re working on something difficult, it can be helpful to reduce unknown variables to decrease the difficulty and leverage what you already know.
And that's where you have an advantage. Well, more like two.
1. You know how to solve hard problems with code
This is a big one. It’s easy to learn how to code, but it’s hard to develop the skills to solve problems. You’ve put in the time, developing and debugging applications, so you’re going to be able to identify problems and come up with solutions quicker than most.
2. You understand client/server architecture
When building a website or an app, you write code where clients make requests to a server. This server can make requests to other services, query databases, cache data, etc. The server's main functionality is to take actions and return a response.
With a website, the clients make HTTP requests and the servers respond back with HTML, CSS and Javascript for content to display on the client. Similarly, if you were making a HTTP request to an API you will get back JSON.
While not all robotics frameworks have a client-server architecture, there’s one that does.
Introducing Viam: a robotics platform that’s great for developers
Viam is a robotics software platform that supports every step of your robot development lifecycle to bring your robotics ideas to life.
When creating a robot with Viam, you can think of a robot as a server running on a single board computer that is waiting for a client to send a request. The client code can live on the robot or can be run externally.
The server running on your robot is the Viam RDK (Robot Development Kit). This server acts as a gateway that passes requests to other services on your robot.
Using the web development analogy, we can consider the other services as microservices that are responsible for an individual functionality of your robot.
With Viam there are two main types of microservices: Viam components and Viam services.
A component represents a physical piece of electrical or electromechanical hardware in a robot, whereas services are built-in software packages that make it easier to add complex capabilities such as motion planning or object detection to your robot.
Just like microservices in web development, this architecture provides better organization that helps with building and debugging your robot, and is resilient if one microservice fails or needs to be replaced.
When setting up your robot in the Viam app, you can directly configure, test and debug each component and service of your robot. This configuration gets saved as a .json file on your robot.
The first step in building your robot is choosing, connecting, and configuring your Viam components.
Viam components
Fair warning: choosing and working with sensors and actuators might be the hardest part of getting into robotics as a web developer. That being said, I’ll do my best to help flatten the learning curve.
Introduction to sensors and actuators
When designing your robot, you want to break it down into Viam Components. These components represent sensors, actuators, and other hardware you want to control with Viam that are needed for the robot to achieve a task.
Most sensors and actuators can be described as devices that convert one form of energy into another—to either measure the physical world or interact with it.
Why is this definition important?
Sensors are inputs for the robot to give it directions or awareness of its surroundings. Sensors detect and respond to their physical environment.
This input can be light, heat, motion, moisture, pressure or any number of other environmental variables. You could include cameras, buttons, and radio control as sensors as well. Sensors “observe things" and generate electrical signals based on what they detect.
Actuators, on the other hand, are outputs. They can be motors and solenoids which convert electrical energy into physical motion, or they can simply be a LED, sound/audio or console log to the terminal. Actuators “do things" in response to electrical signals.
As a roboticist, it's not actually that important to understand how sensors and actuators work and how they are built. Some are quite complex and require many fields of engineering to really understand.
However, it is important to understand how to read the signals from the sensors and generate signals that instruct the actuators on how to operate.
Before reading and generating signals, you first need to connect them to your robot's single board computer.
Setting up your robot's sensors and actuators
In robotics, sensors and actuators come with datasheets and documentation to help you connect them to your single board computer, similarly to how a web API has documentation of their endpoints.
How you connect your components will vary depending on the single board computer and component.
When picking and working with components and electronics, I recommend following the documentation online, connecting the component to your single board computer, and testing them individually from the Viam app. This is a completely new topic to many web developers, but if you follow documentation, you’ll be fine!
Having an electrical or electronics background could be helpful when you're on this step, but following online resources is enough. You will likely need to troubleshoot issues as they come up, but thankfully you’re used to debugging so this shouldn’t be too much of a problem. I recommend referencing robotics forums that have a lot of great information and the Viam Discord that has many engineers willing to help.
But let’s be realistic here…
If you don't want to put a lot of effort into building the electronics and figuring out the wiring, you don't have to. You can buy a robot that is pre-configured like the Viam Rover or the list of robotic arms listed on their site.
As innovation continues to grow in the tools we have for mechanical and electrical engineering, it will be a lot easier to plug and play pieces of a robot so you can focus just on developing the software.
Programming your robot with Viam
So, you have a robot you’ve either bought or you built. You’ve installed the Viam server onto the robot, connected it to the Viam app, and tested all the components.
It’s finally time to write some code!
Now that you have an understanding of the Viam server, you can start to program your robot by making requests to the robots server the same way a client makes requests to a server.
You can write your code from an external computer or you can drop the client file onto your robot's single board computer. A major difference between Viam servers and web servers is that a Viam server understands gRPC and WebRTC requests, which are different from traditional HTTP requests.
You can read more about these different communication protocols here.
The great thing is that you don't need to learn how to make gRPC and WebRTC requests. Viam provides SDKs to help make those requests to your robot in a number of languages including, Python, Go, TypeScript, C++ (alpha) and Flutter (alpha). You just download the SDK and you’re ready to code!
If you’re like me and love coding in Python, I made a VS code extension with predefined Python code snippets and templates for the most common coding tasks related to Viam.
Both the SDKs and my VS code extension are a couple of ways you can save time and focus on the important parts of software development for your robot.
Try Viam by remotely controlling a rover in the Viam office
As I previously mentioned, you can get started with robotics by buying a preconfigured robot such as the Viam Rover. Viam has also made it really easy for you to program a robot without purchasing any hardware. You can actually rent one of their assembled rovers in their NYC office!
You could take a look at the robot's configuration in the Viam app where you’ll see the list of components such as the Base, Motors, Input Controller, and Camera. With a few simple steps, you can control it with your keyboard or program it to complete a task.
Learn more about trying Viam here or take a look at this video I created on how to get started.
Next steps
With your web/mobile development skills and the accessibility to software platforms like Viam, it's a lot easier to delve into the robotics space. Of course this is just an introduction, but you can do some really powerful things just with a Viam Rover and the supported components and tools.
If you want to work on more advanced robots, the next step would be to use the current Viam components with Viam services. Viam services let you add complex software capabilities such as motion planning, machine learning (for purposes like object detection), data management, and more to your robot.
Next, I would recommend doing projects that let you expand your knowledge in a specific field of robotics. For example, you get into Mechanical with CAD and 3D printing or into Electrical and Electronics by prototyping circuits and designing PCBs.
Learning by doing is key here. By building several projects and learning all of these disciplines, you become a well-rounded roboticist. At the very least, the experience will give you enough information to find help or hire and work with others.
Even though I do recommend getting familiar with all the engineering fields to build a robot, I still believe that software will take over the robotics space. As hardware continues to advance, there will be less Robotics Engineers or teams composed of interdisciplinary engineers. Instead, there will be software developers like yourself shaping the future of robotics and... the future of our world.
Ready to get started on building a robot? Check out the Viam Documentation for everything you need.
If you have questions or want to chat with other robotics builders and enthusiasts, join the Viam Discord Community—we'd love to have you there!
About the author:
Hey my name is Waseem! I have been coding for about 10 years and started my engineering journey in robotics. I competed in FIRST and VEX competitions and then went on to building autonomous and racing quadcopters. At that point, I developed an interest in software and startups. I went on to co-found a company that worked on machine learning for the supply chain space and have continued to work at startups and on my own ideas.
I’m currently building a robotics bootcamp to fast track your journey into robotics! I also share info about Robotics, AI and tech on the interwebs. Connect with me on Twitter and LinkedIn.