Servo Analysis - Baseline Test

This post is to examine the different ways in which a servo can be controlled through myrobotlab, and some of their limitations and advantages of the different speed implementations.  And more importantly, it is to start information regarding the Baseline Test for Servos.

MRLComm.ino is now more capable but at the same time has become more complex.  In order to continue robust and stable evolution it must be documented in a way which is understandable.  This post is also an effort to document the communcation between MRL & MRLComm to control servos.

New features added

  • Blocking servo moves - This is desired when you want to make a servo move, but don't want to continue until the servo has moved to its destination.  It would avoid the sleep(xxx) method after movements.
  • Arduino Controlled Servo Sweeping - This is desired to offload the computers cpu
  • Servo Events - Information coming back from the servo is now available.  A servo can report its position or when it has come to a stop.
  • Baseline Test - The results of the current Servo.test(pin) function will be recorded and used as a comparison against future releases, so expected or desired functionality can be promoted.
  • Preperation to become a library - Part of the changes are required in order to make MRLComm.ino a library rather than a "main" program.  This will allow others to incoprorate MRL into sketches they have already.


  • Computer - EliteBook 8560w running MRL <<TODO - Version >> MRLComm.ino version
  • Arduino Mega
  • Servo FS5106B

Test #1 Servo speed control implemented on Computer
Each position command is sent by the computer to the Arduino

Servo.sweep ( min=10, max=170, delay=1, step=1 ) 
Resulting CPU graph - shows 1 cpu @ 80%

Servo.sweep ( min=10, max=170, delay=10, step=1 ) 


Test Results 

An i7 computer can do pretty smooth speed control over 57.6K bit rate to MRLComm.ino - but at the minimum delay of 1 ms (fastest sweep) - one cpu is at about 80% ..  with a delay of just 10 ms the cpu is happy, but the sweep is slower.


Test #2 Servo speed control implemented on Controller
Single position & speed command is sent by the computer to the Arduino


Video Test Feedback


This is video (feedback) of the now "standard" Servo test - The test goes through a myriad of sub-tests and attempts to excercise all the various capabilities of the Servo service.  So you might say to yourself. This is boring.  Yes, IT IS !  Its supposed to be so boring and predictable that a machine could verify what is going on.  That is one of the end goals. To use video (or other feedback mechanisms) to tell the software wether or not the testing passed or failed.  At the moment the feedback system is not complete.  I'm showing the video and at the bottom there is text describing each sub-test.  The video IS being captured through OpenCV service. But at the moment it's not actually being tracked.  I "think" a popsicle stick and some TopCodes might get a step closer to "self" verification.  This also would be a good start in the direction of InMoov "self calibration"

Virtual Testing

Here is the example of the newly improved Serial service. I've created a virtual null modem and connecte a Serial service name "uart" to an Arduino service named "arduino".

uart <------- virtual null modem cable -------------> arduino

This is the data sent to MRLComm.ino when the test runs.  It should be pretty simple to at least compare a baseline rx capture file with a new test. 


If you have fast enough computer and if it isn't doing something cpu intesive (like video processing) - then its fully capable of moving a servo by sending the individual commands.  Off loading micro-controllers is a great strategic way to increase performance of a complex hybrid system (such as a complicated robot).  Baseline testing is a way to stabalize fast software development. Open source internet communities have considerable potential to grow and develop systems like these.

Heh, or in other words.  If we all are invovled in some interconnected online testing - we all get the benefit of More Worky ! :D