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. 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), as shown in the video above.
Transmission happens 10 times per second:
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:
We defined thrasholds for roll and pitch, in degrees:
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.
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.
Buffer is filled with computed data, and sent 10 times at second (every 5 loop, and the seen code is executed at 50 Hz).