EN CN
Incremental, relative angle mode with serial API
  • Hi,
    I am looking for a way to control the relative angle using the serial API,
    which is equivalent to the "INC" mode available in scripting language.

    Is it possible to set the angle incrementally or relative to the current angle with the serial API?
  • Hello,

    Serial API does not provide a way of sending a relative angle setpoint. The solution you can use as a workaround:
    1. Receive actual angles IMU_ANGLE using CMD_GET_ANGLES (do it only once)
    2. Calculate relative angle and send in the CMD_CONTROL + MODE_ANGLE. Remember the last angle you send, and in next time you need to do a relative movement, just increment it.
    3. Angle parameter is limited to +-720 degrees, but it's not a problem to go further: just use a native overflow property of a 16-bit variable. With this math the next angle after +720 will be -719.