First code: State Change Planning and motor speed calculation

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)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s