Chasing my cat and watching him run around through the lens of a mobile robot is pretty cool. However, there is one drawback: I find it inconvenient to hold the iPad in one hand and the remote control in the other. What if I could integrate the remote control into the Droid Vision app, allowing me to see and control the robot using just one device, with everything consolidated in the Droid Vision app?

This leads to Droid Vision 2.1, which is available for free from the Apple Store.

ROS and Rosbridge WebSocket

To control the robot using the Droid Vision app, I will utilize Rosbridge WebSocket.

In robotics, the Robot Operating System (ROS) is the standard choice for developing robot applications. It provides software libraries and tools that enable developers to seamlessly connect motors, sensors, and software, thereby accelerating the process of creating advanced robots.

Rosbridge WebSocket is a communication interface that allows non-ROS applications, such as web or mobile apps, to interact with a ROS system using JSON messages over a WebSocket connection. It is part of the rosbridge_suite and enables bidirectional communication between ROS nodes and external applications without requiring them to be ROS-native. This is particularly beneficial for applications that need real-time interaction with a ROS system while avoiding the complexity of ROS 2 DDS networking.

ROS 2 Docker Container

To run ROS on Raspberry Pi, I recommend using ROS 2 Docker.

Docker is widely used in enterprise software’s microservice architecture, where each service functions as a lightweight Docker container that can be independently deployed and upgraded. A Docker container is created from a Docker image, which serves as a template defining its structure and dependencies.

The concept of using Docker for robotic applications is relatively new. I have a detailed article about it, which is RPLidar in ROS 2 Docker on Raspberry Pi.

The Dockerfile and its dependent script that I prepared for my robot can be downloaded from here: Dockerfile and start_robot.sh. We can build and start the Docker container using the following commands:

# build the docker image "my_bot_image"
docker build -t my_bot_image .

# start the docker container from the image
docker run -it --rm --network=host --ipc=host -v /dev:/dev \
    --device-cgroup-rule='c 188:* rmw' \
    --device-cgroup-rule='c 166:* rmw' \
    my_bot_image

# start the robot and rosbridge_server in the docker container
ros@raspi3:~/bot_ws$ ../start_robot.sh 

With that, the Rosbridge WebSocket is open on the Raspberry Pi and can be accessed from the Droid Vision app.

Droid Vision App

Using the joystick or keypad on the Droid Vision is straightforward. We just enable the “ROS2 Teleop” in the robot’s settings.

The “Joystick” is the default option for controlling the robot since it is easier to use than the “Keypad”.

If using the “Keypad”, we tap the key for the robot to go in the corresponding direction. To continuously send the same velocity messages, we press down the key, and it sends the same message every 0.3 seconds.

The value of “ROS2 Topic” depends on your robot, but “/cmd_vel” is the default ROS topic for the robot’s velocity. My ROS 2 Control, Robot Control the Right Way blog shows how to configure the “controller_manager” in the robot’s launch file to use “cmd_vel” as the velocity command topic.

Cheers!