How I gave a purpose to the Arduino Tinkerkit Braccio Robot

Integrating a robot to your daily life sounds fun, doesn’t it? Here is one of my weekend projects.

Introduction

I used to work at a robotics company in construction industry. The company prefabricates rebar cages using industrial robots. In Norway 🇳🇴, I got to play with two industrial robots.

The company often travels to different countries all around the World and unfortunately, it’s not possible to fit these robots into cabin luggages. That’s why the company recently added Arduino Tinkerkit Braccio to its fleet. Braccio is small, light and easy to carry around.

At the airport, security doesn’t fully understand what this thing with many tiny components is when they scan my bag. Often, I am asked to open and reveal this bad boy.

Tinderkit Braccio Robot (source)

Tinkerkit Braccio, is a 6 DOF (Degree of Freedom) mini robot, 6th degree being the gripper. As described in documentation, it is possible to change a few screws and add a new design to the robot. One can use it as holder for screens, solar panels, cameras or even alter it to have fewer DOF. Though, its default layout fits my purpose perfectly.

I love talking to people and at events, I want to attract as many people to my stand. To me; the more people I talk to, the higher the chances of me meeting possible future employees, partners etc.

I remember myself getting excited over at Fountains of Bellagio. If I am not mistaken they were playing a song once in every half an hour and we were trying not to get too far away so we can be back on time for the next song. Yes, it was my first time at The Strip.

Since babyhood, we enjoy staring at moving things. That’s why I thought just making the robot move and do something really basic would be enough to achieve my goal v0.1 and accordingly I gave the purpose of moving to this Braccio robot.

Making Tinderkit Braccio Robot Move

I made it move from one side to another, carrying and placing the brick. After each iteration it waits 15–30 seconds (randomly selected).

To control Braccio robot, there is this library provided by Arduino.org. Though, due to the additional features, I preferred to use this library.

Position pos;
pos.set(0, 15, 180, 170, 0, 73);
BraccioRobot.moveToPosition(pos, 100);

These lines of codes are enough to make the robot move. I am telling the robot to set its 6 motor angles to 0, 15, 180, 170, 0, 73 degrees with the speed of 100 degrees per second. I could keep adding variations of above lines for different movements. Though; it doesn’t sound fun, does it?

(source)

What if I could program this tiny robot, just as I programmed the big ones?

To program big robots, the company uses Python API of its partner RoboDK. RoboDK allows both offline and online programming with an easy approach.

Robot Communication

I started by making an offline simulation inside RoboDK. In this offline simulation, robot picks the item from one spot and drops it in another.

RoboDK Offline Robot Simulation

Next step was to actually connect to the robot and send these movement instructions. To connect to a robot, RoboDK uses robot drivers. A driver for the company’s big KUKA robots had already existed in RoboDK but for this little one, I had to make something new.

Getting Started with Custom Robot Driver

For different operations, RoboDK sends certain commands. For example:

CONNECT 192.168.100.1 10000 // Connect to the robot
MOVJ 10 20 30 40 50 60 // Move robot joints to given angles

These commands should be parsed and handled inside robot driver.

Once you understand the commands RoboDK sends, it should be relatively easy to use existing drivers as example to make your custom one, right? Right? Not so fast! Even though existing driver codes seem to have similarities, due to (I guess) differences in robots, lack of time of developer(s) and my inexperience; I spent some good amount of hours to get the hang of it.

Preparing Custom Robot Driver Base Library

To make drivers for different types of robots easier in the future, I decided to pack this project into a package. Below is one of the company’s custom simple robot based on Arduino to act as a cage and protect camera from sparks and light of welding.

Every robot connects, disconnects, communicates (sends & gets message) and runs a command.

Because Tinkerkit Braccio runs on Arduino and it’s a serial connection to Arduino, I created a child class called RobotSerial having parent Robot.

Setting up and breaking the connection is also straightforward.

Below methods are used to communicate with RoboDK. For example, to set robot status. Sometimes, you would prefer to read whatever robot is telling but times you would prefer to get just “Yes, I am finished and ready for your next command.” message. Hence in the latter method, you can define which command you are expecting to receive.

Last part is to run the commands on the robot. Since it will differ for different robots, this method here is left abstract.

Another thing to prepare is handling RoboDK commands and actually sending them to robot.

One of the most important part between communication is the robot status on RoboDK. Here, communication is handled through stdin.

Even if the robot is ready for commands, if status on RoboDK is not set to Ready, you will have issues running your programs. There are predefined statuses on RoboDK and these are colored automatically.

Predefined RoboDK statuses

To set predefined status on RoboDK, status message should be sent with “SMS:” prefix.

The last part of the library is to actually parse the command string into smaller parts to understand.

command = "CONNECT _port_ _baudrate_"parsed_command = {
'cmd': 'CONNECT'
'args': ['_port_', '_baudrate_']
}

Making Custom RoboDK Driver

Because I’ve built base as library, we can install and start using it for Braccio or any other custom robot driver.

pip install robodkdriver

By extending RobotSerial class, I defined Braccio and added clauses for RoboDK commands such as MOVJ (Move Joints).

All left is to define robot specific command codes. Because none exist for Braccio, and I have to write it anyways, I decided to make Braccio understand original RoboDK commands.

For each incoming command through Serial, Arduino understands and lets the robot do it.

The codes to make your own custom RoboDK robot driver can be found on GitHub. Feel free to improve, fix or use in your projects.

Did I achieve my goal v0.1?

Everyone passing by took a look at it and around 90% approached to listen to more of what the company I used to work for does. Babies loved it but their parents not so much. Oh and one drunk dude tried to handshake with it.

Until a next stand to put this robot on, I hope there will be more exciting movement for the robot.