3WheelsBot: software details

A software description

In this last part of the post series, we are going to start reviewing roughly the classes of motion-control and then continue with the entities needed by the miLoCo task used.

Again here is the link to the git repo.

motion-control

As probably you remember from the first post, this is the program that runs on the beaglebone. If you read its main, you will notice a class called MotionApp, which is the one that controls the bot. An object of MotionApp is created after parsing the arguments. The constructor of this class initializes everything needed to move the bot, e.g. the motor drivers and kinematic model. After the object creation, the method startApp() is called. Here the miLoCo task stars running.

3WheelsBot: plant model

Modeling the plant (DC motors + wheels)

The goal of this second part is to obtain a model of 2 motors with wheels. So, we are going to work with math, don’t worry, it’s not to much.

First step is to run a program on the beaglebone in order to get the step response of a DC motor with a wheel, for this we need everything connected to the board (motor + encoder). Then we use a python script to fit the samples, which are the output of the previously run program, and with help of the same script we get the space state representation of the model. Finally we expand the representation for 2 motors.

3WheelsBot: a bot with B of Beaglebone

3WheelsBot is a mini-project made with the purpose of showing a use case of miLoCo and it’s based on beaglebone blue.

If you want an introduction to miLoCo consider reading this post an overview of miLoCo.

Before starting, check this post getting started with beaglebone blue for configuring the board.

You will find the code in this git repo. The code is in written in C++ and librobotcontrol is used to control the hardware on the beaglebone blue.

An overview of miLoCo

miLoCo: a control system library for embedded systems

If you want to work with control systems on microcontrollers miLoCo is what you are looking for.

miLoCo is mostly a template library, which means that it is mainly composed by header files. Actually besides one class (TaskExecuter) and the examples, the rest are only headers.

It offers different features:

  • Filtering
  • Loop control (also nested loops)
  • Pole placement method
  • Reduced-order observer
  • Plant simulation (by means of transfer function or state space representation)
  • Interpolation

Motivation

I started a mini project using a STM32, more precisely a blue pill, in which my idea was to implement a control loop for DC motors using encoders. At the beginning it was only about a simply control loop but as the time went on I added more and more functionalities (starting with filtering and nested loop control). The time to separate the code into a library had come. The most important advantage of this is the possibility of reusing it for another architecture.