Close

Software

A project log for Tobi-P, the rabbit robot

A cute, cubic and curious companion with a tilt camera. And a carrot.

jdelbejdelbe 09/27/2021 at 07:440 Comments

Free and Open-Source Software is used as much as possible throughout the project. On the robot of course, but also for the tools around it: the source code is written on Linux and hosted on GitLab, the case is designed with Blender, sliced with PrusaSlicer, and a Fairphone running /e/OS is used for the Android app.

Component selection

1. Raspbian (Raspberry Pi OS) Lite

The rock-solid OS for the Pi, based on Debian.

2. ROS 1


The reference framework for roboticists. I actually wanted to ramp up on ROS 2, however this proved to be way more complex than I expected (at least a couple of years ago). So I stuck to the traditional one, ROS 2 will have to wait for another time.

An option would have been to cross-compile the latest version from sources, but that seemed too tedious. And in spite of being quite slow, the direct installation on the target from the available arm packages was sufficient in the end.

3. raspicam_node

A dedicated ROS 1 node for the Raspberry Pi camera module, which worked out of the box.

4. pi-blaster

This excellent tool enables using hardware PWM on the desired GPIO pins of the Pi, and is thus very efficient.

Tobi software

The complete code running on Tobi-P can be found in the dedicated GitLab repository (see the README for instructions). In particular there is an installation script that takes care of almost everything. It even has a nice little spinner displayed while waiting for completion.

The wireless network is provided by an Access Point running on the robot, therefore there is no need for an existing Wifi connection. Stand-alone usage is really practical, it means that Tobi-P can for instance run outdoors. He is also - by the way - the ROS master. Obviously.

The nodes are written in C++, and there are a couple of helper files (launch, machine) for flexible configuration. There is a launch file that enables controlling a turtlesim simultaneously, which is always helpful for quick network tests when dealing with multiple machines.

The min and max angles of the servomotor have been limited by software, in order to account for the connecting rods behind the face, that physically reduce the rotation range. The servo angle is also always reset when the application starts, meaning that the camera/face comes back to its initial vertical position. This way it matches the behaviour of the tilt slider on the Android application.

Android application - ROS Control 🥕

The ROS Control fork for Tobi-P contains everything needed to generate the apk from Android Studio (be sure to carefully follow the instructions in the README).

While most of the elements I had in mind for an app were already present in the upstream repo, I still wanted to tailor it for this use case, hence the fork. First I wanted a lighter version, so I stripped down the interface and removed the features not required (mapping, HUD, other control modes and advanced options). Then to tilt the camera, a vertical slider was missing. This was solved by using a seekBar from the SDK.

The application now directly starts in the camera view mode with the desired layout for the controls. It also handles portrait and landscape orientations. The new ROS parameters and topic names can as well be changed directly in the options.

When looking down with the camera, the front paws can be seen, the tip of the ears when looking up.

Discussions