In a previous blog post I introduced my idea of Axis Rotation Planning. Because this concept is more generally applicable, it is instead called “State Change Planning” in the Python code, which is now available on GitHub. It also contains the transformation from the target axis speeds to motor speeds (as derived here). I also added my very first Python unit tests! :).
As long as my description of Axis rotation planning was, as simple it is to use:
# change the roll angle ... # from: roll = 5, rollSpeed = 1 rollState = State(5, 1) # to: roll = 6, rollSpeed = 1 rollTarget = State(6, 1) # plan the change plan = rollState.planChangeTo(rollTarget).inSeconds(1) # usage example: target speed in the period (0s, 0.1s) # This method's results will be used as inputs for the roll PID. inputForRollPID = plan.calculateTargetSpeedForTimePeriod(0, 0.1)