Spread the love
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

Overview

As we saw in the previous articles (Tutorial – How to control motor with The Tactigon – Part I – Hardware and Tutorial – How to control motor with The Tactigon – Part II – Sketch), The Tactigon can be connected and talk to a serial motor control board. We want to control motor over BLE, and in this article we’ll look at how to control the rover using a second Tactigon as controller, using pitch and roll to compute tracks’ speeds (called wheels speeds from now on), transmitting data over Bluetooth Low Energy.

Sketch

The sketch running on the rover is the same one of the previous article. We will look at the one in the controller, since it’s the one that does the math.

Motor Control over BLE

The Tactigon used as controller needs to run as BLE Central Mode. It will search for a BLE device with targetMAC as MAC Address and targetUUID as available UUID. In this way the controller can write in this characteristic computed tracks’ speed.

Controlling Robot With The Tactigon

Transmission happens 10 times per second:

Controlling Robot With The Tactigon

Euler’s Angles

Since we’re going to use pitch and roll to drive the rover, we need euler’s angles.

qMeter.getQs() contains theese angles in rad, but we prefer degrees:

Controlling Robot With The Tactigon

We defined thrasholds for roll and pitch, in degrees:

Controlling Robot With The Tactigon
Controlling Robot With The Tactigon

The logic of the controller uses “speedWheel” as a common track speed, and “deltaWheel”, as the value to be added or subtracted to each wheel when turning.

There is also a “spin” position to let the rover turn in place.

Controlling Robot With The Tactigon
Controlling Robot With The Tactigon

Now, we have to compute this values for our motor control board, as seen in previous article, it uses 1 to 127 for motor 1 and 128 to 255 for motor 2.

Controlling Robot With The Tactigon

Buffer is filled with computed data, and sent 10 times at second (every 5 loop, and the seen code is executed at 50 Hz).

Controlling Robot With The Tactigon
Controlling Robot With The Tactigon

Conclusion

We can use The Tactigon as a controller, in this case for a rover, but other models can be controlled.  Remember to download the source code below and subscribe to our YouTube channel! 

Comments are closed.