@Override
  public boolean motorAttach(
      String motorName, String type, Integer pwrPin, Integer dirPin, Integer encoderPin) {
    ServiceInterface sw = Runtime.getService(motorName);
    if (!sw.isLocal()) {
      error("motor needs to be in same instance of mrl as controller");
      return false;
    }

    Motor m = (Motor) sw;
    m.setController(this);
    m.broadcastState();
    return true;
  }
 /**
  * creates a DC Motor on port 1,2,3, or 4
  *
  * @param motorNum
  * @throws Exception
  */
 public Motor createDCMotor(Integer motorNum) throws Exception {
   if (motorNum == null || motorNum < 1 || motorNum > 4) {
     error(String.format("motor number should be 1,2,3,4 not %d", motorNum));
     return null;
   }
   String motorName = String.format("%s_m%d", getName(), motorNum);
   deviceNameToNumber.put(motorName, motorNum);
   Motor m = new Motor(motorName);
   m.startService();
   motors.put(motorName, m);
   m.broadcastState();
   m.setController(this);
   return m;
 }