Servo getAngle always gives 180

Hi! We (my students and I) are having fun with the gripper bot, in combination with a roboboard X4. We’re trying to get the gripper arm to work. We now can make the arm move (after we turned the connectors the right way up …) But if we try to get the servo angle, we always get 180 degrees. Surely, we are missing something obvious. Help would be much appreciated.

our sketch:

#include <Arduino.h>

void setup() {
  Serial.begin(9600); 
  X4.servoB.setSpeed(30); // 30 RPM
}

void loop() {
  // Angle control [90:180]
  for (int i = 90; i <= 180; i++) {
      X4.servoB.angle(i); // Spin to angle i
      Serial.printf("Pos: %4d%%, Angle: %3d, Pulse: %4dus\n", 
      X4.servoB.getPos(), 
      X4.servoB.getAngle(), 
      X4.servoB.getPulse()
      );
      delay(100);
  }
}

And the serial gave:
Pos: 100%, Angle: 180, Pulse: 6144us
Pos: 100%, Angle: 180, Pulse: 6144us
Pos: 100%, Angle: 180, Pulse: 6144us
Pos: 100%, Angle: 180, Pulse: 6144us
Pos: 100%, Angle: 180, Pulse: 6144us
Pos: 100%, Angle: 180, Pulse: 6144us
Pos: 100%, Angle: 180, Pulse: 6144us
Pos: 100%, Angle: 180, Pulse: 6144us
Pos: 100%, Angle: 180, Pulse: 6144us
Pos: 100%, Angle: 180, Pulse: 6144us
Pos: 100%, Angle: 180, Pulse: 6144us
Pos: 100%, Angle: 180, Pulse: 6144us
Pos: 100%, Angle: 180, Pulse: 6144us
Pos: 100%, Angle: 180, Pulse: 6144us

The servo was moving, the serial never changed.

1 Like

Could you run this code to print board versions?

#include <Arduino.h>
void setup() {
  Serial.begin(9600);
}
void loop() {
  Serial.printf("revision: v%s, driver: v%s, software: v%s\n",
    X4.getRevision(),
    X4.getDriverVersion(),
    X4.getSoftwareVersion()
  );
  delay(2000);
}

Thanks for the fast reply. I am now on a short city trip in london, but will run the code on my return and let you know. Regards!

The resulting board version:
revision: v1.1, driver: v1.50, software: v2.00

This (servo.get() function) bug was fixed in driver version 1.52, along with dc.setInvert() feature.

Unfortunately, you have revision 1.1 board manufactured before 2022 March. These boards have a known issue resulting in a complete brick if driver gets updated.
This is currently resolved, but we are still working on a solution to fix already sold units.

In a mean time, if you require these features - please contact our support at info@totemmaker.net. We will send you a replacement.