On Tuesday evening we had our first test of the new S.A.R.T. Series M robot with all systems functioning at the same time. During our tests we noticed some of the arm positions caused unnecessary strain on the servos, so we tightened the maximum servo ranges to prevent damage. This meant that some of the original values for the preset positions now lay outside of the allowed positions set in the Maestro Control Centre, resulting in an infinite loop. While this could be avoided entirely in Sights 2, the end-of-life nature of Sights 1 called for a quicker, hackier fix – such as simply changing the magic numbers in the arm position presets.
But how do we convert the positions we have control over in the Maestro Control Centre to positions the servo library can interpret? These two different methods of control use differing, often nonsensical units.
maestro.py, the library that Alex’s new arm servo controller makes use of, describes the units in use like so:
# For servos, target represents the pulse width in of quarter-microseconds
# Servo center is at 1500 microseconds, or 6000 quarter-microseconds
# Typcially valid servo range is 3000 to 9000 quarter-microseconds
Well that clears things up.
So to find out exactly what this meant, a man by the name of Connor had an idea.
At first I wasn’t sure whether this would work. It would require maintaining two connections to the motor controller, which isn’t always possible with hardware like this. This is necessary because after replugging the Maestro servo controller, the servo positions are read usually read as 0 until they are moved again – and of course, if you move the servo to a new position, you can’t read what the old position was.
>>> import maestromaster.maestro as m
>>> c = m.Controller(port="COM11", device=12)
Fortunately, it seems that you can make two different connections to the motor controller. Here it is connected to both the Maestro Control Centre as well as maestro.py in Python.
This is a great way to design arm position presets using Maestro controller and confirm their position as reported by the library we’re using, or indeed, any other library that may use its own idea of target position. It also became clear that the relationship between the Maestro Control Centre software and the Python servo library is a factor of four, meaning we don’t need to break out the laptop for future conversions. However, this process may be useful for different servo controllers or different Python libraries, or even other control software.
As for Sights 1, Alex is working on a slider control system similar to the Maestro Control Centre “status” page, which in addition to allowing us to control the arm manually, will also report the current position in order to create arm position presets.