Pika Spark as a generic robot controller

Pika Spark is a matchbox-sized high-performance micro robot control system combining an unprecedented amount of computing power and interfaces within an extremely small form factor. The Pika Spark has two (2) galvanically isolated CAN interfaces which can be used for communication with external devices. Galvanic isolation prevents ground-loops and increases overall system resilience and is an important feature in industrial-grade control systems.

This tutorial explains how-to to use the Pika Spark's CAN interface to control various different robot types leveraging the OpenCyphal protocol: T07 - a two-wheel drive robot in a tricycle configuration, T07-4WD - a four-wheel drive robot which can be built by doubling the T07 chassis and the T07-Tracked - which is a tracked vehicle sporting two rubber tracks.


T07 - a two-wheel drive robot in tricycle configuration

In order to simplify control and automation all of those three robots share a very similar software and hardware architecture: they are all differential-drive robots whose actuators are DC motors fitted with hall encoders which enables RPM control. In order to control this type of robots a generic robot controller board called CyphalRobotController07/CAN has been developed.

The CyphalRobotController07/CAN is capable of driving up to two DC motors, capture and use encoder feedback for RPM control, evaluate the state of an emergency stop and many other features. The board communicates with other Cyphal nodes via CAN leveraging the 107-Arduino-Cyphal library. It can be extensively configured using Cyphal's register API, which is necessary even for such such architecturally similar robots, as the gear ratio and encoder ticks-per-revolution differ.


3D Rendering of the CyphalRobotController07/CAN done in KiCad

Each of the three different robot types mentioned in the introduction contain one CyphalRobotController07/CAN board - with the exception of T07-4WD which contains four DC motors and hence requires two CyphalRobotController07/CAN boards.


T07-4WD - a four-wheel drive robot with two CyphalRobotController07/CAN boards

Like the hardware architecture the software architecture is quite simple: On the Pika Spark a ROS2 node called t07_robot is executed inside a Docker container. t07_robot is receiving motor velocity set points for the motors on the left and on the right side from another ROS2 node called t07_teleop which is executed on your PC and communicates with the Pika Spark via WiFi. t07_robot is then turning those set points into the required RPM targets for the motors, generates the required Cyphal messages and transmits those messages via Pika Spark's CAN interface to the CyphalRobotController07/CAN board(s).


Software architecture for controlling various robots via Pika Spark

In order to ease installation and execution of the t07_robot ROS2 node on the Pika Spark a whole set of Dockerfile, docker build and run scripts have been prepared here. Running the required ROS2 node on the Pika Spark is therefore as simple as executing the following commands:

git clone https://github.com/107-systems/t07_docker && cd t07_docker
./docker-build.sh
sudo ./docker-run-pika-spark.sh [t07.py | t07_4wd.py | t07_tracked.py]

T07-Tracked - a differential-drive tracked robot with rubber tracks

With the introduction of all three robots as well as the underlying hardware and software architecture in place let's take a look at those robots in action:

Further information can be found here: